|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jga.fn.UnaryFunctor<T,R>
net.sf.jga.fn.property.InvokeNoArgMethod<T,R>
public class InvokeNoArgMethod<T,R>
Functor that invokes a no-arg method named at construction and returns the result or null if the result is void.
Note that declaring the return type incorrectly can result in ClassCastExceptions being thrown when the functor is invoked: the compiler cannot check the return type of a reflectively loaded method.
Copyright © 2003 David A. Hall
| Nested Class Summary | |
|---|---|
static interface |
InvokeNoArgMethod.Visitor
Interface for classes that may interpret a InvokeMethod function. |
| Constructor Summary | |
|---|---|
InvokeNoArgMethod(java.lang.Class<T> objClass,
java.lang.reflect.Method method)
Builds a InvokeMethod for the given method, which takes no arguments. |
|
InvokeNoArgMethod(java.lang.Class<T> objclass,
java.lang.String methName)
Builds a InvokeMethod for the given method, which takes no arguments. |
|
| Method Summary | |
|---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(InvokeMethod) method, if it
implements the nested Visitor interface. |
R |
fn(T obj)
Invokes the method on the given object, and returns the result. |
java.lang.String |
getMethodName()
Returns the name of the property that this functor retrieves. |
java.lang.Class<R> |
getReturnType()
Returns the type of the method |
java.lang.String |
toString()
|
| Methods inherited from class net.sf.jga.fn.UnaryFunctor |
|---|
bind, compose, compose, generate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public InvokeNoArgMethod(java.lang.Class<T> objclass,
java.lang.String methName)
java.lang.IllegalArgumentException - if the method name is null or empty
public InvokeNoArgMethod(java.lang.Class<T> objClass,
java.lang.reflect.Method method)
java.lang.IllegalArgumentException - if the method name is null or empty,
or if it is not defined for the given class, or if it takes arguments| Method Detail |
|---|
public java.lang.String getMethodName()
public java.lang.Class<R> getReturnType()
public R fn(T obj)
fn in class UnaryFunctor<T,R>EvaluationException - if the argument does not have the designated
public property, or if it is not of the correct type.public void accept(Visitor v)
visit(InvokeMethod) method, if it
implements the nested Visitor interface.
accept in interface Visitableaccept in class UnaryFunctor<T,R>public 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 | ||||||||