public class InvokerTransformer extends java.lang.Object implements Transformer, java.io.Serializable
WARNING: from v3.2.2 onwards this class will throw an
UnsupportedOperationException
when trying to serialize or
de-serialize an instance to prevent potential remote code execution exploits.
In order to re-enable serialization support for InvokerTransformer
the following system property can be used (via -Dproperty=true):
org.apache.commons.collections.enableUnsafeSerialization
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
|
private static long |
serialVersionUID
The serial version
|
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 Transformer |
getInstance(java.lang.String methodName)
Gets an instance of this transformer calling a specific method with no arguments.
|
static Transformer |
getInstance(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.
|
private void |
readObject(java.io.ObjectInputStream is)
Overrides the default readObject implementation to prevent
de-serialization (see COLLECTIONS-580).
|
java.lang.Object |
transform(java.lang.Object input)
Transforms the input to result by invoking a method on the input.
|
private void |
writeObject(java.io.ObjectOutputStream os)
Overrides the default writeObject implementation to prevent
serialization (see COLLECTIONS-580).
|
private static final long serialVersionUID
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)
getInstance
if you want that.methodName
- the method to callparamTypes
- the constructor parameter types, not clonedargs
- the constructor arguments, not clonedpublic static Transformer getInstance(java.lang.String methodName)
methodName
- the method name to callpublic static Transformer getInstance(java.lang.String methodName, java.lang.Class[] paramTypes, java.lang.Object[] args)
methodName
- the method name to callparamTypes
- the parameter types of the methodargs
- the arguments to pass to the methodpublic java.lang.Object transform(java.lang.Object input)
transform
in interface Transformer
input
- the input object to transformprivate void writeObject(java.io.ObjectOutputStream os) throws java.io.IOException
java.io.IOException
private void readObject(java.io.ObjectInputStream is) throws java.lang.ClassNotFoundException, java.io.IOException
java.lang.ClassNotFoundException
java.io.IOException