Skip to main content
Last updated August 09, 2011 00:19, by Kin-man Chung

Static Fields and Methods


The syntax "T(className)" where className is of the form id("." id)* denotes a Java class at parse time. This by itself is not evaluated and does not produce a value. When followed by .id, the construct T(className).id denotes and evaluates to a static field or method (of the name id) of a class. For instance,


evaluates to the static field java.lang.Boolean.TRUE.

As a special case, with the id "class", the construct T(className).class evaluates to the "java.lang.Class" instance of the class. For instance,


evaluates to the java.lang.Boolean.class instance.

The same syntax is used for Enum constants. For instance,


evaluates to the Enum constant org.acme.Color.RED.

Note New reserved word: T


A class can be imported before it is referenced. ELManager provides two methods importClass() and importPackage(). See the javadoc in ELManager for details.

An imported class can be referenced by its class name (without the package). For instance,


The package java.lang is imported by default.

Since class and package imports affects how expressions are evaluated, they should be included in ELContext. A new class ImportHandler is added to the API and ELContext adds a reference to it. See the javadocs for details.





Please Confirm