public class CommonCodegenUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
OPTIONAL_FILTERED_KIEPMMLNAMEVALUE_NAME |
| Modifier and Type | Method and Description |
|---|---|
static void |
addMapPopulation(Map<String,com.github.javaparser.ast.body.MethodDeclaration> toAdd,
com.github.javaparser.ast.stmt.BlockStmt body,
String mapName)
For every entry in the given map, add
(mapName).put(entry_key, this::entry_value_ref>);
e.g.
|
static com.github.javaparser.ast.stmt.ExpressionStmt |
getFilteredKiePMMLNameValueExpression(String kiePMMLNameValueListParam,
String fieldNameToRef,
boolean stringLiteralComparison)
Returns
Optional
List<KiePMMLNameValue> parameter, and
fieldNameToRef is the name of the field to find, in the containing method |
static com.github.javaparser.ast.body.MethodDeclaration |
getMethodDeclaration(String methodName)
Returns
empty (methodName)() {
}
A no-parameter
MethodDeclaration whose name is derived from given methodName
and methodArity |
static com.github.javaparser.ast.body.MethodDeclaration |
getMethodDeclaration(String methodName,
Map<String,com.github.javaparser.ast.type.ClassOrInterfaceType> parameterNameTypeMap)
Returns
empty (methodName)((list of parameterType parameter name)) {
}
a multi-parameters
MethodDeclaration whose names are the keys of the given Map
and methodArity, and whose parameters types are the values
The |
static com.github.javaparser.ast.stmt.ReturnStmt |
getReturnStmt(String returnedVariableName)
Returns
return (returnedVariableName);
e.g
return varOne;
|
static com.github.javaparser.ast.type.ClassOrInterfaceType |
getTypedClassOrInterfaceType(String className,
List<String> typesName)
Returns
(className)<(comma-separated list of types)>
e.g
CLASS_NAME
ClassOrInterfaceType |
static void |
populateMethodDeclarations(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration toPopulate,
Collection<com.github.javaparser.ast.body.MethodDeclaration> methodDeclarations)
Populate the
ClassOrInterfaceDeclaration with the provided MethodDeclarations |
public static String OPTIONAL_FILTERED_KIEPMMLNAMEVALUE_NAME
public static void populateMethodDeclarations(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration toPopulate,
Collection<com.github.javaparser.ast.body.MethodDeclaration> methodDeclarations)
ClassOrInterfaceDeclaration with the provided MethodDeclarationstoPopulate - methodDeclarations - public static com.github.javaparser.ast.stmt.ExpressionStmt getFilteredKiePMMLNameValueExpression(String kiePMMLNameValueListParam, String fieldNameToRef, boolean stringLiteralComparison)
Optionalexpression, where kiePMMLNameValueListParam is the name of thekiePMMLNameValue = (kiePMMLNameValueListParam) .stream() .filter((KiePMMLNameValue kpmmlnv) -> Objects.equals("(fieldNameToRef)", kpmmlnv.getName())) .findFirst();
List<KiePMMLNameValue> parameter, and
fieldNameToRef is the name of the field to find, in the containing methodkiePMMLNameValueListParam - fieldNameToRef - stringLiteralComparison - if true, equals comparison is made on the String, e.g Objects.equals("(fieldNameToRef)", kpmmlnv.getName())),
otherwise, is done on object reference, e.g Objects.equals((fieldNameToRef), kpmmlnv.getName())). In this latter case, a fieldNameToRef variable is
expected to existspublic static void addMapPopulation(Map<String,com.github.javaparser.ast.body.MethodDeclaration> toAdd, com.github.javaparser.ast.stmt.BlockStmt body, String mapName)
(mapName).put(entry_key, this::entry_value_ref>);
e.g.
MAP_NAME.put("KEY_0", this::METHOD_015);
MAP_NAME.put("KEY_3", this::METHOD_33);
MAP_NAME.put("KEY_2", this::METHOD_219);
MAP_NAME.put("KEY_4", this::METHOD_46);
inside the given BlockStmttoAdd - body - mapName - public static com.github.javaparser.ast.body.MethodDeclaration getMethodDeclaration(String methodName, Map<String,com.github.javaparser.ast.type.ClassOrInterfaceType> parameterNameTypeMap)
empty (methodName)((list of parameterType parameter name)) {
}
a multi-parameters MethodDeclaration whose names are the keys of the given Map
and methodArity, and whose parameters types are the values
The methodName - parameterNameTypeMap - expecting an ordered map here, since parameters order matter for caller codepublic static com.github.javaparser.ast.body.MethodDeclaration getMethodDeclaration(String methodName)
empty (methodName)() {
}
A no-parameter MethodDeclaration whose name is derived from given methodName
and methodAritymethodName - public static com.github.javaparser.ast.stmt.ReturnStmt getReturnStmt(String returnedVariableName)
return (returnedVariableName);
e.g
return varOne;
returnedVariableName - public static com.github.javaparser.ast.type.ClassOrInterfaceType getTypedClassOrInterfaceType(String className, List<String> typesName)
(className)<(comma-separated list of types)>
e.g
CLASS_NAME
a typed ClassOrInterfaceTypeclassName - typesName - Copyright © 2001–2020 JBoss by Red Hat. All rights reserved.