public final class ReflectUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> T |
getValue(Field field,
Object self)
Sets the specified field value while wrapping checked exception in a
ShedException . |
static <T> T |
invoke(Method method,
Object self,
Object... args)
Invokes the specified method while wrapping checked exception in a
ShedException . |
static <T extends AccessibleObject> |
makeAccessible(T accessibleObject)
Makes an
AccessibleObject accessible by invoking
AccessibleObject.setAccessible(boolean)
in a PrivilegedAction . |
static void |
setValue(Field field,
Object self,
Object value)
Sets the specified value into the specified field while wrapping checked exception in a
ShedException . |
public static <T extends AccessibleObject> T makeAccessible(T accessibleObject)
AccessibleObject
accessible by invoking
AccessibleObject.setAccessible(boolean)
in a PrivilegedAction
.T
- the type of object.accessibleObject
- the object to make accessible.public static <T> T invoke(Method method, Object self, Object... args)
ShedException
.T
- the type of the return value.method
- the method.self
- the instance to invoke the method on.args
- the method arguments.public static void setValue(Field field, Object self, Object value)
ShedException
.field
- the field.self
- the instance to set the field on.value
- the value to set.Copyright © 2013-2018–2019 SeedStack. All rights reserved.