Package com.helger.commons.lang
Class ClassHierarchyCache
- java.lang.Object
-
- com.helger.commons.lang.ClassHierarchyCache
-
@ThreadSafe public final class ClassHierarchyCache extends Object
A small class hierarchy cache- Author:
- Philip Helger
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static EChangeclearCache()It's important to clear the cache upon application shutdown, because for web applications, keeping a cache of classes may prevent the web application from unloadingstatic ICommonsSet<Class<?>>getClassHierarchy(Class<?> aClass)Get the complete super class hierarchy of the passed class including all super classes and all interfaces of the passed class and of all parent classes.static ICommonsIterable<WeakReference<Class<?>>>getClassHierarchyIterator(Class<?> aClass)Iterate the complete super class hierarchy of the passed class including all super classes and all interfaces of the passed class and of all parent classes.static ICommonsList<Class<?>>getClassHierarchyList(Class<?> aClass)Get the complete super class hierarchy of the passed class including all super classes and all interfaces of the passed class and of all parent classes.
-
-
-
Method Detail
-
clearCache
@Nonnull public static EChange clearCache()
It's important to clear the cache upon application shutdown, because for web applications, keeping a cache of classes may prevent the web application from unloading- Returns:
EChange
-
getClassHierarchy
@Nonnull @ReturnsMutableCopy public static ICommonsSet<Class<?>> getClassHierarchy(@Nonnull Class<?> aClass)
Get the complete super class hierarchy of the passed class including all super classes and all interfaces of the passed class and of all parent classes.- Parameters:
aClass- The source class to get the hierarchy from.- Returns:
- A non-
nulland non-empty Set containing the passed class and all super classes, and all super-interfaces.
-
getClassHierarchyList
@Nonnull @ReturnsMutableCopy public static ICommonsList<Class<?>> getClassHierarchyList(@Nonnull Class<?> aClass)
Get the complete super class hierarchy of the passed class including all super classes and all interfaces of the passed class and of all parent classes.- Parameters:
aClass- The source class to get the hierarchy from.- Returns:
- A non-
nulland non-empty list containing the passed class and all super classes, and all super-interfaces. Duplicates were already removed.
-
getClassHierarchyIterator
@Nonnull public static ICommonsIterable<WeakReference<Class<?>>> getClassHierarchyIterator(@Nonnull Class<?> aClass)
Iterate the complete super class hierarchy of the passed class including all super classes and all interfaces of the passed class and of all parent classes.- Parameters:
aClass- The source class to get the hierarchy from.- Returns:
- A non-
nulland non-empty list containing the passed class and all super classes, and all super-interfaces. Duplicates were already removed.
-
-