public class InvokerTransformer<I,O> extends java.lang.Object implements Transformer<I,O>
WARNING: from v4.1 onwards this class will not be serializable anymore in order to prevent potential remote code execution exploits. Please refer to COLLECTIONS-580 for more details.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.Object[] |
iArgs
The array of reflection arguments
|
private java.lang.String |
iMethodName
The method name to call
|
private java.lang.Class<?>[] |
iParamTypes
The array of reflection parameter types
|
| Modifier | Constructor and Description |
|---|---|
private |
InvokerTransformer(java.lang.String methodName)
Constructor for no arg instance.
|
|
InvokerTransformer(java.lang.String methodName,
java.lang.Class<?>[] paramTypes,
java.lang.Object[] args)
Constructor that performs no validation.
|
| Modifier and Type | Method and Description |
|---|---|
static <I,O> Transformer<I,O> |
invokerTransformer(java.lang.String methodName)
Gets an instance of this transformer calling a specific method with no arguments.
|
static <I,O> Transformer<I,O> |
invokerTransformer(java.lang.String methodName,
java.lang.Class<?>[] paramTypes,
java.lang.Object[] args)
Gets an instance of this transformer calling a specific method with specific values.
|
O |
transform(java.lang.Object input)
Transforms the input to result by invoking a method on the input.
|
private final java.lang.String iMethodName
private final java.lang.Class<?>[] iParamTypes
private final java.lang.Object[] iArgs
private InvokerTransformer(java.lang.String methodName)
methodName - the method to callpublic InvokerTransformer(java.lang.String methodName,
java.lang.Class<?>[] paramTypes,
java.lang.Object[] args)
invokerTransformer if you want that.
Note: from 4.0, the input parameters will be cloned
methodName - the method to callparamTypes - the constructor parameter typesargs - the constructor argumentspublic static <I,O> Transformer<I,O> invokerTransformer(java.lang.String methodName)
I - the input typeO - the output typemethodName - the method name to calljava.lang.NullPointerException - if methodName is nullpublic static <I,O> Transformer<I,O> invokerTransformer(java.lang.String methodName, java.lang.Class<?>[] paramTypes, java.lang.Object[] args)
I - the input typeO - the output typemethodName - the method name to callparamTypes - the parameter types of the methodargs - the arguments to pass to the methodjava.lang.NullPointerException - if methodName is nulljava.lang.IllegalArgumentException - if paramTypes does not match argspublic O transform(java.lang.Object input)
transform in interface Transformer<I,O>input - the input object to transform