| net.sf.jga.fn.property.InvokeMethod
InvokeMethod | public class InvokeMethod extends BinaryFunctor (Code) | | Functor that invokes a method described at construction and returns the
result or null if the result is void. The arguments must be passed to the
functor in an array, and the values must be assignable to the corresponding
classes given at construction.
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-2005 David A. Hall
author: David A. Hall |
Constructor Summary | |
public | InvokeMethod(Class<T> objClass, Method method) Builds a InvokeMethod for a given method, using the given class
to find the desired method. | public | InvokeMethod(Class<T> objClass, String methName, Class argtype) Builds an InvokeMethod for a given method, using the given class
to find the desired method. | public | InvokeMethod(Class<T> objClass, String methName, Class... argtypes) Builds a InvokeMethod for the given method, using the given class array
to find the desired method. |
serialVersionUID | final static long serialVersionUID(Code) | | |
InvokeMethod | public InvokeMethod(Class<T> objClass, Method method)(Code) | | Builds a InvokeMethod for a given method, using the given class
to find the desired method.
throws: IllegalArgumentException - if the method name is null or empty, orif the argument type array is null. |
InvokeMethod | public InvokeMethod(Class<T> objClass, String methName, Class argtype)(Code) | | Builds an InvokeMethod for a given method, using the given class
to find the desired method. Note that this is a convenience constructor
for a common case: the case where the method takes a single argument.
It is still necessary for the argument passed to the fn method to be an
array, in this case it must be an array of length 1 containing a value of
of type argtype. A ClassCastException may be thrown if this functor is
called incorrectly: if the line number in the associated stack dump points
to the class statement (on or about line 45), then the argument was likely
passed without being wrapped in an array.
throws: IllegalArgumentException - if the method name is null or empty, orif the argument type array is null. |
InvokeMethod | public InvokeMethod(Class<T> objClass, String methName, Class... argtypes)(Code) | | Builds a InvokeMethod for the given method, using the given class array
to find the desired method.
throws: IllegalArgumentException - if the method name is null or empty, orif the argument type array is null. |
accept | public void accept(net.sf.jga.fn.Visitor v)(Code) | | Calls the Visitor's visit(InvokeMethod) method, if it
implements the nested Visitor interface.
|
getMethodName | public String getMethodName()(Code) | | Returns the name of the method that this functor invokes.
|
getObjectType | public Class<T> getObjectType()(Code) | | Returns the class on which the method is invoked.
|
getReturnType | public Class<R> getReturnType()(Code) | | Returns the type of the method
|
|
|