public final class Reflect
extends java.lang.Object
null reference is returned or a runtime exception is thrown.| Modifier and Type | Method and Description |
|---|---|
static boolean |
available(java.lang.String pattern,
java.lang.Object... ext)
Checks if the class specified by the pattern is available.
|
static java.lang.reflect.Field |
field(java.lang.Class<?> clazz,
java.lang.String name)
Returns a reference to the specified field, or
null. |
static java.lang.reflect.Constructor<?> |
find(java.lang.Class<?> clazz,
java.lang.Class<?>... types)
Finds a constructor by parameter types.
|
static java.lang.Class<?> |
find(java.lang.String name)
Returns a reference to the specified class, or
null. |
static java.lang.Class<?> |
find(java.lang.String[] names)
Returns a class reference to one of the specified classes, or
null. |
static java.lang.Class<?> |
find(java.lang.String name,
JarLoader jar)
Returns a reference to a class located in the specified jar loader,
or
null. |
static java.lang.Class<?> |
find(java.lang.String pattern,
java.lang.Object... ext)
Returns a reference to the class specified by the pattern, or
null. |
static java.lang.Object |
get(java.lang.Class<?> clazz)
Returns a class instance, or throws a runtime exception.
|
static java.lang.Object |
get(java.lang.reflect.Constructor<?> clazz,
java.lang.Object... args)
Returns a class instance, or
null. |
static java.lang.Object |
invoke(java.lang.reflect.Method method,
java.lang.Object object,
java.lang.Object... args)
Invokes the specified method.
|
static java.lang.reflect.Method |
method(java.lang.Class<?> clazz,
java.lang.String name,
java.lang.Class<?>... types)
Finds a public, protected or private method by name and parameter types.
|
public static boolean available(java.lang.String pattern,
java.lang.Object... ext)
pattern - class patternext - optional extensionpublic static java.lang.Class<?> find(java.lang.String name)
null.name - class namenull if the class is not foundpublic static java.lang.Class<?> find(java.lang.String name,
JarLoader jar)
null.name - class namejar - jar loadernull if the class is not foundpublic static java.lang.reflect.Field field(java.lang.Class<?> clazz,
java.lang.String name)
null.clazz - class to search for the constructorname - class namenull if the field is not foundpublic static java.lang.Class<?> find(java.lang.String pattern,
java.lang.Object... ext)
null.pattern - class patternext - optional extensionnull if the class is not foundpublic static java.lang.Class<?> find(java.lang.String[] names)
null.names - class namesnull if the class is not foundpublic static java.lang.reflect.Constructor<?> find(java.lang.Class<?> clazz,
java.lang.Class<?>... types)
clazz - class to search for the constructortypes - constructor parametersnull if the class is not foundpublic static java.lang.reflect.Method method(java.lang.Class<?> clazz,
java.lang.String name,
java.lang.Class<?>... types)
clazz - class to search for the methodname - method nametypes - method parametersnull if the method is not foundpublic static java.lang.Object get(java.lang.Class<?> clazz)
clazz - classpublic static java.lang.Object get(java.lang.reflect.Constructor<?> clazz,
java.lang.Object... args)
null.clazz - classargs - argumentspublic static java.lang.Object invoke(java.lang.reflect.Method method,
java.lang.Object object,
java.lang.Object... args)
method - method to runobject - object (null for static methods)args - arguments