public abstract class Dynamic
extends java.lang.Object
ReflectPermission
Constructor and Description |
---|
Dynamic() |
Modifier and Type | Method and Description |
---|---|
protected static java.lang.reflect.Method |
findMethod(java.lang.Class<?> aClass,
java.lang.String methodName,
java.lang.Class<?>[] paramTypes) |
protected static java.lang.Class<?> |
getTypeOf(java.lang.Object object) |
static java.lang.Object |
invoke(java.lang.Object receiver,
java.lang.reflect.Method method,
java.lang.Object[] args)
Executes the given method on the given object with the specified arguments.
|
static java.lang.Object |
invoke(java.lang.Object receiver,
java.lang.String methodName)
Executes the named method on the given object and without any arguments.
|
static java.lang.Object |
invoke(java.lang.Object receiver,
java.lang.String methodName,
boolean arg)
Executes the named method on the given object with one boolean argument.
|
static java.lang.Object |
invoke(java.lang.Object receiver,
java.lang.String methodName,
int arg)
Executes the named method on the given object with one integer argument.
|
static java.lang.Object |
invoke(java.lang.Object receiver,
java.lang.String methodName,
java.lang.Object arg)
Executes the named method on the given object with one none primitive argument.
|
static java.lang.Object |
invoke(java.lang.Object receiver,
java.lang.String methodName,
java.lang.Object[] args)
Executes the named method on the given object with several arguments.
|
static java.lang.Object |
invoke(java.lang.Object receiver,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.Class<?>[] argTypes)
Executes the named method on the given object with several arguments.
|
static java.lang.Object |
perform(java.lang.Object receiver,
java.lang.reflect.Method method,
java.lang.Object[] args)
Executes the given method on the given object with the specified arguments.
|
static java.lang.Object |
perform(java.lang.Object receiver,
java.lang.String methodName)
Executes the named method on the given object and without any arguments.
|
static java.lang.Object |
perform(java.lang.Object receiver,
java.lang.String methodName,
boolean arg)
Executes the named method on the given object with one boolean argument.
|
static java.lang.Object |
perform(java.lang.Object receiver,
java.lang.String methodName,
int arg)
Executes the named method on the given object with one integer argument.
|
static java.lang.Object |
perform(java.lang.Object receiver,
java.lang.String methodName,
java.lang.Object arg)
Executes the named method on the given object with one none primitive argument.
|
static java.lang.Object |
perform(java.lang.Object receiver,
java.lang.String methodName,
java.lang.Object[] args)
Executes the named method on the given object with several arguments.
|
static java.lang.Object |
perform(java.lang.Object receiver,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.Class<?>[] argTypes)
Executes the named method on the given object with several arguments.
|
static java.lang.Object |
perform(java.lang.Object receiver,
java.lang.String methodName,
java.lang.Object[] args,
java.lang.String[] signature)
This method allows direct dynamic execution of JMX MBean method invocations.
|
public static java.lang.Object invoke(java.lang.Object receiver, java.lang.String methodName)
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.public static java.lang.Object invoke(java.lang.Object receiver, java.lang.String methodName, java.lang.Object arg)
If an exception occurs during this method invocation the result will be the exception rather than the expected value of the method call!
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.arg
- An object, which becomes the only argument for the called methodpublic static java.lang.Object invoke(java.lang.Object receiver, java.lang.String methodName, int arg)
If an exception occurs during this method invocation the result will be the exception rather than the expected value of the method call!
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.arg
- An integer value, which becomes the only argument for the called methodpublic static java.lang.Object invoke(java.lang.Object receiver, java.lang.String methodName, boolean arg)
If an exception occurs during this method invocation the result will be the exception rather than the expected value of the method call!
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.arg
- A boolean value, which becomes the only argument for the called methodpublic static java.lang.Object invoke(java.lang.Object receiver, java.lang.String methodName, java.lang.Object[] args)
If an exception occurs during this method invocation the result will be the exception rather than the expected value of the method call!
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.args
- The arguments for the method invocationpublic static java.lang.Object invoke(java.lang.Object receiver, java.lang.String methodName, java.lang.Object[] args, java.lang.Class<?>[] argTypes)
If an exception occurs during this method invocation the result will be the exception rather than the expected value of the method call!
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.args
- The arguments for the method invocationargTypes
- The types of the arguments as defined in the method signaturepublic static java.lang.Object invoke(java.lang.Object receiver, java.lang.reflect.Method method, java.lang.Object[] args)
If an exception occurs during this method invocation the result will be the exception rather than the expected value of the method call!
receiver
- The object the method should be invoked on.method
- The method to invoke.args
- The arguments for the method invocationpublic static java.lang.Object perform(java.lang.Object receiver, java.lang.String methodName) throws java.lang.Exception
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.java.lang.Exception
- All kinds of exceptions are passed to the callerpublic static java.lang.Object perform(java.lang.Object receiver, java.lang.String methodName, java.lang.Object arg) throws java.lang.Exception
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.arg
- An object, which becomes the only argument for the called methodjava.lang.Exception
- All kinds of exceptions are passed to the callerpublic static java.lang.Object perform(java.lang.Object receiver, java.lang.String methodName, int arg) throws java.lang.Exception
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.arg
- An integer value, which becomes the only argument for the called methodjava.lang.Exception
- All kinds of exceptions are passed to the callerpublic static java.lang.Object perform(java.lang.Object receiver, java.lang.String methodName, boolean arg) throws java.lang.Exception
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.arg
- A boolean value, which becomes the only argument for the called methodjava.lang.Exception
- All kinds of exceptions are passed to the callerpublic static java.lang.Object perform(java.lang.Object receiver, java.lang.String methodName, java.lang.Object[] args) throws java.lang.Exception
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.args
- The arguments for the method calljava.lang.Exception
- All kinds of exceptions are passed to the callerpublic static java.lang.Object perform(java.lang.Object receiver, java.lang.String methodName, java.lang.Object[] args, java.lang.String[] signature) throws java.lang.Exception
receiver
- The object on which the method must be invokedmethodName
- The name of the method to invokeargs
- The arguments to be passed to the methodsignature
- The qualified class names of the argument typesjava.lang.Exception
public static java.lang.Object perform(java.lang.Object receiver, java.lang.String methodName, java.lang.Object[] args, java.lang.Class<?>[] argTypes) throws java.lang.Exception
receiver
- The object the method should be performed on.methodName
- The name of the method to perform.args
- The arguments for the method callargTypes
- The types of the arguments in the args parameterjava.lang.Exception
- All kinds of exceptions are passed to the callerpublic static java.lang.Object perform(java.lang.Object receiver, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Exception
receiver
- The object the method should be performed on.method
- The method to perform.args
- The arguments for the method calljava.lang.Exception
- All kinds of exceptions are passed to the callerprotected static java.lang.Class<?> getTypeOf(java.lang.Object object)
protected static java.lang.reflect.Method findMethod(java.lang.Class<?> aClass, java.lang.String methodName, java.lang.Class<?>[] paramTypes)