This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Framework 6.1.12! |
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
-
Kotlin
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);
val dateClass = parser.parseExpression("T(java.util.Date)").getValue(Class::class.java)
val stringClass = parser.parseExpression("T(String)").getValue(Class::class.java)
val trueValue = parser.parseExpression(
"T(java.math.RoundingMode).CEILING < T(java.math.RoundingMode).FLOOR")
.getValue(Boolean::class.java)
If your application or framework manages its own For example, the |