Class JavaParserUtils

java.lang.Object
org.kie.pmml.compiler.commons.utils.JavaParserUtils

public class JavaParserUtils extends Object
Class to provide shared, helper methods to be invoked by model-specific code-generation
  • Field Details

  • Method Details

    • getFromFileName

      public static com.github.javaparser.ast.CompilationUnit getFromFileName(String fileName)
    • getFromSource

      public static com.github.javaparser.ast.CompilationUnit getFromSource(String source)
    • getKiePMMLModelCompilationUnit

      public static com.github.javaparser.ast.CompilationUnit getKiePMMLModelCompilationUnit(String className, String packageName, String javaTemplate, String modelClassName)
      Parameters:
      className -
      packageName -
      javaTemplate - the name of the file to be used as template source
      modelClassName - the name of the class used in the provided template
      Returns:
    • getFullClassName

      public static String getFullClassName(com.github.javaparser.ast.CompilationUnit cu)
      Return the fully qualified name of the generated class. It throws KiePMMLException if the package name is missing
      Parameters:
      cu -
      Returns:
    • parseMethod

      public static com.github.javaparser.ast.body.MethodDeclaration parseMethod(String method)
    • parseBlock

      public static com.github.javaparser.ast.stmt.BlockStmt parseBlock(String block)
    • parseConstructorBlock

      public static com.github.javaparser.ast.stmt.BlockStmt parseConstructorBlock(String block)
    • parseStatement

      public static com.github.javaparser.ast.stmt.Statement parseStatement(String statement)
    • parseExpression

      public static com.github.javaparser.ast.expr.Expression parseExpression(String statement)
    • equalsNode

      public static boolean equalsNode(com.github.javaparser.ast.Node node1, com.github.javaparser.ast.Node node2)
    • printNode

      public static String printNode(com.github.javaparser.ast.Node node)