$values

Other name(s) : $keyValues$dataValues

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


Since : 3.0.0

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

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

.toJSON() : String

Returns a string containing ALL the literal values in JSON format.
NB : this method is usable only with 'JAVASCRIPT values'.
e.g. : '{"id":1, "name":"AAAA"}

Usage examples in Velocity template :
$values.toJSON()
$values.toJSON("${NEWLINE}")
$values.toJSON("${NEWLINE}${TAB}", "${NEWLINE}")


Since : 3.0.0

.toJSON(List attributes) : String

Returns a string containing the literal values in JSON format for the given list of attributes.
NB : this method is usable only with 'JAVASCRIPT values'.
e.g. : '{"id":1, "name":"AAAA"}

Usage example in Velocity template :
$values.toJSON($entity.attributes)
$values.toJSON($entity.attributes, "${NEWLINE}")
$values.toJSON($entity.attributes, "${NEWLINE}${TAB}", "${NEWLINE}")


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

Since : 3.0.0

.toJSON(List ?, String ?) : String


Parameters :
   ? :
   ? :

.toJSON(List ?, String ?, String ?) : String


Parameters :
   ? :
   ? :
   ? :

.toJSON(String ?) : String


Parameters :
   ? :

.toJSON(String ?, String ?) : String


Parameters :
   ? :
   ? :