use of org.drools.modelcompiler.builder.generator.declaredtype.generator.GeneratedClassDeclaration in project drools by kiegroup.
the class POJOGenerator method createPOJO.
private void createPOJO(TypeDeclarationDescr typeDescr) {
SafeTypeResolver typeResolver = new SafeTypeResolver(pkg.getTypeResolver());
DescrTypeDefinition descrDeclaredTypeDefinition = new DescrTypeDefinition(packageDescr, typeDescr, typeResolver);
descrDeclaredTypeDefinition.getErrors().forEach(builder::addBuilderResult);
// Implemented types should be probably in
ClassOrInterfaceDeclaration generatedClass = new GeneratedClassDeclaration(descrDeclaredTypeDefinition, MARKER_INTERFACES).toClassDeclaration();
packageModel.addGeneratedPOJO(generatedClass);
addTypeMetadata(typeDescr.getTypeName());
}
use of org.drools.modelcompiler.builder.generator.declaredtype.generator.GeneratedClassDeclaration in project drools by kiegroup.
the class DMNTypeSafeTypeGenerator method generateSourceCodeOfAllTypes.
public Map<String, String> generateSourceCodeOfAllTypes() {
Map<String, String> allSources = new HashMap<>();
DMNTypeSafePackageName packageDeclaration = this.packageName.create(dmnModel);
for (TypeDefinition typeDefinition : types) {
ClassOrInterfaceDeclaration generatedClass = new GeneratedClassDeclaration(typeDefinition, Collections.emptyList()).toClassDeclaration();
CompilationUnit cu = new CompilationUnit(packageDeclaration.packageName());
cu.getPackageDeclaration().ifPresent(pd -> pd.setBlockComment(this.disclaimerMarker));
cu.addType(generatedClass);
LOG.debug("\n{}", cu);
allSources.put(packageDeclaration.appendPackage(typeDefinition.getTypeName()), cu.toString());
}
return allSources;
}
Aggregations