|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.collections15.functors.transformer.InvokerTransformer<I,O>
public class InvokerTransformer<I,O>
Transformer
implementation whose transform(I)
method
invokes a specified method on the input object by reflection, returning the
resulting return value as the output.
Constructor Summary | |
---|---|
protected |
InvokerTransformer(java.lang.String methodName,
java.lang.Class[] parameterTypes,
java.lang.Object[] arguments)
Create a new instance that transforms an input object by invoking a method of the specified signature with the specified arguments via reflection, and returning the return value as the output object. |
Method Summary | ||
---|---|---|
static
|
getInstance(java.lang.String methodName)
Returns an instance that transforms an input object by invoking a method of the specified name and no arguments via reflection, and returning the return value as the output object. |
|
static
|
getInstance(java.lang.String methodName,
java.lang.Class[] parameterTypes,
java.lang.Object[] arguments)
Returns an instance that transforms an input object by invoking a method of the specified signature with the specified arguments via reflection, and returning the return value as the output object. |
|
O |
transform(I input)
Transforms the input by invoking a method on it and returning the resulting return value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected InvokerTransformer(java.lang.String methodName, java.lang.Class[] parameterTypes, java.lang.Object[] arguments)
methodName
- The name of the method to invoke on an input
object.parameterTypes
- The parameter types of the method to invoke on an
input object. May be null
or empty if
arguments
is also null
or
empty, in which case the parameterless mehod of the
specified name will be used. The contents of this
array are defensively copied.arguments
- The arguments to pass to the method invoked on an
input Class
.
java.lang.IllegalArgumentException
- Thrown if the method name argument is
null
.
java.lang.IllegalArgumentException
- Thrown if either of parameterTypes
or arguments
is
null
, but the other is
not.
java.lang.IllegalArgumentException
- Thrown if any element in parameterTypes
is null
.
java.lang.IllegalArgumentException
- Thrown if any none-null
element in arguments
is not
an instance of its corresponding
parameterTypes
class.Method Detail |
---|
public static <I,O> InvokerTransformer<I,O> getInstance(java.lang.String methodName)
methodName
- The name of the method to invoke on an input object.
java.lang.IllegalArgumentException
- Thrown if the method name argument is
null
.public static <I,O> InvokerTransformer<I,O> getInstance(java.lang.String methodName, java.lang.Class[] parameterTypes, java.lang.Object[] arguments)
methodName
- The name of the method to invoke on an input
object.parameterTypes
- The parameter types of the method to invoke on an
input object. May be null
or empty if
arguments
is also null
or
empty, in which case the parameterless mehod of the
specified name will be used. The contents of this
array are defensively copied.arguments
- The arguments to pass to the method invoked on an
input Class
.
java.lang.IllegalArgumentException
- Thrown if the method name argument is
null
.
java.lang.IllegalArgumentException
- Thrown if either of parameterTypes
or arguments
is
null
, but the other is
not.
java.lang.IllegalArgumentException
- Thrown if any element in parameterTypes
is null
.
java.lang.IllegalArgumentException
- Thrown if any none-null
element in arguments
is not
an instance of its corresponding
parameterTypes
class.public O transform(I input) throws FunctorException
transform
in interface Transformer<I,O>
input
- The input object to transform.
void
,
null
is returned.
FunctorException
- Thrown if any of the following is true. null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |