All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.domain.INBuilder.ftl Maven / Gradle / Ivy

Go to download

Maven plugin to generate Java classes from StoredProcedure and Functions in Database

There is a newer version: 1.8.20
Show newest version
<#if documentation>
<#if header>
/*
 * Copyright (C) 2019 Yadickson Soto
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */


package ${javaPackage}.${domainFolderName};
<#assign importList = []>
<#list proc.arrayImports as parameter>
<#if arrayFolderName != domainFolderName>
<#assign importList = importList + ["${javaPackage}.${arrayFolderName}.${parameter.javaTypeName}"]>


<#list proc.objectImports as parameter>
<#if objectFolderName != domainFolderName>
<#assign importList = importList + ["${javaPackage}.${objectFolderName}.${parameter.javaTypeName}"]>


<#list proc.inputParameters as parameter>
<#if parameter.date>
<#assign importList = importList + ["java.util.Date"]>
<#if fullConstructor && utilFolderName != domainFolderName>
<#assign importList = importList + ["${javaPackage}.${utilFolderName}.${prefixUtilityName}SafeDate"]>

<#elseif parameter.blob>
<#if fullConstructor && utilFolderName != domainFolderName>
<#assign importList = importList + ["${javaPackage}.${utilFolderName}.${prefixUtilityName}SafeByteArray"]>




<#list importSort(importList) as import>
<#if previousImportMatch?? && !import?starts_with(previousImportMatch)>


import ${import};
<#assign previousImportMatch = import?keep_before_last(".") >

<#if importList?has_content>


<#if documentation>
/**
 * Input builder parameters for <#if proc.function>function<#else>stored procedure.
 *
 * ${proc.fullName}
 *
 * @author @GENERATOR.NAME@
 * @version @GENERATOR.VERSION@
 */
 
public final class ${proc.className}INBuilder {
<#if !fullConstructor>

<#if documentation>
    /**
     * Input parameter ${proc.className}INImpl to build.
     *
     * ${proc.fullName}
     */

    private final ${proc.className}INImpl input;
<#else>
<#list proc.inputParameters as parameter>

<#if documentation>
    /**
     * Input parameter ${parameter.name}.
     *
     * ${proc.fullName}
     */

    private ${parameter.javaTypeName} ${parameter.fieldName}${proc.className} = null;



<#if documentation>
    /**
     * Class constructor ${proc.className}INBuilder.
     *
     * ${proc.fullName}
     *
     */

    public ${proc.className}INBuilder() {
<#if !fullConstructor>
        this.input = new ${proc.className}INImpl();

    }

<#if documentation>
    /**
     * Class constructor ${proc.className}INBuilder.
     *
     * ${proc.fullName}
     *
     * @param ${proc.className}IN in${proc.className}Instance
     *
     */

    public ${proc.className}INBuilder(final ${proc.className}IN in${proc.className}Instance) {
<#if !fullConstructor>
        this.input = new ${proc.className}INImpl(in${proc.className}Instance);
<#else>
<#list proc.inputParameters as parameter>
        this.${parameter.fieldName}(in${proc.className}Instance.get${parameter.propertyName}());


    }
<#list proc.inputParameters as parameter>

<#if documentation>
    /**
     * Getter of ${parameter.name}.
     *
     * ${proc.fullName}
     *
     * @return The ${proc.className}INBuilder in${proc.className}Instance.
     */

    public ${proc.className}INBuilder ${parameter.fieldName}(final ${parameter.javaTypeName} ${parameter.fieldName}) {
<#if !fullConstructor>
        this.input.set${parameter.propertyName}(${parameter.fieldName});
<#else>
<#if parameter.date>
        this.${parameter.fieldName}${proc.className} = ${prefixUtilityName}SafeDate.process(${parameter.fieldName});
<#elseif parameter.blob>
        this.${parameter.fieldName}${proc.className} = ${prefixUtilityName}SafeByteArray.process(${parameter.fieldName});
<#else>
        this.${parameter.fieldName}${proc.className} = ${parameter.fieldName};


        return this;
    }


<#if documentation>
    /**
     * Getter ${proc.className}IN in${proc.className}Instance.
     *
     * ${proc.fullName}
     *
     * @return The ${proc.className}IN in${proc.className}Instance.
     */

    public ${proc.className}IN build() {
<#if fullConstructor>
        return new ${proc.className}INImpl(${'\n'}            <#list proc.inputParameters as parameter>this.${parameter.fieldName}${proc.className}<#sep>,${'\n'}            ${'\n'}        );
<#else>
        return this.input;

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy