use of org.drools.modelcompiler.builder.errors.DuplicatedDeclarationError in project drools by kiegroup.
the class POJOGenerator method findPOJOorGenerate.
public void findPOJOorGenerate() {
TypeResolver typeResolver = pkg.getTypeResolver();
Set<String> generatedPojos = new HashSet<>();
for (TypeDeclarationDescr typeDescr : packageDescr.getTypeDeclarations()) {
if (!generatedPojos.add(typeDescr.getFullTypeName())) {
builder.addBuilderResult(new DuplicatedDeclarationError(typeDescr.getFullTypeName()));
continue;
}
try {
Class<?> type = typeResolver.resolveType(typeDescr.getFullTypeName());
checkRedeclarationCompatibility(type, typeDescr);
processTypeMetadata(type, typeDescr.getAnnotations());
} catch (ClassNotFoundException e) {
createPOJO(typeDescr);
}
}
for (EnumDeclarationDescr enumDescr : packageDescr.getEnumDeclarations()) {
try {
Class<?> type = typeResolver.resolveType(enumDescr.getFullTypeName());
processTypeMetadata(type, enumDescr.getAnnotations());
} catch (ClassNotFoundException e) {
TypeDeclaration generatedEnum = new EnumGenerator().generate(enumDescr);
packageModel.addGeneratedPOJO(generatedEnum);
addTypeMetadata(enumDescr.getTypeName());
}
}
}
Aggregations