Package org.eclipse.gef.common.reflect
Class ReflectionUtils
- java.lang.Object
-
- org.eclipse.gef.common.reflect.ReflectionUtils
-
public class ReflectionUtils extends java.lang.Object
Allows to access the value of private fields.
-
-
Constructor Summary
Constructors Constructor Description ReflectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Method Detail
-
getPrivateFieldValue
public static <T> T getPrivateFieldValue(java.lang.Object owner, java.lang.String fieldName)
Returns the value of the specified private field for the given owner.- Type Parameters:
T
- The type of the field value.- Parameters:
owner
-Object
from which the field is read.fieldName
- Name of the field to read.- Returns:
- The value of the specified field for the given owner.
-
setPrivateFieldValue
public 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.- Type Parameters:
T
- The type of the field value.- Parameters:
owner
-Object
for which the field is set.fieldName
- Name of the field.value
- New value for the field.
-
-