@Test public void getExpressionMethodDeclaration() { String methodName = "METHOD_NAME"; String variableName = "VARIABLE_NAME"; MethodDeclaration retrieved = ExpressionFunctionUtils.getExpressionMethodDeclaration(methodName, variableName, new BlockStmt(), parseClassOrInterfaceType(Object.class.getName()), DEFAULT_PARAMETERTYPE_MAP); assertNotNull(retrieved); String expected = "java.lang.Object METHOD_NAME(java.util.List<org.kie.pmml.commons.model.tuples" + ".KiePMMLNameValue> param1) {\n" + " return VARIABLE_NAME;\n" + "}"; assertEquals(expected, retrieved.toString()); }
static MethodDeclaration getExpressionMethodDeclaration(final String methodName, final String variableName, final BlockStmt body, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { final ReturnStmt returnStmt = getReturnStmt(variableName); body.addStatement(returnStmt); MethodDeclaration toReturn = getMethodDeclaration(methodName, parameterNameTypeMap); toReturn.setType(returnedType); toReturn.setBody(body); return toReturn; }
ExpressionFunctionUtils { static MethodDeclaration getExpressionMethodDeclaration(final String methodName, final String variableName, final BlockStmt body, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { final ReturnStmt returnStmt = getReturnStmt(variableName); body.addStatement(returnStmt); MethodDeclaration toReturn = getMethodDeclaration(methodName, parameterNameTypeMap); toReturn.setType(returnedType); toReturn.setBody(body); return toReturn; } }
ExpressionFunctionUtils { static MethodDeclaration getExpressionMethodDeclaration(final String methodName, final String variableName, final BlockStmt body, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { final ReturnStmt returnStmt = getReturnStmt(variableName); body.addStatement(returnStmt); MethodDeclaration toReturn = getMethodDeclaration(methodName, parameterNameTypeMap); toReturn.setType(returnedType); toReturn.setBody(body); return toReturn; } private  ExpressionFunctionUtils(); }
ExpressionFunctionUtils { static MethodDeclaration getExpressionMethodDeclaration(final String methodName, final String variableName, final BlockStmt body, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { final ReturnStmt returnStmt = getReturnStmt(variableName); body.addStatement(returnStmt); MethodDeclaration toReturn = getMethodDeclaration(methodName, parameterNameTypeMap); toReturn.setType(returnedType); toReturn.setBody(body); return toReturn; } private  ExpressionFunctionUtils();  }
ExpressionFunctionUtils { static MethodDeclaration getExpressionMethodDeclaration(final String methodName, final String variableName, final BlockStmt body, final ClassOrInterfaceType returnedType, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { final ReturnStmt returnStmt = getReturnStmt(variableName); body.addStatement(returnStmt); MethodDeclaration toReturn = getMethodDeclaration(methodName, parameterNameTypeMap); toReturn.setType(returnedType); toReturn.setBody(body); return toReturn; } private  ExpressionFunctionUtils();   }