Class ClassReflectionUtil
- java.lang.Object
-
- org.zeroturnaround.javarebel.integration.util.ClassReflectionUtil
-
public abstract class ClassReflectionUtil extends Object
Class reflection helper methods.- Author:
- Rein Raudjärv
-
-
Constructor Summary
Constructors Constructor Description ClassReflectionUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Set<Class<?>>getClassHierarchies(Class<?>[] classes)static Set<Class<?>>getClassHierarchies(Collection<? extends Class<?>> classes)static Set<Class<?>>getClassHierarchy(Class<?> klass)static ObjectgetDeclaredFieldValue(Object target, String field)Get the value of a field on the given object.static Set<Class<?>>getInterfaces(Collection<Class<?>> classes)static voidsetDeclaredFieldValue(Object instance, String field, Object value)Set the value of a field on the given instance.
-
-
-
Method Detail
-
getClassHierarchy
public static Set<Class<?>> getClassHierarchy(Class<?> klass)
- Parameters:
klass- a root class.- Returns:
- a set containing the given class, the super classes, the interfaces and all the parent interfaces.
-
getClassHierarchies
public static Set<Class<?>> getClassHierarchies(Class<?>[] classes)
- Parameters:
classes- root classes.- Returns:
- a set containing the given classes, the super classes, the interfaces and all the parent interfaces.
-
getClassHierarchies
public static Set<Class<?>> getClassHierarchies(Collection<? extends Class<?>> classes)
- Parameters:
classes- root classes.- Returns:
- a set containing the given classes, the super classes, the interfaces and all the parent interfaces.
-
getInterfaces
public static Set<Class<?>> getInterfaces(Collection<Class<?>> classes)
- Parameters:
classes- a set of classes.- Returns:
- a set containing interfaces of each class.
-
setDeclaredFieldValue
public static void setDeclaredFieldValue(Object instance, String field, Object value) throws NoSuchFieldException, IllegalAccessException
Set the value of a field on the given instance. The field must be declared by the class of the instance. The field is made accessible before being set.
-
getDeclaredFieldValue
public static Object getDeclaredFieldValue(Object target, String field) throws NoSuchFieldException, IllegalAccessException
Get the value of a field on the given object. The field must be declared by the class of the given object. The field is made accessible before being read.
-
-