$link

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



Example :
   
   #foreach( $link in $entity.selectedLinks )
    private $link.formattedFieldType(10) $link.formattedFieldName(12);
   #end

Attributes and methods
.attributes : List of '$linkAttribute' (origin-target association)

Returns a list of attributes pair defining the link
Each pair contains the owning side attribute and its corresponding reverse side attribute
Each link is supposed to contain at least 1 pair of attributes

.attributesCount : int

Returns the number of attributes used to define the link

Example :
   $link.attributesCount

Since : 2.1.0

.cardinality : String

Returns the cardinality of the link
eg : 'OneToMany', 'ManyToOne', 'OneToOne', 'ManyToMany'

.cascade : String

Returns the 'cascade type' ( 'ALL', 'MERGE', 'MERGE PERSIST', 'PERSIST REFRESH', 'REMOVE' )
A string containing all the selected cascade options

.fetch : String

Returns the 'fetch type' ( 'DEFAULT' or 'EAGER' or 'LAZY' )

.fieldFullType : String

Returns the field 'full type' for the link ( eg 'java.util.List' )
for OneToMany/ManyToMany : the collection full type ( 'java.util.List', ...)
for ManyToOne/OneToOne : the targeted entity full type ( 'my.package.Person', 'my.package.Customer', ... )

.fieldName : String

Returns the field name for the link (attribute name in the entity class)

.fieldSimpleType : String

Returns the field 'simple type' for the link
for OneToMany/ManyToMany : the collection short type ( 'List', ...)
for ManyToOne/OneToOne : the targeted entity short type ( 'Person', 'Customer', ... )

.fieldType : String

Returns the type of the link
eg : List, List, Person, ...

.formattedFieldName(int n) : String

Returns the link's name with n trailing blanks

Parameters :
   n : the number of blanks to be added at the end of the name

.formattedFieldType(int n) : String

Returns the link's type with n trailing blanks
eg : List, List, Person, ...

Parameters :
   n : the number of blanks to be added at the end of the name

.getter : String

Returns the Java getter for the link e.g. 'getPerson' for link 'person'

.hasAttributeInPrimaryKey() : boolean

Returns TRUE if the link has one (or more) 'join column' in the entity Primary Key
( one of its 'origin attributes' is the Primary Key or a part of the Primary Key )

Since : 2.1.0

.hasJoinColumns() : boolean

Returns TRUE if the link has 'join columns' (at least one)

.hasJoinTable() : boolean

Returns TRUE if the link has a 'join table'

.id : String

Returns the unique id of the link in the repository (id used by the tool)
(not supposed to be used in a generated file)

.isCardinalityManyToMany() : boolean

Returns TRUE if the link has a 'ManyToMany' cardinality

.isCardinalityManyToOne() : boolean

Returns TRUE if the link has a 'ManyToOne' cardinality

.isCardinalityOneToMany() : boolean

Returns TRUE if the link has a 'OneToMany' cardinality

.isCardinalityOneToOne() : boolean

Returns TRUE if the link has a 'OneToOne' cardinality

.isCascadeALL() : boolean

Returns true if the 'cascade options' is 'ALL'

.isCascadeMERGE() : boolean

Returns true if the 'cascade options' contains 'MERGE'

.isCascadePERSIST() : boolean

Returns true if the 'cascade options' contains 'PERSIST'

.isCascadeREFRESH() : boolean

Returns true if the 'cascade options' contains 'REFRESH'

.isCascadeREMOVE() : boolean

Returns true if the 'cascade options' contains 'REMOVE'

.isFetchDEFAULT() : boolean

Returns true if the 'fetch type' is 'DEFAULT'

.isFetchEAGER() : boolean

Returns true if the 'fetch type' is 'EAGER'

.isFetchLAZY() : boolean

Returns true if the 'fetch type' is 'LAZY'

.isOptionalFalse() : boolean

Returns true if the 'optional status' is 'FALSE'

.isOptionalTrue() : boolean

Returns true if the 'optional status' is 'TRUE'

.isOptionalUndefined() : boolean

Returns true if the 'optional status' is 'UNDEFINED'

.isOwningSide() : boolean

Returns TRUE if the link is the 'Owning Side' of the relationship between 2 entities

.isSelected() : boolean

Returns TRUE if the link is selected (checkbox checked in the GUI)

.joinColumns : List

Returns the 'join columns' for the link

.joinTable : JoinTableInContext

Returns the 'join table' object for the link
NB : can be null if the link doesn't have a 'join table'

.joinTableName : String

Returns the name of the 'join table' for the link
NB : can be null if the link doesn't have a 'join table'

.mappedBy : String

Returns the name of the link in the 'owning side'
Typically for JPA 'mappedBy'

.optional : String

Returns the 'optional status' for the link ( 'TRUE', 'FALSE' or 'UNDEFINED' )
Typically for JPA 'optional=true/false'

.setter : String

Returns the Java setter for the link e.g. 'setPerson' for link 'person'

.targetEntity : EntityInContext

Returns the entity referenced by the link


Since : 2.1.0

.targetEntityFullType : String

Returns the type of the entity referenced by the link
eg : 'my.package.Book', 'my.package.Customer', ...

.targetEntitySimpleType : String

Returns the type of the entity referenced by the link
eg : 'Book', 'Customer', ...

.targetTableName : String

Returns the name of the target table (table referenced by the link)

.usesAttribute(AttributeInContext attribute) : boolean

Returns TRUE if the given attribute is used by the link

Parameters :
   attribute : the attribute to be checked