Refactoring
This commit is contained in:
parent
de836a6eeb
commit
b82552b522
|
@ -37,7 +37,7 @@ public class Generator {
|
|||
return modelKnowledge;
|
||||
}
|
||||
|
||||
public Class<? extends Documentation> getDocumentationGeneratorClass(AccessType accessType)
|
||||
public Class<? extends Documentation> getDocumentationClass(AccessType accessType)
|
||||
throws Exception {
|
||||
Class<? extends Documentation> clz;
|
||||
switch (accessType) {
|
||||
|
@ -75,52 +75,52 @@ public class Generator {
|
|||
return clz;
|
||||
}
|
||||
|
||||
protected Documentation getDocumentationGenerator(Type type) throws Exception {
|
||||
Documentation dg = null;
|
||||
protected Documentation getDocumentation(Type type) throws Exception {
|
||||
Documentation d = null;
|
||||
switch (type.getAccessType()) {
|
||||
case PROPERTY:
|
||||
dg = new PropertyDocumentation(type);
|
||||
dg.setLevel(0);
|
||||
d = new PropertyDocumentation(type);
|
||||
d.setLevel(0);
|
||||
break;
|
||||
|
||||
case ENTITY:
|
||||
dg = new EntityDocumentation(type);
|
||||
dg.setLevel(0);
|
||||
d = new EntityDocumentation(type);
|
||||
d.setLevel(0);
|
||||
break;
|
||||
|
||||
case RESOURCE:
|
||||
dg = new ResourceDocumentation(type);
|
||||
dg.setLevel(1);
|
||||
d = new ResourceDocumentation(type);
|
||||
d.setLevel(1);
|
||||
break;
|
||||
|
||||
case FACET:
|
||||
dg = new FacetDocumentation(type);
|
||||
dg.setLevel(1);
|
||||
d = new FacetDocumentation(type);
|
||||
d.setLevel(1);
|
||||
break;
|
||||
|
||||
case RELATION:
|
||||
dg = new RelationDocumentation(type);
|
||||
dg.setLevel(0);
|
||||
d = new RelationDocumentation(type);
|
||||
d.setLevel(0);
|
||||
break;
|
||||
|
||||
case IS_RELATED_TO:
|
||||
dg = new IsRelatedToDocumentation(type);
|
||||
dg.setLevel(1);
|
||||
d = new IsRelatedToDocumentation(type);
|
||||
d.setLevel(1);
|
||||
break;
|
||||
|
||||
case CONSISTS_OF:
|
||||
dg = new ConsistsOfDocumentation(type);
|
||||
dg.setLevel(1);
|
||||
d = new ConsistsOfDocumentation(type);
|
||||
d.setLevel(1);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("I'm not developed to manage the " + AccessType.class.getSimpleName() + " " + type.getName());
|
||||
}
|
||||
UsageKnowledge facetKnowledge = modelKnowledge.getUsageKnowledge(AccessType.FACET);
|
||||
dg.setFacetKnowledge(facetKnowledge);
|
||||
d.setFacetKnowledge(facetKnowledge);
|
||||
UsageKnowledge resourceKnowledge = modelKnowledge.getUsageKnowledge(AccessType.RESOURCE);
|
||||
dg.setResourceKnowledge(resourceKnowledge);
|
||||
return dg;
|
||||
d.setResourceKnowledge(resourceKnowledge);
|
||||
return d;
|
||||
}
|
||||
|
||||
protected File getFile(String fileName, boolean newFile) throws IOException {
|
||||
|
@ -139,7 +139,7 @@ public class Generator {
|
|||
}
|
||||
|
||||
protected void writeSectionOnly(Type type, File file, Integer level) throws Exception {
|
||||
Documentation dg = getDocumentationGenerator(type);
|
||||
Documentation dg = getDocumentation(type);
|
||||
if(level!=null) {
|
||||
dg.setLevel(level);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class Generator {
|
|||
}
|
||||
|
||||
protected void writeTypeToFile(Type type, File file, Integer level) throws Exception {
|
||||
Documentation dg = getDocumentationGenerator(type);
|
||||
Documentation dg = getDocumentation(type);
|
||||
if(level!=null) {
|
||||
dg.setLevel(level);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue