$attribute

Other name(s) : $attrib$field

This object provides all information about an entity attribute
Each attribute is retrieved from the entity class



Example :
   
   #foreach( $attribute in $entity.attributes )
    $attribute.name : $attribute.type
   #end

Attributes and methods
.booleanFalseValue : String

Returns the value to use for a boolean when is FALSE (eg to be stored in a database)

.booleanTrueValue : String

Returns the value to use for a boolean when is TRUE (eg to be stored in a database)

.databaseComment : String

Returns the database comment for the attribute

Since : 2.1.1

.databaseDefaultValue : String

Returns the database default value for the attribute (or a void string if none)

.databaseName : String

Returns the database name for the attribute
Typically the column name for a relational database

.databaseSize : int

Returns the database size for the attribute

.databaseType : String

Returns the database native type for the attribute
For example : INTEGER, VARCHAR, etc...

.databaseTypeWithSize : String

Returns the database native type for the attribute with the size if it makes sens
For example : INTEGER, VARCHAR(24), NUMBER, CHAR(3), etc...

Since : 2.0.7

.dateAfterValue : String

Returns the 'date after' value (for date validation)

.dateBeforeValue : String

Returns the 'date before' value (for date validation)

.dateType : int

Returns the type of the date : $const.DATE_ONLY, $const.TIME_ONLY, $const.DATE_AND_TIME

.defaultValue : String

Returns the default value for the attribute

.entity : EntityInContext

Returns the entity owning the attribute

.formattedName(int n) : String

Returns the attribute's name with trailing blanks in order to obtain the expected size

Parameters :
   n : the expected size

.formattedType(int n) : String

Returns the attribute's type with trailing blanks in order to obtain the expected size

Parameters :
   n : the expected size

.formattedWrapperType(int n) : String

Returns the attribute's wrapper type with trailing blanks in order to obtain the expected size

Parameters :
   n : the expected size

.fullType : String

Returns the full type name
e.g. for a Java object type : java.math.BigDecimal, java.util.Date, ..
or for a Java primitive type : short, int, ..

.generatedValueGenerator : String

Returns the generator for a 'generated value'
Typically for JPA : 'SequenceGenerator' or 'TableGenerator'

.generatedValueStrategy : String

Returns the strategy for a 'generated value' (or null if none)
e.g : 'auto', 'identity', 'sequence', 'table'

.getter : String

Returns the getter for the attribute
e.g : 'getFoo' for 'foo' (or 'isFoo' for a boolean primitive type)

.getterWithGetPrefix : String

Returns the getter for the attribute with always a 'get' prefix
even for a boolean

.hasDatabaseDefaultValue() : boolean

Returns TRUE if the attribute has a database default value

.hasDateAfterValidation() : boolean

Returns TRUE if the attribute must be validated as a date after a given date value

.hasDateBeforeValidation() : boolean

Returns TRUE if the attribute must be validated as a date before a given date value

.hasDateFutureValidation() : boolean

Returns TRUE if the attribute must be validated as a date in the future

.hasDatePastValidation() : boolean

Returns TRUE if the attribute must be validated as a date in the past

.hasDefaultValue() : boolean

Returns TRUE if there's a default value for the attribute

.hasInitialValue() : boolean

Returns TRUE if there's an initial value for the attribute

.hasSequenceGenerator() : boolean

Returns TRUE if the attribute is a 'generated value' using a 'sequence generator'
Typically for JPA '@SequenceGenerator'

.hasTableGenerator() : boolean

Returns TRUE if the attribute is a 'generated value' using a 'table generator'
Typically for JPA '@TableGenerator'

.initialValue : String

Returns the initial value for the attribute

.inputType : String

Returns the 'input type' defined for the attribute
Typically for HTML 5 : 'number', 'date', ...

Since : 2.0.3

.isAutoIncremented() : boolean

Returns TRUE if the attribute is 'auto-incremented' by the database
when a new entity is inserted in the database

.isBinaryType() : boolean

Returns TRUE if the attribute's neutral type is 'binary'

Since : 3.0.0

.isBooleanType() : boolean

Returns TRUE if the attribute's neutral type is'boolean'

Since : 2.0.7

.isByteType() : boolean

Returns TRUE if the attribute's neutral type is 'byte'

Since : 2.0.7

.isDatabaseNotNull() : boolean

Returns TRUE if the attribute must be NOT NULL when stored in the database

.isDateType() : boolean

Returns TRUE if the attribute's neutral type is 'date'

Since : 3.0.0

.isDecimalType() : boolean

Returns TRUE if the attribute's neutral type is 'decimal'

Since : 3.0.0

.isDoubleType() : boolean

Returns TRUE if the attribute's neutral type is 'double'

Since : 2.0.7

.isFK() : boolean

Returns TRUE if the attribute is used in (at least) one Foreign Key
( it can be an 'Simple FK' or a 'Composite FK' or both )

Since : 3.0.0

.isFKComposite() : boolean

Returns TRUE if the attribute is a part of a 'Composite Foreign Key'
( the FK is based on many attributes including this attribute )

Since : 3.0.0

.isFKSimple() : boolean

Returns TRUE if the attribute is itself a 'Simple Foreign Key'
( the FK is based only on this single attribute )

Since : 3.0.0

.isFloatType() : boolean

Returns TRUE if the attribute's neutral type is 'float'

Since : 2.0.7

.isGeneratedValue() : boolean

Returns TRUE if the attribute's value is generated when a new entity is inserted in the database
It can be generated by the database ('auto-incremented')
or generated by the persistence layer (typically by JPA)

.isIntegerType() : boolean

Returns TRUE if the attribute's neutral type is 'int'

Since : 2.0.7

.isKeyElement() : boolean

Returns TRUE if the attribute is the Primary Key or a part of the Primary Key in the database

.isLongText() : boolean

Returns TRUE if the attribute is a 'Long Text'
i.e. that cannot be transported in a classical string
Typically a text stored as a CLOB or a BLOB

.isLongType() : boolean

Returns TRUE if the attribute's neutral type is 'long'

Since : 2.0.7

.isNotBlank() : boolean

Returns TRUE if the attribute has a 'Not Blank' validation rule

.isNotEmpty() : boolean

Returns TRUE if the attribute has a 'Not Empty' validation rule

.isNotNull() : boolean

Returns TRUE if the attribute has a 'Not Null' validation rule

.isNumberType() : boolean

Returns TRUE if the attribute's neutral type is a number type
( byte, short, int, long, decimal, float, double )

Since : 2.0.7

.isPrimitiveType() : boolean

Returns TRUE if the attribute's language type is a primitive type
i.e. for Java : int, float, boolean, ...

.isSelected() : boolean

Returns TRUE if the attribute is selected (ckeckbox ckecked in the GUI)

.isShortType() : boolean

Returns TRUE if the attribute's neutral type is 'short'

Since : 2.0.7

.isStringType() : boolean

Returns TRUE if the attribute's neutral type is 'string'

Since : 2.0.7

.isTemporalType() : boolean

Returns TRUE if the attribute's neutral type is a temporal type
( date, time, timestamp )

Since : 2.0.7

.isTimeType() : boolean

Returns TRUE if the attribute's neutral type is 'time'

Since : 3.0.0

.isTimestampType() : boolean

Returns TRUE if the attribute's neutral type is 'timestamp'

Since : 3.0.0

.isUsedInLinks() : boolean

.isUsedInSelectedLinks() : boolean

.jdbcRecommendedJavaType : String

Returns the recommended Java type for the JDBC type of the attribute

.jdbcTypeCode : int

Returns the JDBC type of the attribute (the type code)

.jdbcTypeName : String

Returns the JDBC type name ('CHAR', 'VARCHAR', 'NUMERIC', ... )

The 'java.sql.Types' constant name for the current JDBC type code

.label : String

Returns the label for the attribute

.maxLength : String

Returns the maximum length for the attribute (if any, else returns void)

.maxValue : String

Returns the maximum value for the attribute (if any, else returns void)

.minLength : String

Returns the minimum length for the attribute (if any, else returns void)

.minValue : String

Returns the minimum value for the attribute (if any, else returns void)

.name : String

Returns the name of the attribute

.neutralType : String

Returns the 'neutral type', that is to say the type as defined in the model
e.g. : 'string', 'short', 'decimal', 'boolean', 'date', 'time', etc

.pattern : String

Returns the Reg Exp pattern defined for the attribute (if any, else returns void)

.referencedEntity : EntityInContext

Returns the entity referenced by this attribute (if any)
Can be used only if the attribute 'isFK'
Throws an exception if no entity is refrerenced by the attribute

Since : 3.0.0

.referencedEntityName : String

Returns the name (class name) of the entity referenced by this attribute (if any)
Can be used only if the attribute 'isFK'
Throws an exception if no entity is refrerenced by the attribute

Since : 3.0.0

.sequenceGeneratorAllocationSize : int

Returns the 'sequence allocation size' to be used in the 'sequence generator' definition
Typically for JPA '@SequenceGenerator/allocationSize'

.sequenceGeneratorName : String

Returns the name of the 'sequence generator'
Typically for JPA '@SequenceGenerator/name'

.sequenceGeneratorSequenceName : String

Returns the 'sequence name' to be used in the 'sequence generator' definition
Typically for JPA '@SequenceGenerator/sequenceName'

.setter : String

Returns the setter for the attribute
e.g : 'setFoo' for 'foo'

.simpleType : String

Returns the simple type name
e.g. for a Java object type : BigDecimal, Date, Integer, ..
or for a Java primitive type : short, int, ..

.tableGeneratorName : String

Returns the name of the 'table generator'
Typically for JPA '@TableGenerator/name'

.tableGeneratorPkColumnName : String

Returns the name of the Primary Key column used in the 'table generator'
Typically for JPA '@TableGenerator/pkColumnName'

.tableGeneratorPkColumnValue : String

Returns the primary key value in the generator table that distinguishes this set of generated values
from others that may be stored in the table
Typically for JPA '@TableGenerator/pkColumnValue'

.tableGeneratorTable : String

Returns the name of the table used in the 'table generator'
Typically for JPA '@TableGenerator/table'

.tableGeneratorValueColumnName : String

Returns the name of the column that stores the last value generated by the 'table generator'
Typically for JPA '@TableGenerator/valueColumnName'

.type : String

Returns the recommended type for the attribute
usually the simple type ( 'int', 'BigDecimal', 'Date' )
sometimes the full type ( if the simple type is considered as ambiguous )
Examples for Java : 'int', 'BigDecimal', 'Date', 'java.util.Date', 'java.sql.Date'

.wrapperType : String

Returns the wrapper type corresponding to the attribute's primitive type
Examples : 'Float' for 'float', 'Integer' for 'int', 'Boolean' for 'boolean', ...
The attribute's type is retuned as is if it's not a primitive type