public class MethodExpression extends Object implements Expression
MethodExpression evaluates a method on the current bean context.
| Modifier and Type | Field and Description |
|---|---|
private Method |
method
The method to call on the bean
|
protected static Object[] |
NULL_ARGUMENTS
null arguments
|
protected static Class[] |
NULL_CLASSES
null classes
|
| Constructor and Description |
|---|
MethodExpression()
Base constructor
|
MethodExpression(Method method)
Convenience constructor sets method property
|
| Modifier and Type | Method and Description |
|---|---|
Object |
evaluate(Context context)
Evaluate by calling the read method on the current bean
|
protected Method |
findAlternateMethod(Class type,
Method method)
Tries to find an alternate method for the given type using interfaces
which gets around the problem of inner classes,
such as on Map.Entry implementations.
|
protected Object[] |
getArguments()
Allows derived objects to create arguments for the method call
|
Method |
getMethod()
Gets the method used to evaluate this expression.
|
protected void |
handleException(Context context,
Exception e)
Log error to context's logger.
|
void |
setMethod(Method method)
Sets the method used to evaluate this expression
|
String |
toString()
Returns something useful for logging.
|
void |
update(Context context,
String newValue)
Do nothing.
|
protected static Object[] NULL_ARGUMENTS
protected static Class[] NULL_CLASSES
private Method method
public MethodExpression()
public MethodExpression(Method method)
method - the Method whose return value when invoked on the bean
will the value of this expressionpublic Object evaluate(Context context)
evaluate in interface Expressioncontext - the context against which this expression will be evaluatedpublic void update(Context context, String newValue)
update in interface Expressioncontext - update this ContextnewValue - the new value for this expressionExpressionpublic Method getMethod()
public void setMethod(Method method)
method - method whose value (when invoked against the context's bean) will be used
to evaluate this expressionprotected Object[] getArguments()
NULL_ARGUMENTSprotected Method findAlternateMethod(Class type, Method method)
type - the Class whose methods are to be searchedmethod - the Method for which an alternative is to be search forprotected void handleException(Context context, Exception e)
Log error to context's logger.
Allows derived objects to handle exceptions differently.
context - the Context being evaluated when the exception occurede - the exception to handle