class CommonCodegenUtils {

    public static MethodDeclaration addMethod(final MethodDeclaration methodTemplate,
                                                 final ClassOrInterfaceDeclaration tableTemplate,
                                                 final String methodName) {
        final BlockStmt body =
                methodTemplate.getBody().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_BODY_TEMPLATE, methodTemplate.getName())));
        final MethodDeclaration toReturn = tableTemplate.addMethod(methodName).setBody(body);
        toReturn.setModifiers(methodTemplate.getModifiers());
        methodTemplate.getParameters().forEach(toReturn::addParameter);
        toReturn.setType(methodTemplate.getType());
        return toReturn;
    }

    private  CommonCodegenUtils();

}