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

templates.velocity.simplebean.perschema.constant.vm Maven / Gradle / Ivy

There is a newer version: 5.2.0
Show newest version
#parse( "schema.include.vm" )
#parse( "header.include.vm" )
#set ( $javaClassName = 'Constant' )

$codewriter.setCurrentJavaFilename($pkg, "${javaClassName}.java")
package $pkg;
#####################
/**
 * constant declare
 * @author guyadong
 */
public interface $javaClassName {  
    //////////////////////////////////////
    // COLUMN COLUMN CONSTANT
    //////////////////////////////////////    
    #join($tables '
    public static final int ${e.name.toUpperCase()}_COLUMN_COUNT = $e.countColumns();
    public static final int ${e.name.toUpperCase()}_PK_COUNT = $e.countPrimaryKeys();' '')

    //////////////////////////////////////
    // COLUMN ID DECLARE
    //////////////////////////////////////    
#foreach($t in $tables)
#foreach ( $column in $t.columns )
#set ( $vcmo = $velocityCount - 1 )
    /** Identify the $column.getFullName() field (ordinal:$column.getOrdinalPosition()). */
    public static final int $column.getIDConstName() = $vcmo;
#end
#end
    //////////////////////////////////////
    // COLUMN NAME DECLARE
    //////////////////////////////////////    
#foreach($t in $tables)
    /////////////////// $t.name ////////////
    /** Contains all the pk fields name of the $t.name table.*/
    public static final String $t.name.toUpperCase()_PK_FIELDS ="#join($t.primaryKeys '$e.name' '"
                            + ",')";
    public static final java.util.List $t.name.toUpperCase()_PK_FIELDS_LIST = java.util.Arrays.asList(${t.name.toUpperCase()}_PK_FIELDS.split(","));
    /** Contains all the full fields of the $t.name table.*/
    public static final String $t.name.toUpperCase()_FULL_FIELDS ="#join($t.columns '$e.fullName' '"
                            + ",')";
    /** Field that contains the comma separated fields of the $t.name table. */
    public static final String $t.name.toUpperCase()_FIELDS = "#join($t.columns '$e.name' '"
                            + ",')";
    public static final java.util.List $t.name.toUpperCase()_FIELDS_LIST = java.util.Arrays.asList(${t.name.toUpperCase()}_FIELDS.split(","));
    /** Field that contains the comma separated java fields of the $t.name table. */
    public static final String $t.name.toUpperCase()_JAVA_FIELDS = "#join($t.columns '$e.varName' '"
                            + ",')";
    public static final java.util.List $t.name.toUpperCase()_JAVA_FIELDS_LIST = java.util.Arrays.asList(${t.name.toUpperCase()}_JAVA_FIELDS.split(","));
    
    /** column type names of the $t.name table. */
    public static final String[] $t.name.toUpperCase()_COLUMN_TYPE_NAMES = new String[]{
        #join($t.columns '"${e.typeName}"' ',
        ')};

    public static final java.util.List $t.name.toUpperCase()_COLUMN_TYPE_NAME_LIST = java.util.Arrays.asList(${t.name.toUpperCase()}_COLUMN_TYPE_NAMES);

    /** Field java types of the $t.name table. */
    public static final Class[] $t.name.toUpperCase()_FIELD_TYPES = new Class[]{
        #join($t.columns '${e.getJavaType()}.class' ',
        ')};
    /** Field size of the $t.name table. */
    public static final int[] $t.name.toUpperCase()_FIELD_SIZES = new int[]{
        #join($t.columns '${e.size}' ',
        ')};
    /** Field SQL types of the $t.name table. */
    public static final int[] $t.name.toUpperCase()_FIELD_SQL_TYPES = new int[]{
        #join($t.columns '${e.type}/*${e.javaTypeAsTypeName}*/' ',
        ')};
#end
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy