jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Classes | Static Public Member Functions | List of all members
org.jau.lang.ReflectionUtil Class Reference

Utility methods to simplify reflection access. More...

Collaboration diagram for org.jau.lang.ReflectionUtil:

Classes

class  MethodAccessor
 Convenient Method access class. More...
 

Static Public Member Functions

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
 

Detailed Description

Utility methods to simplify reflection access.

Definition at line 35 of file ReflectionUtil.java.

Member Function Documentation

◆ callMethod()

static final< R > R org.jau.lang.ReflectionUtil.callMethod ( final Object  instance,
final Method  method,
final Object ...  args 
) throws RuntimeException
static
Parameters
instancemay be null in case of a static method
methodthe method to be called
argsthe method arguments
Returns
the methods result, maybe null if void
Exceptions
RuntimeExceptionif call fails

Definition at line 119 of file ReflectionUtil.java.

Here is the caller graph for this function:

◆ callStaticMethod() [1/2]

static final< R > R org.jau.lang.ReflectionUtil.callStaticMethod ( final Method  method,
final Object ...  args 
) throws RuntimeException
static
Parameters
methodthe method to be called
argsthe method arguments
Returns
the methods result, maybe null if void
Exceptions
RuntimeExceptionif call fails

Definition at line 145 of file ReflectionUtil.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
RuntimeExceptionif the instance can not be created.

Definition at line 154 of file ReflectionUtil.java.

Here is the call graph for this function:

◆ 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
RuntimeExceptionif the Method can not be found.

Definition at line 88 of file ReflectionUtil.java.

Here is the caller graph for this function:

◆ 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
RuntimeExceptionif the Method can not be found.

Definition at line 101 of file ReflectionUtil.java.

Here is the call graph for this function:

◆ 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: