Improved code

This commit is contained in:
Luca Frosini 2023-01-24 20:03:52 +01:00
parent 672ebb199f
commit f06dbb302c
2 changed files with 1 additions and 19 deletions

View File

@ -54,11 +54,7 @@ public class ClassesDiscoveryGenerator extends Generator {
}
protected <E extends Element> void discover(AccessType at, Package[] packages) throws Exception {
/*
* I need to get all types also the types defined in IS Model
* to properly support the specilizations if any
*/
ElementSpecilizationDiscovery<E> discovery = new ElementSpecilizationDiscovery<>(at.getTypeClass(), true);
ElementSpecilizationDiscovery<E> discovery = new ElementSpecilizationDiscovery<>(at.getTypeClass(), false);
if(Objects.nonNull(packages)) {
Arrays.stream(packages).forEach(p -> discovery.addPackage(p));
}

View File

@ -35,19 +35,12 @@ public class TreeGenerator extends Generator {
public static final String RELATIONS_FILENAME = "relations.rst";
protected static final List<Class<? extends Property>> isModelProperties;
protected static final List<String> isModelPropertyNames;
static {
isModelProperties = new ArrayList<>();
isModelProperties.add(Header.class);
isModelProperties.add(Encrypted.class);
isModelProperties.add(PropagationConstraint.class);
isModelPropertyNames= new ArrayList<>();
isModelPropertyNames.add(Header.NAME);
isModelPropertyNames.add(Encrypted.NAME);
isModelPropertyNames.add(PropagationConstraint.NAME);
}
protected Map<AccessType, Tree> types;
@ -92,13 +85,6 @@ public class TreeGenerator extends Generator {
* Going to skip it
*/
writeSectionOnly(type, level);
}else if(isModelPropertyNames.contains(type.getName())){
// Can be Header, Encrypted or PropagationConstraint
if(node.getChildrenNodes()!=null && node.getChildrenNodes().size()>0) {
// If they have specialization I just add the section
// to maintain the level, otherwise I skip it
writeSectionOnly(type, level);
}
} else {
writeTypeToFile(type, file, level);
}