|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.util.Reflect
public final class Reflect
This class assembles some reflection methods. Most exceptions are caught and replaced
by a null
value.
Method Summary | |
---|---|
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)
Caches and returns a reference to the specified field, or null . |
static java.lang.reflect.Constructor<?> |
find(java.lang.Class<?> clazz,
java.lang.Class<?>... types)
Caches and returns a constructor by parameter types. |
static java.lang.Class<?> |
find(java.lang.String name)
Caches and 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 pattern,
java.lang.Object... ext)
Caches and returns a reference to the class specified by the pattern, or null . |
static java.lang.Class<?> |
forName(java.lang.String name)
Caches and returns a reference to the specified class, or throws an exception. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean available(java.lang.String pattern, java.lang.Object... ext)
pattern
- class patternext
- optional extension
public static java.lang.Class<?> find(java.lang.String name)
null
.
name
- fully qualified class name
null
if the class is not foundpublic static java.lang.Class<?> forName(java.lang.String name) throws java.lang.Throwable
name
- fully qualified class name
java.lang.Throwable
- any exception or errorpublic static java.lang.reflect.Field field(java.lang.Class<?> clazz, java.lang.String name)
null
.
clazz
- class to search for the constructorname
- field name
null
if the field is not foundpublic static java.lang.Class<?> find(java.lang.String pattern, java.lang.Object... ext)
null
.
pattern
- class patternext
- optional extension
null
if the class is not foundpublic static java.lang.Class<?> find(java.lang.String[] names)
null
.
names
- fully qualified class names
null
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 parameters
null
if the constructor 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 parameters
null
if the method is not foundpublic static java.lang.Object get(java.lang.Class<?> clazz)
clazz
- class
public static java.lang.Object get(java.lang.reflect.Constructor<?> clazz, java.lang.Object... args)
null
.
clazz
- classargs
- arguments
public 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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |