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