Commons Resources (Unofficial)
|
Item | Description |
Comments |
Specified using ## and extend to the end of line, e.g.
|
Identifiers / variables |
Must start with a-z , A-Z , _ or $ .
Can then be followed by 0-9 , a-z , A-Z , _ or $ .
e.g.
- Valid:
var1 ,_a99 ,$1
- Invalid:
9v ,!a99 ,1$
|
Scripts |
A script in Jexl is made up of zero or more statements.
|
Statements |
A statement can be the empty statement, the semicolon (; ) , block, assignment or an expression.
Statements are optionally terminated with a semicolon.
|
Block |
A block is simply multiple statements inside curly braces ({, } ).
|
Item | Description |
Integer Literals | 1 or more digits from 0 to 9 |
Floating point Literals |
1 or more digits from 0 to 9 , followed
by a decimal point and then one or more digits from
0 to 9 .
|
String literals |
Can start and end with either ' or " , e.g.
and
are equivalent.
|
Boolean literals |
The literals true and false can be used, e.g.
|
Null literal |
The null value is represented as in java using the literal null , e.g.
|
Function | Description |
empty |
Returns true if the expression following is either:
null
- An empty string
- An array of length zero
- A collection of size zero
- An empty map
|
size |
Returns the information about the expression:
- Length of an array
- Size of a List
- Size of a Map
- Size of a Set
- Length of a string
returns 5.
|
Operator | Description |
Boolean and |
The usual && operator can be used as well as the word and , e.g.
and
are equivalent
|
Boolean or |
The usual || operator can be used as well as the word or , e.g.
and
are equivalent
|
Boolean not |
The usual ! operator can be used as well as the word not , e.g.
and
are equivalent
|
Equality |
The usual == operator can be used as well as the abbreviation eq .
For example
and
are equivalent.
-
null is only ever equal to null, that is if you compare null
to any non-null value, the result is false.
- Equality uses the java
equals method
|
Inequality |
The usual != operator can be used as well as the abbreviation ne .
For example
and
are equivalent.
|
Less Than |
The usual < operator can be used as well as the abbreviation lt .
For example
and
are equivalent.
|
Less Than Or Equal To |
The usual <= operator can be used as well as the abbreviation le .
For example
and
are equivalent.
|
Greater Than |
The usual > operator can be used as well as the abbreviation gt .
For example
and
are equivalent.
|
Greater Than Or Equal To |
The usual >= operator can be used as well as the abbreviation ge .
For example
and
are equivalent.
|
Addition |
The usual + operator is used.
For example
|
Subtraction |
The usual - operator is used.
For example
|
Multiplication |
The usual * operator is used.
For example
|
Division |
The usual / operator is used.
For example
|
Integer Division |
The div operator is used.
For example
gives 1.
|
Modulus (or remainder) |
The % operator is used. An alternative is the mod
operator.
For example
gives 1 and is equivalent to
|
Negation |
The unary - operator is used.
For example
|
Array access |
Array elements may be accessed using either square brackets or a dotted numeral, e.g.
and
are equivalent
|
|