use of com.github.javaparser.StaticJavaParser.parseStatement in project drools by kiegroup.
the class PropagatorCompilerHandler method emitCode.
public String emitCode() {
MethodDeclaration propagateMethod = new MethodDeclaration().setModifiers(Modifier.Keyword.PUBLIC, Modifier.Keyword.FINAL).setType(new VoidType()).setName(propagateMethodName()).setParameters(methodParameters());
BlockStmt body = new BlockStmt();
propagateMethod.setBody(body);
body.addStatement(StaticJavaParser.parseStatement(String.format("if(logger.isDebugEnabled()) {\n" + " logger.debug(\"%s on compiled alpha network {} {} {}\", handle, context, wm);\n" + " }\n", propagateMethodName())));
postProcessAllStatements();
for (Statement s : allStatements.getStatements()) {
body.addStatement(s);
}
StringBuilder allCodeGenerated = new StringBuilder();
allCodeGenerated.append(propagateMethod.toString());
allCodeGenerated.append(NEWLINE);
for (MethodDeclaration md : extractedMethods) {
allCodeGenerated.append(md.toString());
allCodeGenerated.append(NEWLINE);
allCodeGenerated.append(NEWLINE);
}
return allCodeGenerated.toString();
}
Aggregations