$java

( documentation for Telosys generator version 4.1.0 )


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


Since : 2.0.7

Attributes and methods
.equalsMethod(String className, List attributes) : 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)
   attributes : list of attributes to be used in the equals method

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

Since : 2.0.7

.equalsMethod(String className, List attributes, 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)
   attributes : list of attributes 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 attributes) : 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)
   attributes : list of attributes to be used in the equals method

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

Since : 2.0.7

.hashCodeMethod(String className, List attributes, 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)
   attributes : list of attributes 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 links
Examples for attributes : 'java.time.LocalDateTime', 'java.math.BigDecimal', etc
Examples for links : 'java.util.List', etc

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 attributes, int indentationLevel) : String

Returns a string containing all the code for a Java 'toString()' method
Generates a 'toString' method using the given attributes
(except non-printable attributes)
Indent with TABS (1 tab for each indentation level)

Parameters :
   entity : the entity for which to generate the 'toString' method
   attributes : list of attributes to be used in the 'toString' method
   indentationLevel : initial indentation level

Example :
   $csharp.toStringMethod( $entity, $attributes, 2 )

Since : 4.1.0

.toStringMethod(EntityInContext entity, List attributes, int indentationLevel, String indentationString) : String

Returns a string containing all the code for a Java 'toString()' method
Generates a 'toString' method using the given attributes
(except non-printable attributes)
Indentation with spaces (1 'indentationString' for each indentation level)

Parameters :
   entity : the entity for which to generate the 'toString' method
   attributes : list of attributes to be used in the 'toString' method
   indentationLevel : initial indentation level
   indentationString : string to use for each indentation (usually N spaces)

Example :
   $csharp.toStringMethod( $entity, $attributes, 2, ' ' )

Since : 4.1.0

.toStringMethod(EntityInContext entity, int indentationLevel) : 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
(except non-printable attributes)
Indentation with TABS (1 tab for each indentation level)

Parameters :
   entity : the entity for which to generate the 'toString' method
   indentationLevel : initial indentation level

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

Since : 4.1.0

.toStringMethod(EntityInContext entity, int indentationLevel, String indentationString) : 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
(except non-printable attributes)
Indentation with SPACES (1 'indentationString' for each indentation level)

Parameters :
   entity : the entity for which to generate the 'toString' method
   indentationLevel : initial indentation level
   indentationString : string to use for each indentation (usually N spaces)

Example :
   $csharp.toStringMethod( $entity, 2, ' ' )

Since : 4.1.0