$values

Other name(s) : $keyValues$dataValues

( documentation for Telosys generator version 3.3.0 )


This object provides a set literal values
Each literal value is associated with an attribute's name and can be assigned to this attribute


Example :
   
   #set( $values = $fn.buildValues($entity.attributes, 1) )
   count = $values.size()
   #foreach( $attribute in $entity.attributes )
    Value for attribute "${attribute.name}" = $values.getValue($attribute.name)
   #end

Since : 3.0.0

Attributes and methods
.allValues : String

Returns a string containing all the literal values separated by a comma.
e.g. for Java : ' "AAAA", (short)10, true '

Usage example in Velocity template :
$values.allValues
or
$values.getAllValues()


Since : 3.0.0

.comparisonStatement(String entityVariableName, AttributeInContext attribute) : String

Returns a comparison statement between the attribute's current value and its associated literal value
Example of strings returned for Java language :
book.getId() == 100
book.getFirstName().equals("abcd")

Usage example in Velocity template :
$values.comparisonStatement("book", $attribute)


Parameters :
   entityVariableName : the variable name used before the 'getter'
   attribute : the attribute instance (used to retrieve the 'getter' and the 'literal value')

Since : 3.0.0

.getValue(String attributeName) : String

Returns a string containing the literal value for the given attribute's name
e.g. for Java : '"AAAA"' or '(short)10' or 'true' etc...

Usage example in Velocity template :
$values.getValue($attribute.name)


Parameters :
   attributeName : the name of the attribute

Since : 3.0.0

.size() : int

Returns the size of the values list (the number of values)

Since : 3.0.0

.toFormattedJSON() : String

Returns a JSON string containing all the attributes with their literal values.
The resulting JSON is formatted (one line for each attribute)


Example :
   $values.toFormattedJSON()

Since : 3.0.0

.toFormattedJSON(List attributes) : String

Returns a JSON string containing the given attributes with their literal values.
The resulting JSON is formatted (one line for each attribute)


Parameters :
   attributes : list of attributes to be put in the JSON string

Example :
   $values.toFormattedJSON( $entity.keyAttributes )

Since : 3.0.0

.toJSON() : String

Returns a JSON string containing all the attributes with their literal values.
e.g. : '{"id":1, "name":"AAAA"}


Example :
   $values.toJSON()

Since : 3.0.0

.toJSON(List attributes) : String

Returns a JSON string containing the given attributes with their literal values.
e.g. : '{"id":1, "name":"AAAA"}


Parameters :
   attributes : list of attributes to be put in the JSON string

Example :
   $values.toJSON( $entity.keyAttributes )

Since : 3.0.0

.toJSON(List attributes, String separator) : String

Returns a string containing the literal values in JSON format for the given list of attributes.

Parameters :
   attributes : list of attributes to be put in the JSON string
   separator : the separator to be put before each value

Example :
   $values.toJSON( $entity.nonKeyAttributes, "${NEWLINE}${TAB}" )

Since : 3.0.0

.toJSON(List attributes, String separator1, String separator2) : String

Returns a string containing the literal values in JSON format for the given list of attributes.

Parameters :
   attributes : list of attributes to be put in the JSON string
   separator1 : the separator to be put before each value
   separator2 : the separator to be put before the ending '}'

Example :
   $values.toJSON( $entity.nonKeyAttributes, "${NEWLINE}${TAB}", "${NEWLINE}" )

Since : 3.0.0

.toJSON(String separator) : String

Returns a string containing ALL the literal values in JSON format.

Parameters :
   separator : the separator to be put before each value

Example :
   $values.toJSON( "${NEWLINE}${TAB}" )

Since : 3.0.0

.toJSON(String separator1, String separator2) : String

Returns a string containing ALL the literal values in JSON format.

Parameters :
   separator1 : the separator to be put before each value
   separator2 : the separator to be put before the ending '}'

Example :
   $values.toJSON( "${NEWLINE}${TAB}", "${NEWLINE}" )

Since : 3.0.0

.toURI() : String

Returns a string containing all the values in URI format (with '/' separator)
e.g. : '/12/ABC


Example :
   $values.toURI()

Since : 3.0.0

.toURI(List attributes) : String

Returns a string containing the given attributes values in URI format (with '/' separator)
e.g. : '/12/ABC


Parameters :
   attributes : list of attributes to be put in the URI string

Example :
   $values.toURI( $entity.keyAttributes )

Since : 3.0.0