Top Description Constructors Methods
org.hibernate.validator.internal.util.classhierarchy

public Class ClassHierarchyHelper

extends Object
Class Inheritance
Imports
java.util.Arrays, .List, .Set, org.hibernate.validator.internal.util.Contracts

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.
Authors
Hardy Ferentschik, Gunnar Morling

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean
public static <
the type of the class
T
>
Set<Class<? super T>>

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.
getDirectlyImplementedInterfaces
(Class<T>
the class for which to retrieve the implemented interfaces
clazz
)

Gets all interfaces (and recursively their super-interfaces) which the given class directly implements.

public static <
the type of the class
T
>
List<Class<? super T>>

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.
getHierarchy
(Class<T>
the class for which to retrieve the hierarchy
clazz
,
Filter...
filters applying for the search
filters
)

Gets the elements of the hierarchy of the given class which match the given filters.

private static <T> void
getHierarchy(Class<? super T>
the class to start the search with
clazz
,
List<Class<? super T>>
list of classes to which to add all found super types matching the given filters
classes
,
Iterable<Filter>
filters applying for the search
filters
)

Retrieves all superclasses and interfaces recursively.

private static <T> void
getImplementedInterfaces(Class<? super T> clazz, Set<Class<? super T>> classes)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ClassHierarchyHelperback to summary
private ClassHierarchyHelper()

Method Detail

acceptedByAllFiltersback to summary
private static boolean acceptedByAllFilters(Class<?> clazz, Iterable<Filter> filters)
getDirectlyImplementedInterfacesback to summary
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.

Parameters
<T>
the type of the class
clazz:Class<T>

the class for which to retrieve the implemented interfaces

Returns:Set<Class<? super T>>

Set of all interfaces implemented by the class represented by this hierarchy. The empty list is returned if it does not implement any interfaces.

getHierarchyback to summary
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.

Parameters
<T>
the type of the class
clazz:Class<T>

the class for which to retrieve the hierarchy

filters:Filter[]

filters applying for the search

Returns:List<Class<? super T>>

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.

getHierarchyback to summary
private static <T> void getHierarchy(Class<? super T> clazz, List<Class<? super T>> classes, Iterable<Filter> filters)

Retrieves all superclasses and interfaces recursively.

Parameters
clazz:Class<? super T>

the class to start the search with

classes:List<Class<? super T>>

list of classes to which to add all found super types matching the given filters

filters:Iterable<Filter>

filters applying for the search

getImplementedInterfacesback to summary
private static <T> void getImplementedInterfaces(Class<? super T> clazz, Set<Class<? super T>> classes)