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)
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,
List<com.github.javaparser.ast.type.ClassOrInterfaceType> parameterTypes)
Returns
empty (methodName)((list of parameterType paramindex)) {
}
a multi-parameters
MethodDeclaration whose name is derived from given methodName
and methodArity, and whose parameters types are defined by parameterTypes |
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)
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 - public 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, List<com.github.javaparser.ast.type.ClassOrInterfaceType> parameterTypes)
empty (methodName)((list of parameterType paramindex)) {
}
a multi-parameters MethodDeclaration whose name is derived from given methodName
and methodArity, and whose parameters types are defined by parameterTypesmethodName - parameterTypes - public 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.