@Test public void getFieldRefMethodDeclaration() { int methodArity = new Random().nextInt(20); FieldRef fieldRef = fieldRefSupplier.get(); MethodDeclaration retrieved = DerivedFieldFunctionUtils.getFieldRefMethodDeclaration(fieldRef, STRING_CLASS, methodArity, DEFAULT_PARAMETERTYPE_MAP); String expectedVariable = String.format("%1$s fieldRefVariable = (%1$s) kiePMMLNameValue.map(%2$s::getValue)" + ".orElse(%3$s);", String.class.getName(), KiePMMLNameValue.class.getName(), fieldRef.getMapMissingTo()); commonValidateFieldRef(retrieved, fieldRef, methodArity, expectedVariable, String.class.getName()); fieldRef.setMapMissingTo("MAP_MISSING_TO"); retrieved = DerivedFieldFunctionUtils.getFieldRefMethodDeclaration(fieldRef, STRING_CLASS, methodArity, DEFAULT_PARAMETERTYPE_MAP); expectedVariable = String.format("%1$s fieldRefVariable = (%1$s) kiePMMLNameValue.map(%2$s::getValue).orElse" + "(\"%3$s\");", String.class.getName(), KiePMMLNameValue.class.getName(), fieldRef.getMapMissingTo()); commonValidateFieldRef(retrieved, fieldRef, methodArity, expectedVariable, String.class.getName()); }
static MethodDeclaration getFieldRefMethodDeclaration(final FieldRef fieldRef, final ClassOrInterfaceType returnedType, final int methodArity, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { String methodName = String.format(METHOD_NAME_TEMPLATE, fieldRef.getClass().getSimpleName(), methodArity); return getFieldRefExpressionMethodDeclaration(methodName, fieldRef, returnedType, parameterNameTypeMap); }
DerivedFieldFunctionUtils { static MethodDeclaration getFieldRefMethodDeclaration(final FieldRef fieldRef, final ClassOrInterfaceType returnedType, final int methodArity, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { String methodName = String.format(METHOD_NAME_TEMPLATE, fieldRef.getClass().getSimpleName(), methodArity); return getFieldRefExpressionMethodDeclaration(methodName, fieldRef, returnedType, parameterNameTypeMap); } }
DerivedFieldFunctionUtils { static MethodDeclaration getFieldRefMethodDeclaration(final FieldRef fieldRef, final ClassOrInterfaceType returnedType, final int methodArity, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { String methodName = String.format(METHOD_NAME_TEMPLATE, fieldRef.getClass().getSimpleName(), methodArity); return getFieldRefExpressionMethodDeclaration(methodName, fieldRef, returnedType, parameterNameTypeMap); } private  DerivedFieldFunctionUtils(); }
DerivedFieldFunctionUtils { static MethodDeclaration getFieldRefMethodDeclaration(final FieldRef fieldRef, final ClassOrInterfaceType returnedType, final int methodArity, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { String methodName = String.format(METHOD_NAME_TEMPLATE, fieldRef.getClass().getSimpleName(), methodArity); return getFieldRefExpressionMethodDeclaration(methodName, fieldRef, returnedType, parameterNameTypeMap); } private  DerivedFieldFunctionUtils();  }
DerivedFieldFunctionUtils { static MethodDeclaration getFieldRefMethodDeclaration(final FieldRef fieldRef, final ClassOrInterfaceType returnedType, final int methodArity, final LinkedHashMap<String, ClassOrInterfaceType> parameterNameTypeMap) { String methodName = String.format(METHOD_NAME_TEMPLATE, fieldRef.getClass().getSimpleName(), methodArity); return getFieldRefExpressionMethodDeclaration(methodName, fieldRef, returnedType, parameterNameTypeMap); } private  DerivedFieldFunctionUtils();   }