ExpressionFactory (Apache Tomcat 7.0.104 API Documentation)

javax.el

## Class ExpressionFactory

- java.lang.Object
- - javax.el.ExpressionFactory

- Direct Known Subclasses:
    ExpressionFactoryImpl

      public abstract class ExpressionFactory
      extends Object

  Since:
    2.1

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExpressionFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Object` | `coerceToType(Object obj, Class<?> expectedType)` Coerce the supplied object to the requested type.
    `abstract MethodExpression` | `createMethodExpression(ELContext context, String expression, Class<?> expectedReturnType, Class<?>[] expectedParamTypes)` Create a new method expression instance.
    `abstract ValueExpression` | `createValueExpression(ELContext context, String expression, Class<?> expectedType)` Create a new value expression.
    `abstract ValueExpression` | `createValueExpression(Object instance, Class<?> expectedType)`
    `static ExpressionFactory` | `newInstance()` Create a new `ExpressionFactory`.
    `static ExpressionFactory` | `newInstance(Properties properties)` Create a new `ExpressionFactory` passing in the provided `Properties`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ExpressionFactory

          public ExpressionFactory()

  - ### Method Detail

    - #### newInstance

          public static ExpressionFactory newInstance()

      Create a new `ExpressionFactory`. The class to use is determined by the following search order:
      1. services API (META-INF/services/javax.el.ExpressionFactory)
      2. $JRE_HOME/lib/el.properties - key javax.el.ExpressionFactory
      3. javax.el.ExpressionFactory
      4. Platform default implementation - org.apache.el.ExpressionFactoryImpl
      Returns:
        the new ExpressionFactory

    - #### newInstance

          public static ExpressionFactory newInstance(Properties properties)

      Create a new `ExpressionFactory` passing in the provided `Properties`. Search order is the same as `newInstance()`.
      Parameters:
        `properties` - the properties to be passed to the new instance (may be null)
      Returns:
        the new ExpressionFactory

    - #### createValueExpression

          public abstract ValueExpression createValueExpression(ELContext context,
                                              String expression,
                                              Class<?> expectedType)

      Create a new value expression.
      Parameters:
        `context` - The EL context for this evaluation
        `expression` - The String representation of the value expression
        `expectedType` - The expected type of the result of evaluating the expression
      Returns:
        A new value expression formed from the input parameters
      Throws:
        `NullPointerException` - If the expected type is `null`
        `ELException` - If there are syntax errors in the provided expression

    - #### createValueExpression

          public abstract ValueExpression createValueExpression(Object instance,
                                              Class<?> expectedType)

    - #### createMethodExpression

          public abstract MethodExpression createMethodExpression(ELContext context,
                                                String expression,
                                                Class<?> expectedReturnType,
                                                Class<?>[] expectedParamTypes)

      Create a new method expression instance.
      Parameters:
        `context` - The EL context for this evaluation
        `expression` - The String representation of the method expression
        `expectedReturnType` - The expected type of the result of invoking the method
        `expectedParamTypes` - The expected types of the input parameters
      Returns:
        A new method expression formed from the input parameters.
      Throws:
        `NullPointerException` - If the expected parameters types are `null`
        `ELException` - If there are syntax errors in the provided expression

    - #### coerceToType

          public abstract Object coerceToType(Object obj,
                            Class<?> expectedType)

      Coerce the supplied object to the requested type.
      Parameters:
        `obj` - The object to be coerced
        `expectedType` - The type to which the object should be coerced
      Returns:
        An instance of the requested type.
      Throws:
        `ELException` - If the conversion fails

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.