Types
You can use the special T
operator to specify an instance of java.lang.Class
(the
type). Static methods are invoked by using this operator as well. The
StandardEvaluationContext
uses a TypeLocator
to find types, and the
StandardTypeLocator
(which can be replaced) is built with an understanding of the
java.lang
package. This means that T()
references to types within the java.lang
package do not need to be fully qualified, but all other type references must be. The
following example shows how to use the T
operator:
-
Java
Class dateClass = parser.parseExpression("T(java.util.Date)").getValue(Class.class);
Class stringClass = parser.parseExpression("T(String)").getValue(Class.class);
boolean trueValue = parser.parseExpression(
"T(java.math.RoundingMode).CEILING < T(java.math.RoundingMode).FLOOR")
.getValue(Boolean.class);
If your application or framework manages its own For example, the |