netx.jnlp.util
Class Reflect
public class Reflect
extends java.lang.Object
Provides simply, convenient methods to invoke methods by
name. This class is used to consolidate reflection needed to
access methods specific to Sun's JVM or to remain backward
compatible while supporting method in newer JVMs.
Most methods of this class invoke the first method on the
specified object that matches the name and number of
parameters. The type of the parameters are not considered, so
do not attempt to use this class to invoke overloaded
methods.
Instances of this class are not synchronized.
Reflect() - Create a new Reflect instance.
|
Reflect(boolean accessible) - Create a new Reflect instance.
|
Method | getMethod(Class type, String method, args[] ) - Return the Method matching the specified name and number of
arguments.
|
Object | invoke(Object object, String method) - Invoke a zero-parameter method by name on the specified
object.
|
Object | invoke(Object object, String method, args[] ) - Invoke a method by name with the specified parameters.
|
Object | invokeStatic(String className, String method) - Invoke a zero-parameter static method by name.
|
Object | invokeStatic(String className, String method, args[] ) - Invoke the static method using the specified parameters.
|
Reflect
public Reflect()
Create a new Reflect instance.
Reflect
public Reflect(boolean accessible)
Create a new Reflect instance.
accessible
- whether to bypass access permissions
getMethod
public Method getMethod(Class type,
String method,
args[] )
Return the Method matching the specified name and number of
arguments.
invoke
public Object invoke(Object object,
String method)
Invoke a zero-parameter method by name on the specified
object.
invoke
public Object invoke(Object object,
String method,
args[] )
Invoke a method by name with the specified parameters.
- the result of the method, or null on exception.
invokeStatic
public Object invokeStatic(String className,
String method)
Invoke a zero-parameter static method by name.
invokeStatic
public Object invokeStatic(String className,
String method,
args[] )
Invoke the static method using the specified parameters.