|
||||||||||
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 java.lang.reflect.Method |
method
The method to call on the bean |
protected static java.lang.Object[] |
NULL_ARGUMENTS
null arguments |
protected static java.lang.Class[] |
NULL_CLASSES
null classes |
Constructor Summary | |
---|---|
MethodExpression()
Base constructor |
|
MethodExpression(java.lang.reflect.Method method)
Convenience constructor sets method property |
Method Summary | |
---|---|
java.lang.Object |
evaluate(Context context)
Evaluate by calling the read method on the current bean |
protected java.lang.reflect.Method |
findAlternateMethod(java.lang.Class type,
java.lang.reflect.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 java.lang.Object[] |
getArguments()
Allows derived objects to create arguments for the method call |
java.lang.reflect.Method |
getMethod()
Gets the method used to evaluate this expression. |
protected void |
handleException(Context context,
java.lang.Exception e)
Log error to context's logger. |
void |
setMethod(java.lang.reflect.Method method)
Sets the method used to evaluate this expression |
java.lang.String |
toString()
Returns something useful for logging. |
void |
update(Context context,
java.lang.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 java.lang.Object[] NULL_ARGUMENTS
protected static java.lang.Class[] NULL_CLASSES
private java.lang.reflect.Method method
Constructor Detail |
---|
public MethodExpression()
public MethodExpression(java.lang.reflect.Method method)
method
- the Method whose return value when invoked on the bean
will the value of this expressionMethod Detail |
---|
public java.lang.Object evaluate(Context context)
evaluate
in interface Expression
context
- the context against which this expression will be evaluated
public void update(Context context, java.lang.String newValue)
update
in interface Expression
context
- update this Context
newValue
- the new value for this expressionExpression
public java.lang.reflect.Method getMethod()
public void setMethod(java.lang.reflect.Method method)
method
- method whose value (when invoked against the context's bean) will be used
to evaluate this expressionprotected java.lang.Object[] getArguments()
NULL_ARGUMENTS
protected java.lang.reflect.Method findAlternateMethod(java.lang.Class type, java.lang.reflect.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, java.lang.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 java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |