| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private Class | |
| private Method | |
| private Class | |
| public ReflectionDriver | reflectionDriver
The reflection driver to use. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Class | Returns: The class of the requested name, or null if an exception was thrown while trying to load the class.The class name to load. className)Call Class.forName(className), but return null if any exception is thrown. |
| public <T> T | doPrivileged(final Callable<T> callable)
Call a method in the AccessController.doPrivileged(PrivilegedAction) context, using reflection, if possible (AccessController is deprecated in JDK 17). |
| public Object | Returns: The field value.If true, throw an exception if the field value could not be read. throwException, final Object The object. obj, final Field The field. field)Get the value of the field in the class of the given object or any of its superclasses. |
| public Object | Returns: The field value.If true, throw an exception if the field value could not be read. throwException, final Object The object. obj, final String The field name. fieldName)Get the value of the named field in the class of the given object or any of its superclasses. |
| public Object | Returns: The field value.If true, throw an exception if the field value could not be read. throwException, final Class<?> The class. cls, final String The field name. fieldName)Get the value of the named field in the given class or any of its superclasses. |
| public Object | Returns: The result of the method invocation.If true, throw an exception if the field value could not be read. throwException, final Object The object. obj, final String The method name. methodName)Invoke the named method in the given object or its superclasses. |
| public Object | Returns: The result of the method invocation.Whether to throw an exception on failure. throwException, final Object The object. obj, final String The method name. methodName, final Class<?> The type of the method argument. argType, final Object The parameter value to use when invoking the method. param)Invoke the named method in the given object or its superclasses. |
| public Object | Returns: The result of the method invocation.Whether to throw an exception on failure. throwException, final Class<?> The class. cls, final String The method name. methodName)Invoke the named method. |
| public Object | Returns: The result of the method invocation.Whether to throw an exception on failure. throwException, final Class<?> The class. cls, final String The method name. methodName, final Class<?> The type of the method argument. argType, final Object The parameter value to use when invoking the method. param)Invoke the named method. |
| public Method | Returns: The class of the requested name, or null if an exception was thrown while trying to load the class.The class name to load. className, final String staticMethodName)Get a method by name, but return null if any exception is thrown. |
| accessControllerClass | back to summary |
|---|---|
| private Class<?> accessControllerClass | |
| accessControllerDoPrivileged | back to summary |
|---|---|
| private Method accessControllerDoPrivileged | |
| privilegedActionClass | back to summary |
|---|---|
| private Class<?> privilegedActionClass | |
| reflectionDriver | back to summary |
|---|---|
| public ReflectionDriver reflectionDriver The reflection driver to use. | |
| ReflectionUtils | back to summary |
|---|---|
| public ReflectionUtils() Call this if you change the value of | |
| classForNameOrNull | back to summary |
|---|---|
| public Class Call Class.forName(className), but return null if any exception is thrown. | |
| doPrivileged | back to summary |
|---|---|
| public <T> T doPrivileged(final Callable<T> callable) throws Throwable Call a method in the AccessController.doPrivileged(PrivilegedAction) context, using reflection, if possible (AccessController is deprecated in JDK 17).
| |
| getFieldVal | back to summary |
|---|---|
| public Object getFieldVal(final boolean throwException, final Object obj, final Field field) throws IllegalArgumentException Get the value of the field in the class of the given object or any of its superclasses. If an exception is thrown while trying to read the field, and throwException is true, then IllegalArgumentException is thrown wrapping the cause, otherwise this will return null. If passed a null object, returns null unless throwException is true, then throws IllegalArgumentException.
| |
| getFieldVal | back to summary |
|---|---|
| public Object getFieldVal(final boolean throwException, final Object obj, final String fieldName) throws IllegalArgumentException Get the value of the named field in the class of the given object or any of its superclasses. If an exception is thrown while trying to read the field, and throwException is true, then IllegalArgumentException is thrown wrapping the cause, otherwise this will return null. If passed a null object, returns null unless throwException is true, then throws IllegalArgumentException.
| |
| getStaticFieldVal | back to summary |
|---|---|
| public Object getStaticFieldVal(final boolean throwException, final Class<?> cls, final String fieldName) throws IllegalArgumentException Get the value of the named field in the given class or any of its superclasses. If an exception is thrown while trying to read the field value, and throwException is true, then IllegalArgumentException is thrown wrapping the cause, otherwise this will return null. If passed a null class reference, returns null unless throwException is true, then throws IllegalArgumentException.
| |
| invokeMethod | back to summary |
|---|---|
| public Object invokeMethod(final boolean throwException, final Object obj, final String methodName) throws IllegalArgumentException Invoke the named method in the given object or its superclasses. If an exception is thrown while trying to call the method, and throwException is true, then IllegalArgumentException is thrown wrapping the cause, otherwise this will return null. If passed a null object, returns null unless throwException is true, then throws IllegalArgumentException.
| |
| invokeMethod | back to summary |
|---|---|
| public Object invokeMethod(final boolean throwException, final Object obj, final String methodName, final Class<?> argType, final Object param) throws IllegalArgumentException Invoke the named method in the given object or its superclasses. If an exception is thrown while trying to call the method, and throwException is true, then IllegalArgumentException is thrown wrapping the cause, otherwise this will return null. If passed a null object, returns null unless throwException is true, then throws IllegalArgumentException.
| |
| invokeStaticMethod | back to summary |
|---|---|
| public Object invokeStaticMethod(final boolean throwException, final Class<?> cls, final String methodName) throws IllegalArgumentException Invoke the named method. If an exception is thrown while trying to call the method, and throwException is true, then IllegalArgumentException is thrown wrapping the cause, otherwise this will return null. If passed a null class reference, returns null unless throwException is true, then throws IllegalArgumentException.
| |
| invokeStaticMethod | back to summary |
|---|---|
| public Object invokeStaticMethod(final boolean throwException, final Class<?> cls, final String methodName, final Class<?> argType, final Object param) throws IllegalArgumentException Invoke the named method. If an exception is thrown while trying to call the method, and throwException is true, then IllegalArgumentException is thrown wrapping the cause, otherwise this will return null. If passed a null class reference, returns null unless throwException is true, then throws IllegalArgumentException.
| |
| staticMethodForNameOrNull | back to summary |
|---|---|
| public Method staticMethodForNameOrNull(final String className, final String staticMethodName) Get a method by name, but return null if any exception is thrown. | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | invoke(final Object
the proxy instance that the method was invoked on proxy, final Method the method, final Object[] Method instance corresponding to
the interface method invoked on the proxy instance. The declaring
class of the Method object will be the interface that
the method was declared in, which may be a superinterface of the
proxy interface that the proxy class inherits the method through.an array of objects containing the values of the
arguments passed in the method invocation on the proxy instance,
or args)null if interface method takes no arguments.
Arguments of primitive types are wrapped in instances of the
appropriate primitive wrapper class, such as
java.lang.Integer or java.lang.Boolean.Implements java. Processes a method invocation on a proxy instance and returns the result. |
| callable | back to summary |
|---|---|
| private final Callable<T> callable | |
| PrivilegedActionInvocationHandler | back to summary |
|---|---|
| public PrivilegedActionInvocationHandler(final Callable<T> callable) | |
| invoke | back to summary |
|---|---|
| public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable Implements java. Doc from java. Processes a method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.
| |