|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.betwixt.expression.MethodExpression
public class MethodExpression
MethodExpression
evaluates a method on the current bean context.
Field Summary | |
---|---|
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 Summary | |
---|---|
MethodExpression()
Base constructor |
|
MethodExpression(Method method)
Convenience constructor sets method property |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static Object[] NULL_ARGUMENTS
protected static Class[] NULL_CLASSES
private Method method
Constructor Detail |
---|
public MethodExpression()
public MethodExpression(Method method)
method
- the Method whose return value when invoked on the bean
will the value of this expressionMethod Detail |
---|
public Object evaluate(Context context)
evaluate
in interface Expression
context
- the context against which this expression will be evaluated
public void update(Context context, String newValue)
update
in interface Expression
context
- update this Context
newValue
- the new value for this expressionExpression
public 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_ARGUMENTS
protected 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 for
protected 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 handlepublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |