By using the T(fully.qualified.name).methodName()
syntax:
You can use the special
T
operator to specify an instance ofjava.lang.Class
(the type). Static methods are invoked by using this operator as well. TheStandardEvaluationContext
uses aTypeLocator
to find types, and theStandardTypeLocator
(which can be replaced) is built with an understanding of thejava.lang
package. This means thatT()
references to types withinjava.lang
do not need to be fully qualified, but all other type references must be.
The T
element returns a reference to the type instead of an instance. For example, the equivalent of Collections.singleton("Hello")
is
T(java.util.Collections).singleton('Hello')