Package org.zkoss.xel

Class Expressions

  • public class Expressions
    extends java.lang.Object
    Utilities to use XEL.
    • Field Detail


        public static final FunctionMapper EMPTY_MAPPER
        An empty function mapper, i.e., it has no function defined at all. It is serializable.

        public static final VariableResolver EMPTY_RESOLVER
        An empty variable resolver, i.e., it has no variable defined at all. It is serializable.

        public static final Expression DUMMY_EXPRESSION
        An dummy expression that does nothing. It is usually used as a flag to denote exceptional cases. It it serializable.
    • Constructor Detail

      • Expressions

        public Expressions()
    • Method Detail

      • evaluate

        public static final java.lang.Object evaluate​(XelContext ctx,
                                                      java.lang.String expression,
                                                      java.lang.Class<?> expectedType)
                                               throws XelException
        Evaluates an expression.
        ctx - the context information to evaluate the expression It can be null, in which case no functions are supported for this invocation.
        expression - the expression to be evaluated. Note: the expression is enclosed with ${ and }, regardless of what implementation is used.
        expectedType - the expected type of the result of the evaluation
      • setExpressionFactoryClass

        public static final void setExpressionFactoryClass​(java.lang.Class<? extends ExpressionFactory> expfcls)
        Sets the implementation of the expression factory that shall be used by the whole system, or null to use the system default.

        Default: null - it means ELFactory, which supports EL 2.0. If you run under JVM 1.5 or later and deploy zel.jar in your class path, the default class is then ELFactory which supports EL 2.2.

        Note: you can only specify an implementation that is compatible with JSP EL here, since all built-in pages depend on it.

        expfcls - the implementation class, or null to use the default. Note: expfcls must implement ExpressionFactory. If null, the system default is used.