Package io.netty.util.internal
Class ReflectionUtil
- java.lang.Object
-
- io.netty.util.internal.ReflectionUtil
-
public final class ReflectionUtil extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Class<?>
resolveTypeParameter(java.lang.Object object, java.lang.Class<?> parametrizedSuperclass, java.lang.String typeParamName)
Resolve a type parameter of a class that is a subclass of the given parametrized superclass.static java.lang.Throwable
trySetAccessible(java.lang.reflect.AccessibleObject object, boolean checkAccessible)
Try to callAccessibleObject.setAccessible(boolean)
but will catch anySecurityException
andInaccessibleObjectException
and return it.
-
-
-
Method Detail
-
trySetAccessible
public static java.lang.Throwable trySetAccessible(java.lang.reflect.AccessibleObject object, boolean checkAccessible)
Try to callAccessibleObject.setAccessible(boolean)
but will catch anySecurityException
andInaccessibleObjectException
and return it. The caller must check if it returnsnull
and if not handle the returned exception.
-
resolveTypeParameter
public static java.lang.Class<?> resolveTypeParameter(java.lang.Object object, java.lang.Class<?> parametrizedSuperclass, java.lang.String typeParamName)
Resolve a type parameter of a class that is a subclass of the given parametrized superclass.- Parameters:
object
- The object to resolve the type parameter forparametrizedSuperclass
- The parametrized superclasstypeParamName
- The name of the type parameter to resolve- Returns:
- The resolved type parameter
- Throws:
java.lang.IllegalStateException
- if the type parameter could not be resolved
-
-