Velocity language
The Velocity engine used in Telosys is version 1.7
For more information about the Velocity Templates Language (VTL) see the official web site :
References
A template is a text file mixing fixed parts and dynamic parts based on references to variables and objects. A reference to a variable or an object starts with "$".
Exemple :
$foo : content of variable "foo"
$customer.address : get property "address" in object "customer"
$person.isVIP() : call method "isVIP()" in object "person"
In some cases "Formal Reference Notation" with "${xxx}" is required to avoid ambiguities. Examples :
${foo}
${customer.address}
${person.isVIP()}
Examples :
Comments
A line starting with "##" is a comment. All lines between "#*" and "*#" are a comment block.
Literals
String literals
When using the #set directive, strings that are enclosed in double quote characters will be parsed. But if the string literal is enclosed in single quote characters, it will not be parsed. A string literal can contains multiple lines.
Unparsed content
The #[[ do not parse me ]]# syntax allows to easily use large chunks of uninterpreted and unparsed content in a template.
Operators
Comparison operators
Examples (showing different operators):
Operator | Symbol | Text | Example |
Equals / number | == | eq |
|
Equals / string | == | eq |
|
Equals / object | == | eq |
|
Not Equals | != | ne |
|
Greater Than | > | gt |
|
Less Than | < | lt |
|
Greater Than or Equal To | >= | ge |
|
Less Than or Equal To | <= | le |
|
Note: The == operator can be used to compare numbers, strings, objects of the same class, or objects of different classes. In the last case (when objects are of different classes), the toString() method is called on each object and the resulting Strings are compared.
Logical operators
Operator | Symbol | Text |
Logical AND | && | and |
Logical OR | || | or |
Logical NOT | ! | not |
Examples :
Arithmetic operators
Operator | Symbol | Example |
Addition | + |
|
Subtraction | - |
|
Multiplication | * |
|
Division | / |
|
Modulo | % |
|
Increment | (no operator) |
|
Decrement | (no operator) |
|
Note: when the "+" operator is used with 2 strings, it concatenates these 2 strings.
Range operator
The range operator creates an array of integer objects. It can be used in conjunction with #set and #foreach statements.
Syntax : [ first .. last ]
Examples :
Last updated