You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This chapter is a complete reference to SpEL built-in functions—the ready-to-use helpers that are always at your fingertips while writing tSM expressions.
You will find two kinds of helpers here:
Type extensions – methods that extend everyday data types such as strings, numbers, dates, lists, sets and maps. They read naturally:
Standalone functions – utilities that are not tied to any specific value and are invoked with the # prefix:
#now() // current date-time
#randomUUID() // e.g. "8e29…"
#if(#total > 100).then('Large')...
All functions described in this chapter are available anywhere SpEL is evaluated—inside console experiments, mapping scripts, conditions, service calls, process gateways, and more. Use the tables below to scan each group quickly: signature in the first column, behavior in the second, plus compact examples at the end of every section.
Iterates over each element, evaluating the expressions in the context of that element. The first argument must be a variable reference (e.g. #item). A special variable #index holds the position. The last expression’s value for each element is collected into the resulting list.
filter
(predicateExpr): List<T>
Keeps elements for which predicateExpr evaluates to true. Inside the predicate you can use it and index.
size / get / indexOf / first / last
see signature
Standard collection helpers.
distinct / distinctCount
(): List<T> / (): Map<T,Int>
Removes duplicates (distinct) or counts occurrences (distinctCount).
sorted / reversed / min / max
(): …
Returns a sorted copy, a reversed copy, or the minimum/maximum element using natural ordering.
take / drop / subList
…
Slice helpers: first n, skip n, or view [from,to) of the list. subList is backed by the original list.
zipWith
(other :List): Map<T,T2>
Combines two lists into a map where keys are elements of this list and values are elements at the same index of other. Stops at the shorter length.
minus
(other :Collection): List<T>
Returns a list containing all elements of this list except those also in other.
sum
(): Long
Returns a list containing all elements of this list except those also in other.
Returns the first or last moment of the month or year containing the date.
5 Number
Method
Signature
Description
toString
(): String
Converts the number to its string representation.
toDate
(): Date
Interprets the number as a Unix timestamp. Values greater than 2 147 483 647 are treated as milliseconds; smaller values are treated as seconds.
6 Byte Array
Method
Signature
Description
encodeBase64
(): String
Encodes the byte array as Base‑64 text.
8 Hash‑prefixed standalone helpers
Method
Signature
Description
#do
#do(expr1, expr2, …): Any
Evaluates several expressions in order and returns the last result. All evaluated values share the same local context.
#with
#with(expr1, …).do(finalExpr)
Lets you define variables (and other expressions) in #with, then evaluate a final expression inside .do. The variables declared in #with are visible only inside the .do block.
#if / .then / .elseif / .else
–
Fluent multi‑branch conditional. Each .then() block is evaluated only if the preceding condition is met.
#case
#case().when(condition, expr).else(expr)
Checks each condition in order; the first one that evaluates to a "truthy" value triggers its expression.
#match
#match(value).when(matchVal, expr).else(expr)
Similar to a switch statement: compares value to each matchVal for equality.
#try / .catch
–
Evaluates expressions and, if any throw an exception, executes the .catch block. The caught exception instance is available inside .catch as #error.
#currentUser
(): UUID
Returns the UUID of the user on whose behalf the script runs.
#now
(): Date
Current date/time (UTC).
#randomTrueFalse
(): Boolean
Returns true or false with equal probability.
#randomUUID
(): UUID
Generates a random UUID.
#uuid
(text :String): UUID
Converts a canonical UUID string into a UUID object.
#businessException
(code :String, msg :String): Nothing
Throws a business‑level exception with the given code and message.
#isNotEmpty
(value): Boolean
Returns true if value is neither null, an empty string, nor the string "null".
#isNullOrEmpty
(value): Boolean
Returns true when value is null, an empty string, or the string "null".
#jsonToString
(obj): String
Serialises an object into its JSON text representation.
#objectToMap
(obj): Map
Converts an arbitrary object (including complex JSON trees) into nested Map / List collections for easier SpEL manipulation.