|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.seam.solder.el.Expressions
public class Expressions
Provides various utility methods for working with EL expressions.
This utility can be used through injection:
@Inject Expressions expressions;
Alternatively, if you aren't working in a CDI environment, it can be
instantiated using the new keyword:
Expressions expressions = new Expressions(context, expressionFactory);
| Constructor Summary | |
|---|---|
Expressions(ELContext context,
ExpressionFactory expressionFactory)
Create a new instance of the Expressions class, providing the
ELContext and ExpressionFactory to be used. |
|
| Method Summary | ||
|---|---|---|
|
evaluateMethodExpression(String expression)
Evaluate a MethodExpression with no parameters, inferring the
return type. |
|
|
evaluateMethodExpression(String expression,
Class<T> expectedReturnType)
Evaluate a MethodExpression with no parameters. |
|
|
evaluateMethodExpression(String expression,
Class<T> expectedReturnType,
Object[] params,
Class<?>[] expectedParamTypes)
Evaluate a MethodExpression, passing arguments and argument types
to the method. |
|
|
evaluateMethodExpression(String expression,
Object... params)
Evaluate a MethodExpression, passing arguments to the method. |
|
|
evaluateValueExpression(String expression)
Evaluate a ValueExpression inferring the return type. |
|
|
evaluateValueExpression(String expression,
Class<T> expectedType)
Evaluate a ValueExpression. |
|
ELContext |
getELContext()
Obtain the ELContext that this instance of Expressions is
using. |
|
ExpressionFactory |
getExpressionFactory()
Obtain the ExpressionFactory that this instance of
Expressions is using. |
|
String |
toExpression(String name)
Convert's a bean name to an EL expression string. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@Inject
public Expressions(ELContext context,
ExpressionFactory expressionFactory)
Expressions class, providing the
ELContext and ExpressionFactory to be used.
context - the ELContext against which to operateexpressionFactory - the ExpressionFactory to use
IllegalArgumentException - if context is null or
expressionFactory is null| Method Detail |
|---|
public ELContext getELContext()
ELContext that this instance of Expressions is
using.
ELContext in usepublic ExpressionFactory getExpressionFactory()
ExpressionFactory that this instance of
Expressions is using.
ExpressionFactory in use
public <T> T evaluateValueExpression(String expression,
Class<T> expectedType)
Evaluate a ValueExpression.
A ValueExpression is created by calling
ExpressionFactory.createValueExpression(ELContext, String, Class)
and then ValueExpression.getValue(ELContext) is called to obtain
the value. For more details on the semantics of EL, refer to the javadoc
for these classes and methods.
T - the type of the evaluated expressionexpression - the expression to evaluateexpectedType - the expected type of the evaluated expression
NullPointerException - if expectedType is null
ELException - if there are syntactical errors in the provided
expression or if an exception was thrown while performing
property or variable resolution. The thrown exception will be
included as the cause property of this exception, if available.
PropertyNotFoundException - if one of the property resolutions
failed because a specified variable or property does not exist
or is not readable.
ClassCastException - if the result cannot be cast to the expected
typeExpressionFactory.createValueExpression(ELContext, String, Class),
ValueExpression.getValue(ELContext)public <T> T evaluateValueExpression(String expression)
Evaluate a ValueExpression inferring the return type.
A ValueExpression is created by calling
ExpressionFactory.createValueExpression(ELContext, String, Class)
and then ValueExpression.getValue(ELContext) is called to obtain
the value. For more details on the semantics of EL, refer to the javadoc
for these methods.
T - the type of the evaluated expressionexpression - expression the expression to evaluate
ELException - if there are syntactical errors in the provided
expression
ELException - if an exception was thrown while performing property
or variable resolution. The thrown exception will be included
as the cause property of this exception, if available.
PropertyNotFoundException - if one of the property resolutions
failed because a specified variable or property does not exist
or is not readable
ClassCastException - if the result cannot be cast to TExpressionFactory.createValueExpression(ELContext, String, Class),
ValueExpression.getValue(ELContext)
public <T> T evaluateMethodExpression(String expression,
Class<T> expectedReturnType,
Object[] params,
Class<?>[] expectedParamTypes)
Evaluate a MethodExpression, passing arguments and argument types
to the method.
A MethodExpression is created by calling
ExpressionFactory.createMethodExpression(ELContext, String, Class, Class[])
and then MethodExpression.invoke(ELContext, Object[]) is called to
obtain the value. For more details on the semantics of EL, refer to the
javadoc for these methods.
T - the type of the evaluated expressionexpression - expression the expression to evaluateexpectedReturnType - the expected return type of the evaluated
expressionparams - arguments to the methodexpectedParamTypes - of the arguments to the method
ClassCastException - if the result cannot be cast to
expectedReturnType
ELException - if there are syntactical errors in the provided
expression.
NullPointerException - if expectedParamTypes is
null.
PropertyNotFoundException - if one of the property resolutions
failed because a specified variable or property does not exist
or is not readable.
MethodNotFoundException - if no suitable method can be found.
ELException - if a String literal is specified and
expectedReturnType of the MethodExpression is void or if the
coercion of the String literal to the expectedReturnType yields
an error (see Section "1.18 Type Conversion").
ELException - if an exception was thrown while performing property
or variable resolution. The thrown exception must be included
as the cause property of this exception, if available. If the
exception thrown is an InvocationTargetException,
extract its cause and pass it to the
ELException constructor.MethodExpression.invoke(ELContext, Object[]),
ExpressionFactory.createMethodExpression(ELContext, String, Class,
Class[])
public <T> T evaluateMethodExpression(String expression,
Class<T> expectedReturnType)
Evaluate a MethodExpression with no parameters.
A MethodExpression is created by calling
ExpressionFactory.createMethodExpression(ELContext, String, Class, Class[])
and then MethodExpression.invoke(ELContext, Object[]) is called to
obtain the value. For more details on the semantics of EL, refer to the
javadoc for these methods.
T - the type of the evaluated expressionexpression - expression the expression to evaluateexpectedReturnType - the expected return type of the evaluated
expression
ClassCastException - if the result cannot be cast to
expectedReturnType
ELException - if there are syntactical errors in the provided
expression.
NullPointerException - if expectedParamTypes is
null.
PropertyNotFoundException - if one of the property resolutions
failed because a specified variable or property does not exist
or is not readable.
MethodNotFoundException - if no suitable method can be found.
ELException - if a String literal is specified and
expectedReturnType of the MethodExpression is void or if the
coercion of the String literal to the expectedReturnType yields
an error (see Section "1.18 Type Conversion").
ELException - if an exception was thrown while performing property
or variable resolution. The thrown exception must be included
as the cause property of this exception, if available. If the
exception thrown is an InvocationTargetException,
extract its cause and pass it to the
ELException constructor.MethodExpression.invoke(ELContext, Object[]),
ExpressionFactory.createMethodExpression(ELContext, String, Class,
Class[])public <T> T evaluateMethodExpression(String expression)
Evaluate a MethodExpression with no parameters, inferring the
return type.
A MethodExpression is created by calling
ExpressionFactory.createMethodExpression(ELContext, String, Class, Class[])
and then MethodExpression.invoke(ELContext, Object[]) is called to
obtain the value. For more details on the semantics of EL, refer to the
javadoc for these methods.
T - the type of the evaluated expressionexpression - expression the expression to evaluate
ClassCastException - if the result cannot be cast to T
ELException - if there are syntactical errors in the provided
expression.
NullPointerException - if expectedParamTypes is
null.
PropertyNotFoundException - if one of the property resolutions
failed because a specified variable or property does not exist
or is not readable.
MethodNotFoundException - if no suitable method can be found.
ELException - if a String literal is specified and
expectedReturnType of the MethodExpression is void or if the
coercion of the String literal to the expectedReturnType yields
an error (see Section "1.18 Type Conversion").
ELException - if an exception was thrown while performing property
or variable resolution. The thrown exception must be included
as the cause property of this exception, if available. If the
exception thrown is an InvocationTargetException,
extract its cause and pass it to the
ELException constructor.MethodExpression.invoke(ELContext, Object[]),
ExpressionFactory.createMethodExpression(ELContext, String, Class,
Class[])
public <T> T evaluateMethodExpression(String expression,
Object... params)
Evaluate a MethodExpression, passing arguments to the method. The
types of the arguments are discoverted from the arguments, and the return
type is inferred.
A MethodExpression is created by calling
ExpressionFactory.createMethodExpression(ELContext, String, Class, Class[])
and then MethodExpression.invoke(ELContext, Object[]) is called to
obtain the value. For more details on the semantics of EL, refer to the
javadoc for these methods.
T - the type of the evaluated expressionexpression - expression the expression to evaluateparams - arguments to the method
ClassCastException - if the result cannot be cast to T
ELException - if there are syntactical errors in the provided
expression.
NullPointerException - if expectedParamTypes is
null.
PropertyNotFoundException - if one of the property resolutions
failed because a specified variable or property does not exist
or is not readable.
MethodNotFoundException - if no suitable method can be found.
ELException - if a String literal is specified and
expectedReturnType of the MethodExpression is void or if the
coercion of the String literal to the expectedReturnType yields
an error (see Section "1.18 Type Conversion").
ELException - if an exception was thrown while performing property
or variable resolution. The thrown exception must be included
as the cause property of this exception, if available. If the
exception thrown is an InvocationTargetException,
extract its cause and pass it to the
ELException constructor.MethodExpression.invoke(ELContext, Object[]),
ExpressionFactory.createMethodExpression(ELContext, String, Class,
Class[])public String toExpression(String name)
name - the name of the bean to convert
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||