emptyEvaluates whether an expression if ‚empty‘. This is true when the argument is:
An instance of class C and the derived JexlArithmetic overloads a method ‚public boolean empty(C arg)‘ that returns true when the argument is considered empty
An empty string
An array of length zero
A collection of size zero
An empty map
Defining a method ‚public boolean isEmpty()‘ that returns true when the instance is considered empty
This is false in other cases (besides errors). empty(arg)
sizeEvaluates the ’size‘ of an expression. This returns:
0 if the argument is null
The result of calling a method from a derived JexlArithmetic overload ‚public int size(C arg)‘, C being the class of the argument
Length of an array
Length of a string
Size of a Collection
Size of a Map
The result of calling a method ‚public int size()‘ defined by the argument class
This returns 0 in other cases (besides errors). size(„Hello“) returns 5.
newCreates a new instance using a fully-qualified class name or Class: new(„java.lang.Double“, 10) returns 10.0.
Note that the first argument of new can be a variable or any expression evaluating as a String or Class; the rest of the arguments are used as arguments to the constructor for the class considered.
In case of multiple constructors, JEXL will make the best effort to find the most appropriate non ambiguous constructor to call.
Alternatively, using #pragma jexl.import java.langcode>, one can use the following syntax: new Double(10).
Top level functionTop level function is a function which can be invoked without specifying a namespace.
Top level function can be defined by the function definition method inside the script
A JexlContext can define methods which can be invoked as top level functions. This can allow expressions like: string(23.0)
Another way to define top level function is to register to JexlEngine objects or classes with null namespace.
Nach oben