KiePMMLRegressionTableRegressionFactory { static void setConstructor(final RegressionTable regressionTable, final ConstructorDeclaration constructorDeclaration, final SimpleName tableName, final String targetField) { constructorDeclaration.setName(tableName); final BlockStmt body = constructorDeclaration.getBody(); CommonCodegenUtils.setAssignExpressionValue(body, "intercept", new DoubleLiteralExpr(String.valueOf(regressionTable.getIntercept().doubleValue()))); CommonCodegenUtils.setAssignExpressionValue(body, "targetField", new StringLiteralExpr(targetField)); } private  KiePMMLRegressionTableRegressionFactory(); static LinkedHashMap<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables,
                                                                                        final RegressionModel.NormalizationMethod normalizationMethod,
                                                                                        final List<KiePMMLOutputField> outputFields,
                                                                                        final String targetField,
                                                                                        final String packageName); static Map.Entry<String, String> getRegressionTable(final RegressionTable regressionTable,
                                                               final RegressionModel.NormalizationMethod normalizationMethod,
                                                               final List<KiePMMLOutputField> outputFields,
                                                               final String targetField,
                                                               final String packageName); static final String KIE_PMML_REGRESSION_TABLE_REGRESSION_TEMPLATE_JAVA; static final String KIE_PMML_REGRESSION_TABLE_REGRESSION_TEMPLATE; }
@Test public void setConstructor() { regressionTable = getRegressionTable(3.5, "professional"); ConstructorDeclaration constructorDeclaration = modelTemplate.getDefaultConstructor().get(); SimpleName tableName = new SimpleName("TableName"); String targetField = "targetField"; KiePMMLRegressionTableRegressionFactory.setConstructor(regressionTable, constructorDeclaration, tableName, targetField); Map<Integer, Expression> superInvocationExpressionsMap = new HashMap<>(); Map<String, Expression> assignExpressionMap = new HashMap<>(); assignExpressionMap.put("targetField", new StringLiteralExpr(targetField)); assignExpressionMap.put("intercept", new DoubleLiteralExpr(String.valueOf(3.5))); assertTrue(commonEvaluateConstructor(constructorDeclaration, tableName.asString(), superInvocationExpressionsMap, assignExpressionMap)); }