public final class ReflectionUtil
extends java.lang.Object
限定符和类型 | 方法和说明 |
---|---|
static java.lang.Throwable |
trySetAccessible(java.lang.reflect.AccessibleObject object,
boolean checkAccessible)
Try to call
AccessibleObject.setAccessible(boolean) but will catch any SecurityException and
java.lang.reflect.InaccessibleObjectException and return it. |
public static java.lang.Throwable trySetAccessible(java.lang.reflect.AccessibleObject object, boolean checkAccessible)
AccessibleObject.setAccessible(boolean)
but will catch any SecurityException
and
java.lang.reflect.InaccessibleObjectException
and return it.
The caller must check if it returns null
and if not handle the returned exception.