Package com.sun.ts.tests.el.common.util
Class ExprEval
java.lang.Object
com.sun.ts.tests.el.common.util.ExprEval
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
buildElExpr
(boolean deferred, String operation) static void
cleanup()
static boolean
compareClass
(Object obj, Class<?> expectedClass) static boolean
compareValue
(Boolean val, Boolean expectedVal) static boolean
compareValue
(Double val, Float expectedVal, int eps) static boolean
compareValue
(Float val, Float expectedVal, int eps) static boolean
compareValue
(Long val, Long expectedVal, int eps) static boolean
compareValue
(Object val, Object expectedVal) static boolean
compareValue
(BigDecimal val, BigDecimal expectedVal, int eps) static boolean
compareValue
(BigInteger val, BigInteger expectedVal, int eps) static Object
evaluateCoerceValueExpression
(String exprStr, Object exprVal, Class<?> expectedClass) static boolean
evaluateManyValueExpression
(String exprStr, Object exprVal, Class<?> expectedClass, Hashtable<Class<?>, Object> contextobj) Parse a ValueExpression once, evaluate it many times, while adding Context Objects to the ELContext one at a time.static Object
evaluateMethodExpression
(String exprStr, Class<?>[] params, Class<?> expectedClass, ResolverType resolverType) Used to evaluate MethodExpression()static Object
evaluateValueExpression
(String exprStr, NameValuePair[] nameVals, Class<?> expectedClass) 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.static Object
evaluateValueExpression
(String exprStr, NameValuePair[] nameVals, Class<?> expectedClass, ResolverType resolverType) Evaluates the ValueExpression expression relative to the provided context and resolverType, then returns the resulting value.
-
Method Details
-
buildElExpr
-
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 setexpectedClass
- - 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, ClassNotFoundExceptionParse 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
-
compareValue
-
compareValue
-
compareValue
-
compareValue
-
compareValue
-
compareValue
-
compareValue
-
cleanup
public static void cleanup()
-