public class ReflectionUtils
extends java.lang.Object
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.reflect.Field |
getPrivateField(java.lang.Object owner,
java.lang.String fieldName)
Tries to find the field specified by fieldName in the class
hierarchy of the given owner.
|
static <T> T |
getPrivateFieldValue(java.lang.Object owner,
java.lang.String fieldName)
Returns the value of the specified private field for the given
owner.
|
static <T> void |
setPrivateFieldValue(java.lang.Object owner,
java.lang.String fieldName,
T value)
Sets the value of the specified private field for the given owner
to the given value.
|
public static <T> T getPrivateFieldValue(java.lang.Object owner,
java.lang.String fieldName)
T - The type of the field value.owner - Object from which the field is read.fieldName - Name of the field to read.public static java.lang.reflect.Field getPrivateField(java.lang.Object owner,
java.lang.String fieldName)
owner - Object from which the Field should be
extracted.fieldName - The name of the field.Field if it can be found, otherwise null.public static <T> void setPrivateFieldValue(java.lang.Object owner,
java.lang.String fieldName,
T value)
T - The type of the field value.owner - Object for which the field is set.fieldName - Name of the field.value - New value for the field.Copyright (c) 2014 itemis AG and others. All rights reserved.