Class ReflectionUtils
java.lang.Object
ch.tocco.nice2.toolbox.api.reflect.ReflectionUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic Field
findDeclaredField
(Class clazz, String name) static <T> T
readDeclaredField
(Object instance, String fieldName, @Nullable Class<T> returnType) Returns the value of a declared field from an object using reflection.
-
Method Details
-
readDeclaredField
public static <T> T readDeclaredField(Object instance, String fieldName, @Nullable @Nullable Class<T> returnType) throws NoSuchFieldException, IllegalAccessException Returns the value of a declared field from an object using reflection. Declared fields of super classes are supported as well. -
findDeclaredField
Returns the declaredField
of aClass
. If the field is not found, the super classes are checked recursively.- Throws:
NoSuchFieldException
-