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

templates.domain.INImpl.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 = []>
<#if serialization>
<#assign importList = importList + ["java.io.Serializable"]>

<#if jsonNonNull>
<#assign importList = importList + ["com.fasterxml.jackson.annotation.JsonInclude"]>

<#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 utilFolderName != domainFolderName>
<#assign importList = importList + ["${javaPackage}.${utilFolderName}.${prefixUtilityName}SafeDate"]>

<#elseif parameter.blob>
<#if 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 parameters for <#if proc.function>function<#else>stored procedure.
 *
 * ${proc.fullName}
 *
 * @author @GENERATOR.NAME@
 * @version @GENERATOR.VERSION@
 */
 
<#if jsonNonNull>
@JsonInclude(JsonInclude.Include.NON_NULL)

final class ${proc.className}INImpl implements${'\n'}        ${proc.className}IN<#if serialization>,${'\n'}        Serializable {
<#if serialization>

<#if documentation>
    /**
     * Serialization.
     */

    static final long serialVersionUID = 1L;

<#list proc.inputParameters as parameter>

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

    private <#if fullConstructor>final ${parameter.javaTypeName} ${parameter.fieldName}${proc.className}<#if !fullConstructor> = null;

<#if !fullConstructor>

<#if documentation>
    /**
     * Class Constructor ${proc.className}INImpl.
     *
     */

    public ${proc.className}INImpl() {
    }


<#if documentation>
    /**
     * Class Constructor ${proc.className}INImpl.
     *
     * @param ${proc.className}IN in${proc.className}Instance
     */

    public ${proc.className}INImpl(final ${proc.className}IN in${proc.className}Instance) {
<#if fullConstructor>
        this(${'\n'}            <#list proc.inputParameters as parameter2>in${proc.className}Instance.get${parameter2.propertyName}()<#sep>,${'\n'}            ${'\n'}        );
<#else>
<#list proc.inputParameters as parameter2>
        this.set${parameter2.propertyName}(in${proc.className}Instance.get${parameter2.propertyName}());


    }
<#if fullConstructor>

<#if documentation>
    /**
     * Class constructor ${proc.className}INImpl.
     *
     * ${proc.fullName}
     *
<#list proc.inputParameters as parameter>
     * @param ${parameter.fieldName} set value of ${parameter.name}

     */

    public ${proc.className}INImpl(${'\n'}            <#list proc.inputParameters as parameter>final ${parameter.javaTypeName} ${parameter.fieldName}<#sep>,${'\n'}            ${'\n'}    ) {
<#list proc.inputParameters as parameter>
<#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};


    }

<#list proc.inputParameters as parameter>

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

    @Override
    public ${parameter.javaTypeName} get${parameter.propertyName}() {
<#if parameter.date>
        return ${prefixUtilityName}SafeDate.process(${parameter.fieldName}${proc.className});
<#elseif parameter.blob>
        return ${prefixUtilityName}SafeByteArray.process(${parameter.fieldName}${proc.className});
<#else>
        return ${parameter.fieldName}${proc.className};

    }
<#if !fullConstructor>

<#if documentation>
    /**
    /**
     * Setter of ${parameter.name}.
     *
     * ${proc.fullName}
     *
     * @param ${parameter.fieldName} ${parameter.name} to set
     */

    public void set${parameter.propertyName}(final ${parameter.javaTypeName} ${parameter.fieldName}) {
<#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};

    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy