KiePMMLModelFactoryUtils { public static void addTransformationsInClassOrInterfaceDeclaration(final ClassOrInterfaceDeclaration toPopulate, final TransformationDictionary transformationDictionary, final LocalTransformations localTransformations) { final AtomicInteger arityCounter = new AtomicInteger(0); final Map<String, MethodDeclaration> commonDerivedFieldsMethodMap = (transformationDictionary != null && transformationDictionary.getDerivedFields() != null) ? getDerivedFieldsMethodMap(transformationDictionary.getDerivedFields(), arityCounter) : Collections.emptyMap(); final Map<String, MethodDeclaration> localDerivedFieldsMethodMap = (localTransformations != null && localTransformations.getDerivedFields() != null) ? getDerivedFieldsMethodMap(localTransformations.getDerivedFields(), arityCounter) : Collections.emptyMap(); final Map<String, MethodDeclaration> defineFunctionsMethodMap = (transformationDictionary != null && transformationDictionary.getDefineFunctions() != null) ? getDefineFunctionsMethodMap(transformationDictionary.getDefineFunctions()) : Collections.emptyMap(); populateMethodDeclarations(toPopulate, commonDerivedFieldsMethodMap.values()); populateMethodDeclarations(toPopulate, localDerivedFieldsMethodMap.values()); populateMethodDeclarations(toPopulate, defineFunctionsMethodMap.values()); final ConstructorDeclaration constructorDeclaration = toPopulate.getDefaultConstructor().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_DEFAULT_CONSTRUCTOR, toPopulate.getName()))); populateTransformationsInConstructor(constructorDeclaration, commonDerivedFieldsMethodMap, localDerivedFieldsMethodMap); } private  KiePMMLModelFactoryUtils(); static void setConstructorSuperNameInvocation(final String generatedClassName,
                                      final ConstructorDeclaration constructorDeclaration,
                                      final String name); static void addOutputFieldsPopulation(final BlockStmt body, final List<KiePMMLOutputField> outputFields); static void addTransformationsInClassOrInterfaceDeclaration(final ClassOrInterfaceDeclaration toPopulate, final TransformationDictionary transformationDictionary, final LocalTransformations localTransformations);  }
@Test public void addTransformationsInClassOrInterfaceDeclaration() { KiePMMLModelFactoryUtils.addTransformationsInClassOrInterfaceDeclaration(classOrInterfaceDeclaration, pmmlModel.getTransformationDictionary(), model.getLocalTransformations()); pmmlModel.getTransformationDictionary().getDerivedFields().forEach(derivedField -> commonVerifyDerivedFieldTransformation(derivedField, null, "commonTransformationsMap")); model.getLocalTransformations().getDerivedFields().forEach(derivedField -> commonVerifyDerivedFieldTransformation(derivedField, null, "localTransformationsMap")); commonVerifyConstructorClass("commonTransformationsMap"); commonVerifyConstructorClass("localTransformationsMap"); }