public static void initStaticGetter(final CompilationDTO<? extends Model> compilationDTO,
                                        final ClassOrInterfaceDeclaration modelTemplate) {
        final MethodDeclaration staticGetterMethod =
                modelTemplate.getMethodsByName(GET_MODEL).get(0);
        final BlockStmt staticGetterBody =
                staticGetterMethod.getBody().orElseThrow(() -> new KiePMMLException(String.format(MISSING_BODY_TEMPLATE, staticGetterMethod)));
        final VariableDeclarator variableDeclarator =
                getVariableDeclarator(staticGetterBody, TO_RETURN).orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_IN_BODY, TO_RETURN, staticGetterBody)));

        final MethodCallExpr initializer = variableDeclarator.getInitializer()
                .orElseThrow(() -> new KiePMMLException(String.format(MISSING_VARIABLE_INITIALIZER_TEMPLATE,
                                                                      TO_RETURN, staticGetterBody)))
                .asMethodCallExpr();
        final MethodCallExpr builder = getChainedMethodCallExprFrom("builder", initializer);
        final String fileName = compilationDTO.getFileName();
        final String name = compilationDTO.getModelName();
        final Expression miningFunctionExpression;
        if (compilationDTO.getMINING_FUNCTION() != null) {
            MINING_FUNCTION miningFunction = compilationDTO.getMINING_FUNCTION();
            miningFunctionExpression = new NameExpr(miningFunction.getClass().getName() + "." + miningFunction.name());
        } else {
            miningFunctionExpression = new NullLiteralExpr();
        }
        builder.setArgument(0, new StringLiteralExpr(fileName));
        builder.setArgument(1, new StringLiteralExpr(name));
        builder.setArgument(2, miningFunctionExpression);

        String targetFieldName = compilationDTO.getTargetFieldName();
        final Expression targetFieldExpression;
        if (targetFieldName != null) {
            targetFieldExpression = new StringLiteralExpr(targetFieldName);
        } else {
            targetFieldExpression = new NullLiteralExpr();
        }
        getChainedMethodCallExprFrom("withTargetField", initializer).setArgument(0, targetFieldExpression);

        //
        populateGetCreatedMiningFieldsMethod(modelTemplate, compilationDTO.getKieMiningFields());
        populateGetCreatedOutputFieldsMethod(modelTemplate, compilationDTO.getKieOutputFields());
        populateGetCreatedKiePMMLMiningFieldsMethod(modelTemplate, compilationDTO.getMiningSchema().getMiningFields()
                , compilationDTO.getFields());
        if (compilationDTO.getOutput() != null) {
            populateGetCreatedKiePMMLOutputFieldsMethod(modelTemplate, compilationDTO.getOutput().getOutputFields());
        }
        if (compilationDTO.getKieTargetFields() != null) {
            populateGetCreatedKiePMMLTargetsMethod(modelTemplate, compilationDTO.getKieTargetFields());
        }
        populateGetCreatedTransformationDictionaryMethod(modelTemplate, compilationDTO.getTransformationDictionary());
        populateGetCreatedLocalTransformationsMethod(modelTemplate, compilationDTO.getLocalTransformations());
    }
@Test
    void initStaticGetter() throws IOException {
        final CompilationDTO compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME,
                                                                                                     pmmlModel,
                                                                                                     model,
                                                                                                     new PMMLCompilationContextMock(), SOURCE_BASE);
        org.kie.pmml.compiler.commons.codegenfactories.KiePMMLModelFactoryUtils.initStaticGetter(compilationDTO,
                                                                                                 classOrInterfaceDeclaration);
        String text = getFileContent(TEST_04_SOURCE);
        MethodDeclaration expected = JavaParserUtils.parseMethod(text);
        assertThat(staticGetterMethod.toString()).isEqualTo(expected.toString());
        assertThat(JavaParserUtils.equalsNode(expected, staticGetterMethod)).isTrue();
    }