Data Types
Each argument to a function and each value returned from a function has a specific data type. The Expression Language supports four different data types:
String: A String is a sequence of characters that can consist of numbers, letters, white space, and special characters.
Number: A Number is an whole number comprised of one or more digits (
0
through9
). When converting to numbers from Date data types, they are represented as the number of milliseconds since midnight GMT on January 1, 1970.Decimal: A Decimal is a numeric value that can support decimals and larger values with minimal loss of precision. More precisely it is a double-precision 64-bit IEEE 754 floating point. Due to this minimal loss of precision this data type should not be used for very precise values, such as currency. For more documentation on the range of values stored in this data type refer to this link. The following are some examples of the forms of literal decimals that are supported in expression language (the "E" can also be lower-case):
1.1
.1E1
1.11E-12
Date: A Date is an object that holds a Date and Time. Utilizing the Date Manipulation and Type Coercion functions this data type can be converted to/from Strings and numbers. If the whole Expression Language expression is evaluated to be a date then it will be converted to a String with the format: "<Day of Week> <Month> <Day of Month> <Hour>:<Minute>:<Second> <Time Zone> <Year>". Also expressed as "E MMM dd HH:mm:ss z yyyy" in Java SimpleDateFormat format. For example: "Wed Dec 31 12:00:04 UTC 2016".
Boolean: A Boolean is one of either
true
orfalse
.
After evaluating expression language functions, all attributes are stored as type String.
The Expression Language is generally able to automatically coerce a value of one data type to the appropriate data type for a function. However, functions do exist to manually coerce a value into a specific data type. See the Type Coercion section for more information.
Hex values are supported for Number and Decimal types but they must be quoted and prepended with "0x" when being interpreted as literals. For example these two expressions are valid (without the quotes or "0x" the expression would fail to run properly):
${literal("0xF"):toNumber()}
${literal("0xF.Fp10"):toDecimal()}