$java

( documentation for Telosys generator version 3.3.0 )


Object providing a set of utility functions for JAVA language code generation


Since : 2.0.7

Attributes and methods
.equalsMethod(String className, List fieldsList) : String

Returns a string containing all the code for a Java 'equals' method
Tabulations are used for code indentation

Parameters :
   className : the Java class name (simple name or full name)
   fieldsList : list of fields to be used in the equals method

Example :
   $java.equalsMethod( $entity.name, $entity.attributes )

Since : 2.0.7

.equalsMethod(String className, List fieldsList, int indentSpaces) : String

Returns a string containing all the code for a Java 'equals' method
Spaces are used for code indentation

Parameters :
   className : the Java class name (simple name or full name)
   fieldsList : list of fields to be used in the equals method
   indentSpaces : number of spaces to be used for each indentation level

Example :
   $java.equalsMethod( $entity.name, $entity.attributes, 4 )

Since : 2.0.7

.hashCodeMethod(String className, List fieldsList) : String

Returns a string containing all the code for a Java 'hashCode' method
Tabulations are used for code indentation

Parameters :
   className : the Java class name (simple name or full name)
   fieldsList : list of fields to be used in the equals method

Example :
   $java.hashCode( $entity.name, $entity.attributes )

Since : 2.0.7

.hashCodeMethod(String className, List fieldsList, int indentSpaces) : String

Returns a string containing all the code for a Java 'hashCode' method
Spaces are used for code indentation

Parameters :
   className : the Java class name (simple name or full name)
   fieldsList : list of fields to be used in the equals method
   indentSpaces : number of spaces to be used for each indentation level

Example :
   $java.hashCode( $entity.name, $entity.attributes, 4 )

Since : 2.0.7

.imports(EntityInContext entity) : List

Returns the list of Java classes to be imported for the given entity
The imports are determined using all the entity attributes
and all the 'OneToMany' any 'ManyToMany' links found in the entity

Parameters :
   entity : entity to be used

Example :
   #foreach( $import in $java.imports($entity) )
   import $import;
   #end)

Since : 2.0.7

.imports(List attributes) : List

Returns the list of Java classes to be imported for the given attributes


Parameters :
   attributes : list of attributes

Example :
   #foreach( $import in $java.imports($entity.attributes) )
   import $import;
   #end)

Since : 2.0.7

.toStringMethod(EntityInContext entity, List nonKeyAttributes, String embeddedIdName) : String

Returns a string containing all the code for a Java 'toString' method
Generates a 'toString' method with the primary key attribute or the embedded key
and the given list of 'non key' attributes if their type is usable in a 'toString' method
(excluded types are 'array', 'Clob', 'Blob', and 'Long Text String')

Parameters :
   entity : the entity to be used
   nonKeyAttributes : list of attributes that are not in the Primary Key
   embeddedIdName : variable name for the embedded id (used only if the entity has a composite primary key)

Example :
   $java.toStringMethod( $entity, $nonKeyAttributes, $embeddedIdName, 4 )

Since : 2.0.7

.toStringMethod(EntityInContext entity, List nonKeyAttributes, String embeddedIdName, int indentSpaces) : String

Returns a string containing all the code for a Java 'toString' method
Generates a 'toString' method with the primary key attribute or the embedded key
and the given list of 'non key' attributes if their type is usable in a 'toString' method
(excluded types are 'array', 'Clob', 'Blob', and 'Long Text String')

Parameters :
   entity : the entity to be used
   nonKeyAttributes : list of attributes that are not in the Primary Key
   embeddedIdName : variable name for the embedded id (used only if the entity has a composite primary key)
   indentSpaces : number of spaces to be used for each indentation level

Example :
   $java.toStringMethod( $entity, $nonKeyAttributes, $embeddedIdName, 4 )

Since : 2.0.7

.toStringMethod(EntityInContext entity, int indentSpaces) : String

Returns a string containing all the code for a Java 'toString' method
Generates a 'toString' method using all the attributes of the given entity
(excluded types are 'array', 'Clob', 'Blob', and 'Long Text String')

Parameters :
   entity : the entity providing the attributes to be used in the 'toString' method
   indentSpaces : number of spaces to be used for each indentation level

Example :
   $java.toStringMethod( $entity, 4 )

Since : 2.1.0

.toStringMethod(List attributes, int indentSpaces) : String

Returns a string containing all the code for a Java 'toString' method
Generates a 'toString' method using all the given attributes
(excluded types are 'array', 'Clob', 'Blob', and 'Long Text String')

Parameters :
   attributes : list of attributes to be used in the 'toString' method
   indentSpaces : number of spaces to be used for each indentation level

Example :
   $java.toStringMethod( $attributes, 4 )

Since : 2.1.0