public class Reflection
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.Class[] |
EMPTY_CLASS_ARRAY
empty class array.
|
static java.lang.Object[] |
EMPTY_OBJECT_ARRAY
empty object array.
|
| Constructor and Description |
|---|
Reflection() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
function(java.lang.Object obj,
java.lang.String method)
Returns the value from the method call.
|
static <T> T |
function(java.lang.Object obj,
java.lang.String method,
java.lang.Class[] signature,
java.lang.Object[] values)
Returns the value from the method call.
|
static <T> T |
newInstance(java.lang.Class<T> cls,
java.lang.Class[] signature,
java.lang.Object[] values)
Instantiates a new instance of the class.
|
static <T> T |
newInstance(java.lang.String cls,
java.lang.Class[] signature,
java.lang.Object[] values)
Instantiates a new instance of the class.
|
static void |
procedure(java.lang.Object obj,
java.lang.String method)
Calls the method with the specified value(s).
|
static void |
procedure(java.lang.Object obj,
java.lang.String method,
java.lang.Class[] signature,
java.lang.Object[] values)
Calls the method with the specified value(s).
|
public static java.lang.Class[] EMPTY_CLASS_ARRAY
public static java.lang.Object[] EMPTY_OBJECT_ARRAY
public static <T> T newInstance(java.lang.String cls,
java.lang.Class[] signature,
java.lang.Object[] values)
throws java.lang.Exception
T - the type of class to instantiatecls - the name of the class to instantiatesignature - the signature of the constructorvalues - the values for the constructorjava.lang.Exception - if instantiation failspublic static <T> T newInstance(java.lang.Class<T> cls,
java.lang.Class[] signature,
java.lang.Object[] values)
throws java.lang.Exception
T - the type of class to instantiatecls - the class to instantiatesignature - the signature of the constructorvalues - the values for the constructorjava.lang.Exception - if instantiation failspublic static <T> T function(java.lang.Object obj,
java.lang.String method)
throws java.lang.Exception
T - the type of the resultobj - the object to call the invoke the method onmethod - the name of the method to invokejava.lang.Exception - if method call failedpublic static <T> T function(java.lang.Object obj,
java.lang.String method,
java.lang.Class[] signature,
java.lang.Object[] values)
throws java.lang.Exception
T - the type of the resultobj - the object to call the invoke the method onmethod - the name of the method to invokesignature - the signature of the methodvalues - the values for the method calljava.lang.Exception - if method call failedpublic static void procedure(java.lang.Object obj,
java.lang.String method)
throws java.lang.Exception
obj - the object to call the invoke the method onmethod - the name of the method to invokejava.lang.Exception - if method call failedpublic static void procedure(java.lang.Object obj,
java.lang.String method,
java.lang.Class[] signature,
java.lang.Object[] values)
throws java.lang.Exception
obj - the object to call the invoke the method onmethod - the name of the method to invokesignature - the signature of the methodvalues - the values for the method calljava.lang.Exception - if method call failedCopyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.