Class ReflectionUtils

java.lang.Object
org.eclipse.gef.common.reflect.ReflectionUtils

public class ReflectionUtils extends Object
Allows to access the value of private fields.
  • Constructor Details

    • ReflectionUtils

      public ReflectionUtils()
  • Method Details

    • getPrivateFieldValue

      public static <T> T getPrivateFieldValue(Object owner, 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(Object owner, 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.