java.lang.Object
software.xdev.spring.data.eclipse.store.repository.access.AccessHelper

public final class AccessHelper extends Object
Helps finding and handling Fields.
  • Method Details

    • getInheritedPrivateFieldsByName

      public static Map<String,Field> getInheritedPrivateFieldsByName(Class<?> clazz)
      Parameters:
      clazz - where to look for fields.
      Returns:
      all the fields defined in the given class and all its parent classes.
    • getInheritedPrivateField

      public static Field getInheritedPrivateField(Class<?> clazz, String fieldName) throws NoSuchFieldException
      Parameters:
      clazz - where the field is searched in.
      fieldName - of the field that is searched in the class.
      Returns:
      Not only the field with a specific name in the given class but also finds the field if it is inherited from some parent class.
      Throws:
      NoSuchFieldException - if the field is not existing. It does not return null because this should not happen during production.
    • readFieldVariable

      public static <T> Object readFieldVariable(Field field, T sourceObject)
      Makes the given field of the given object readable/accessible and returns its value. After reading the value the field is made unreadable/inaccessible again (if it was unreadable before).
    • checkAllFieldsForReadRestrictions

      public static void checkAllFieldsForReadRestrictions(Class<?> clazz)