class KiePMMLRegressionTableRegressionFactory {

    static void populateGetTargetCategory(final ClassOrInterfaceDeclaration tableTemplate,
                                                    final Object targetCategory) {
        MethodDeclaration methodDeclaration = tableTemplate.getMethodsByName("getTargetCategory").get(0);
        final BlockStmt body =
                methodDeclaration.getBody().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_BODY_TEMPLATE, methodDeclaration.getName())));
        ReturnStmt returnStmt = new ReturnStmt();
        if (targetCategory == null) {
            returnStmt.setExpression(new NameExpr("null"));
        } else if (targetCategory instanceof String) {
            returnStmt.setExpression(new StringLiteralExpr((String) targetCategory));
        } else {
            returnStmt.setExpression(new NameExpr(targetCategory.toString()));
        }
        body.addStatement(returnStmt);
    }

    private  KiePMMLRegressionTableRegressionFactory();

}