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 StringbuildElExpr(boolean deferred, String operation) static voidcleanup()static booleancompareClass(Object obj, Class<?> expectedClass) static booleancompareValue(Boolean val, Boolean expectedVal) static booleancompareValue(Double val, Float expectedVal, int eps) static booleancompareValue(Float val, Float expectedVal, int eps) static booleancompareValue(Long val, Long expectedVal, int eps) static booleancompareValue(Object val, Object expectedVal) static booleancompareValue(BigDecimal val, BigDecimal expectedVal, int eps) static booleancompareValue(BigInteger val, BigInteger expectedVal, int eps) static ObjectevaluateCoerceValueExpression(String exprStr, Object exprVal, Class<?> expectedClass) static booleanevaluateManyValueExpression(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 ObjectevaluateMethodExpression(String exprStr, Class<?>[] params, Class<?> expectedClass, ResolverType resolverType) Used to evaluate MethodExpression()static ObjectevaluateValueExpression(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 ObjectevaluateValueExpression(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.ELExceptionjakarta.el.PropertyNotFoundExceptionjakarta.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.ELExceptionjakarta.el.PropertyNotFoundExceptionjakarta.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.ELExceptionjakarta.el.PropertyNotFoundExceptionjakarta.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.ELExceptionjakarta.el.PropertyNotFoundExceptionjakarta.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.ELExceptionjakarta.el.PropertyNotFoundExceptionjakarta.el.PropertyNotWritableExceptionClassNotFoundException
-
compareClass
-
compareValue
-
compareValue
-
compareValue
-
compareValue
-
compareValue
-
compareValue
-
compareValue
-
cleanup
public static void cleanup()
-