Utility methods to simplify reflection access.
More...
|
static boolean | isClassAvailable (final String clazzName, final ClassLoader cl) |
| Returns true only if the class could be loaded but w/o class initialization. More...
|
|
static final Class<?> | getClass (final String clazzName, final boolean initializeClazz, final ClassLoader cl) throws RuntimeException |
| Loads and returns the class or null. More...
|
|
static final Method | getMethod (final Class<?> clazz, final String methodName, final Class<?> ... argTypes) throws RuntimeException |
|
static final Method | getMethod (final String clazzName, final boolean initializeClazz, final String methodName, final Class<?>[] argTypes, final ClassLoader cl) throws RuntimeException |
|
static final< R > R | callMethod (final Object instance, final Method method, final Object ... args) throws RuntimeException |
|
static final< R > R | callStaticMethod (final Method method, final Object ... args) throws RuntimeException |
|
static final< R > R | callStaticMethod (final String clazzName, final String methodName, final Class<?>[] argTypes, final Object[] args, final ClassLoader cl) throws RuntimeException |
|
Utility methods to simplify reflection access.
Definition at line 35 of file ReflectionUtil.java.
◆ callMethod()
static final< R > R org.jau.lang.ReflectionUtil.callMethod |
( |
final Object |
instance, |
|
|
final Method |
method, |
|
|
final Object ... |
args |
|
) |
| throws RuntimeException |
|
static |
- Parameters
-
instance | may be null in case of a static method |
method | the method to be called |
args | the method arguments |
- Returns
- the methods result, maybe null if void
- Exceptions
-
RuntimeException | if call fails |
Definition at line 119 of file ReflectionUtil.java.
◆ callStaticMethod() [1/2]
static final< R > R org.jau.lang.ReflectionUtil.callStaticMethod |
( |
final Method |
method, |
|
|
final Object ... |
args |
|
) |
| throws RuntimeException |
|
static |
- Parameters
-
method | the method to be called |
args | the method arguments |
- Returns
- the methods result, maybe null if void
- Exceptions
-
RuntimeException | if call fails |
Definition at line 145 of file ReflectionUtil.java.
◆ callStaticMethod() [2/2]
static final< R > R org.jau.lang.ReflectionUtil.callStaticMethod |
( |
final String |
clazzName, |
|
|
final String |
methodName, |
|
|
final Class<?>[] |
argTypes, |
|
|
final Object[] |
args, |
|
|
final ClassLoader |
cl |
|
) |
| throws RuntimeException |
|
static |
- Exceptions
-
RuntimeException | if the instance can not be created. |
Definition at line 154 of file ReflectionUtil.java.
◆ getClass()
static final Class<?> org.jau.lang.ReflectionUtil.getClass |
( |
final String |
clazzName, |
|
|
final boolean |
initializeClazz, |
|
|
final ClassLoader |
cl |
|
) |
| throws RuntimeException |
|
static |
Loads and returns the class or null.
- See also
- Class::forName(java.lang.String, boolean, java.lang.ClassLoader)
Definition at line 76 of file ReflectionUtil.java.
◆ getMethod() [1/2]
static final Method org.jau.lang.ReflectionUtil.getMethod |
( |
final Class<?> |
clazz, |
|
|
final String |
methodName, |
|
|
final Class<?> ... |
argTypes |
|
) |
| throws RuntimeException |
|
static |
- Exceptions
-
RuntimeException | if the Method can not be found. |
Definition at line 88 of file ReflectionUtil.java.
◆ getMethod() [2/2]
static final Method org.jau.lang.ReflectionUtil.getMethod |
( |
final String |
clazzName, |
|
|
final boolean |
initializeClazz, |
|
|
final String |
methodName, |
|
|
final Class<?>[] |
argTypes, |
|
|
final ClassLoader |
cl |
|
) |
| throws RuntimeException |
|
static |
- Exceptions
-
RuntimeException | if the Method can not be found. |
Definition at line 101 of file ReflectionUtil.java.
◆ isClassAvailable()
static boolean org.jau.lang.ReflectionUtil.isClassAvailable |
( |
final String |
clazzName, |
|
|
final ClassLoader |
cl |
|
) |
| |
|
static |
Returns true only if the class could be loaded but w/o class initialization.
Definition at line 56 of file ReflectionUtil.java.
The documentation for this class was generated from the following file: