org.richfaces.el.util

## Class ELUtils

- java.lang.Object
- - org.richfaces.el.util.ELUtils

-     public final class ELUtils
      extends Object

  Author:
    asmirnov

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> T` | `coerce(Object value, Class<T> targetType)` Coerce the given object to targetType.
    `static javax.el.ValueExpression` | `createValueExpression(javax.faces.context.FacesContext context, String expression, boolean literal, Class<?> expectedType)` Creates value expression from string and stores expression's expected type.
    `static javax.el.ValueExpression` | `createValueExpression(String expression)` Create a `ValueExpression` with the expected type of `Object.class`
    `static javax.el.ValueExpression` | `createValueExpression(String expression, Class<?> expectedType)` Creates value expression from string and stores expression's expected type
    `static Object` | `evaluateValueExpression(javax.el.ValueExpression expression, javax.el.ELContext elContext)`
    `static boolean` | `isValueReference(String value)` Get EL-enabled value.

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

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

- - ### Method Detail

    - #### isValueReference

          public static boolean isValueReference(String value)

      Get EL-enabled value. Return same string, if not el-expression. Otherthise, return parsed and evaluated expression.
      Parameters:
        `context` - - current Faces Context.
        `value` - - string to parse.
      Returns:
        - interpreted el or unmodified value.

    - #### createValueExpression

          public static javax.el.ValueExpression createValueExpression(String expression)

      Create a `ValueExpression` with the expected type of `Object.class`
      Parameters:
        `expression` - an EL expression
      Returns:
        a new `ValueExpression` instance based off the provided `valueRef`

    - #### createValueExpression

          public static javax.el.ValueExpression createValueExpression(String expression,
                                                       Class<?> expectedType)

      Creates value expression from string and stores expression's expected type
      Parameters:
        `expression` - string with EL expressions
        `expectedType` - the type expected from expression after evaluation
      Returns:
        value expression from string and stores expression's expected type

    - #### evaluateValueExpression

          public static Object evaluateValueExpression(javax.el.ValueExpression expression,
                                       javax.el.ELContext elContext)

    - #### createValueExpression

          public static javax.el.ValueExpression createValueExpression(javax.faces.context.FacesContext context,
                                                       String expression,
                                                       boolean literal,
                                                       Class<?> expectedType)

      Creates value expression from string and stores expression's expected type.

      If the literal is provided, constant value expression is used instead.

      Parameters:
        `context` - current `FacesContext`
        `expression` - string with EL expressions
        `literal` - determined if the literal value is required
        `expectedType` - the type expected from expression after evaluation
      Returns:
        value expression from string and stores expression's expected type

    - #### coerce

          public static <T> T coerce(Object value,
                     Class<T> targetType)

      Coerce the given object to targetType.
      Parameters:
        `value` - object to be coerced
        `targetType` - which should be object coerced into
      Returns:
        the given value coerced to targetType

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.