public final class Reflect extends Object
null
value.Modifier and Type | Method and Description |
---|---|
static boolean |
available(String pattern,
Object... ext)
Checks if the class specified by the pattern is available.
|
static Field |
field(Class<?> clazz,
String name)
Caches and returns a reference to the specified field or
null . |
static <O> Constructor<O> |
find(Class<O> clazz,
Class<?>... types)
Caches and returns a constructor by parameter types.
|
static Class<?> |
find(String name)
Caches and returns a reference to the specified class or
null . |
static Class<?> |
find(String[] names)
Returns a class reference to one of the specified classes or
null . |
static Class<?> |
find(String pattern,
Object... ext)
Caches and returns a reference to the class specified by the pattern,
or
null . |
static Class<?> |
forName(String name)
Caches and returns a reference to the specified class, or throws an exception.
|
static <O> O |
get(Class<O> clazz)
Returns a class instance, or throws a runtime exception.
|
static <O> O |
get(Constructor<O> clazz,
Object... args)
Returns a class instance or
null . |
static Object |
invoke(Method method,
Object object,
Object... args)
Invokes the specified method.
|
static Method |
method(Class<?> clazz,
String name,
Class<?>... types)
Finds a public, protected or private method by name and parameter types.
|
public static boolean available(String pattern, Object... ext)
pattern
- class patternext
- optional extensionpublic static Class<?> find(String name)
null
.name
- fully qualified class namenull
if the class is not foundpublic static Class<?> forName(String name) throws ClassNotFoundException
name
- fully qualified class nameClassNotFoundException
- any exception or errorpublic static Field field(Class<?> clazz, String name)
null
.clazz
- class to search for the constructorname
- field namenull
if the field is not foundpublic static Class<?> find(String pattern, Object... ext)
null
.pattern
- class patternext
- optional extensionnull
if the class is not foundpublic static Class<?> find(String[] names)
null
.names
- fully qualified class namesnull
if the class is not foundpublic static <O> Constructor<O> find(Class<O> clazz, Class<?>... types)
O
- class typeclazz
- class to search for the constructortypes
- constructor parametersnull
if the constructor is not foundpublic static Method method(Class<?> clazz, String name, Class<?>... types)
clazz
- class to search for the methodname
- method nametypes
- method parametersnull
if the method is not foundpublic static <O> O get(Class<O> clazz)
O
- typeclazz
- classpublic static <O> O get(Constructor<O> clazz, Object... args)
null
.O
- class typeclazz
- classargs
- argumentsCopyright © 2005–2015 BaseX Team. All rights reserved.