Class AccessHelper
java.lang.Object
software.xdev.spring.data.eclipse.store.repository.access.AccessHelper
Helps finding and handling
Fields.-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckAllFieldsForReadRestrictions(Class<?> clazz) static FieldgetInheritedPrivateField(Class<?> clazz, String fieldName) getInheritedPrivateFieldsByName(Class<?> clazz) static <T> ObjectreadFieldVariable(Field field, T sourceObject) Makes the given field of the given object readable/accessible and returns its value.
-
Method Details
-
getInheritedPrivateFieldsByName
- 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 returnnullbecause this should not happen during production.
-
readFieldVariable
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
-