Class ClassHierarchyHelper
- java.lang.Object
-
- org.hibernate.validator.internal.util.classhierarchy.ClassHierarchyHelper
-
public class ClassHierarchyHelper extends Object
Helper class for dealing with inheritance hierarchies of given types which allows to selectively retrieve elements from such hierarchies, e.g. all super-classes, all implemented interfaces etc.- Author:
- Hardy Ferentschik, Gunnar Morling
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Set<Class<? super T>>getDirectlyImplementedInterfaces(Class<T> clazz)Gets all interfaces (and recursively their super-interfaces) which the given class directly implements.static <T> List<Class<? super T>>getHierarchy(Class<T> clazz, Filter... filters)Gets the elements of the hierarchy of the given class which match the given filters.
-
-
-
Method Detail
-
getHierarchy
public static <T> List<Class<? super T>> getHierarchy(Class<T> clazz, Filter... filters)
Gets the elements of the hierarchy of the given class which match the given filters. Classes are added by starting with the class itself and its implemented interfaces. Then its super class and interfaces are added and so on.- Type Parameters:
T- the type of the class- Parameters:
clazz- the class for which to retrieve the hierarchyfilters- filters applying for the search- Returns:
- List of hierarchy classes. Will only contain those types matching the given filters. The list contains the given class itself, if it is no proxy class.
-
getDirectlyImplementedInterfaces
public static <T> Set<Class<? super T>> getDirectlyImplementedInterfaces(Class<T> clazz)
Gets all interfaces (and recursively their super-interfaces) which the given class directly implements. Interfaces implemented by super-classes are not contained.- Type Parameters:
T- the type of the class- Parameters:
clazz- the class for which to retrieve the implemented interfaces- Returns:
- Set of all interfaces implemented by the class represented by this hierarchy. The empty list is returned if it does not implement any interfaces.
-
-