Class ExprEval

java.lang.Object
com.sun.ts.tests.el.common.util.ExprEval

public final class ExprEval extends Object
  • Method Details

    • buildElExpr

      public static String buildElExpr(boolean deferred, String operation)
    • evaluateValueExpression

      public static Object evaluateValueExpression(String exprStr, NameValuePair[] nameVals, Class<?> expectedClass, ResolverType resolverType) throws jakarta.el.ELException, jakarta.el.PropertyNotFoundException, jakarta.el.PropertyNotWritableException
      Evaluates the ValueExpression expression relative to the provided context and resolverType, then returns the resulting value.
      Parameters:
      exprStr - - the String for the expression to be evaluated e.g. "${A + B}"
      nameVals - - an array of NameValuePair objects, each of which contains an expression variable and the value to which it is to be set.
      expectedClass - - the type of the result produced by evaluating the expression.
      resolverType - - The type of ELResolver to use for expression resolution.
      Returns:
      - The result of the expression evaluation.
      Throws:
      jakarta.el.ELException
      jakarta.el.PropertyNotFoundException
      jakarta.el.PropertyNotWritableException
    • evaluateValueExpression

      public static Object evaluateValueExpression(String exprStr, NameValuePair[] nameVals, Class<?> expectedClass) throws jakarta.el.ELException, jakarta.el.PropertyNotFoundException, jakarta.el.PropertyNotWritableException
      Evaluates the ValueExpression expression relative to the provided context and the resolverType of com.sun.ts.tests.el.common.elresolver.VariableELResolver, then returns the resulting value.
      Parameters:
      exprStr - - the String for the expression to be evaluated e.g. "${A + B}"
      nameVals - - an array of NameValuePair Objects, each of which contains an expression variable and the value to which it is to be set
      expectedClass - - the type of the result produced by evaluating the expression.
      Returns:
      - The result of the expression evaluation.
      Throws:
      jakarta.el.ELException
      jakarta.el.PropertyNotFoundException
      jakarta.el.PropertyNotWritableException
    • evaluateMethodExpression

      public static Object evaluateMethodExpression(String exprStr, Class<?>[] params, Class<?> expectedClass, ResolverType resolverType) throws jakarta.el.ELException, jakarta.el.PropertyNotFoundException, jakarta.el.PropertyNotWritableException
      Used to evaluate MethodExpression()
      Parameters:
      exprStr - - Expression to be parsed as a MethodExpression.
      params - - Parameters to pass to the method, or null if no parameters.
      expectedClass - - Expected return type.
      resolverType - - ELResolver to use for expression resolution.
      Returns:
      - the result of the method invocation.
      Throws:
      jakarta.el.ELException
      jakarta.el.PropertyNotFoundException
      jakarta.el.PropertyNotWritableException
    • evaluateCoerceValueExpression

      public static Object evaluateCoerceValueExpression(String exprStr, Object exprVal, Class<?> expectedClass) throws jakarta.el.ELException, jakarta.el.PropertyNotFoundException, jakarta.el.PropertyNotWritableException
      Parameters:
      exprStr - - Expression to be parsed.
      exprVal - - The value passed to ValueExpression.setValue().
      expectedClass - - Expected return type.
      Returns:
      - the result of the method invocation.
      Throws:
      jakarta.el.ELException
      jakarta.el.PropertyNotFoundException
      jakarta.el.PropertyNotWritableException
    • evaluateManyValueExpression

      public static boolean evaluateManyValueExpression(String exprStr, Object exprVal, Class<?> expectedClass, Hashtable<Class<?>,Object> contextobj) throws jakarta.el.ELException, jakarta.el.PropertyNotFoundException, jakarta.el.PropertyNotWritableException, ClassNotFoundException
      Parse a ValueExpression once, evaluate it many times, while adding Context Objects to the ELContext one at a time.
      Parameters:
      exprStr - - Expression to be parsed.
      exprVal - - The value passed to ValueExpression.setValue().
      expectedClass - - Expected return type.
      contextobj - - a Hashtable of context objects in the form of key=Class, value=value.
      Returns:
      - status of the evaluation.
      Throws:
      jakarta.el.ELException
      jakarta.el.PropertyNotFoundException
      jakarta.el.PropertyNotWritableException
      ClassNotFoundException
    • compareClass

      public static boolean compareClass(Object obj, Class<?> expectedClass)
    • compareValue

      public static boolean compareValue(Object val, Object expectedVal)
    • compareValue

      public static boolean compareValue(Boolean val, Boolean expectedVal)
    • compareValue

      public static boolean compareValue(Double val, Float expectedVal, int eps)
    • compareValue

      public static boolean compareValue(Float val, Float expectedVal, int eps)
    • compareValue

      public static boolean compareValue(Long val, Long expectedVal, int eps)
    • compareValue

      public static boolean compareValue(BigInteger val, BigInteger expectedVal, int eps)
    • compareValue

      public static boolean compareValue(BigDecimal val, BigDecimal expectedVal, int eps)
    • cleanup

      public static void cleanup()