Maps Class objects to values. A ClassMap is different from a regular Map in
that get(c) does not only look to see if 'c' is a key in the Map, but also
walks the up superclass and interface graph of 'c' to find matches. Derived
matches of this sort are then "cached" in the registry so that matches are
faster on future gets.
This is a very useful class for Class based registries.
Example:
ClassMap m = new ClassMap(); m.put(Animal.class, "Animal");
m.put(Fox.class, "Fox"); m.Fox.class) --> "Fox" m.get(Dog.class) --> "Animal"
(assuming Dog.class < Animal.class)
public static <T> List<Class<?>> getAncestry(Class<T> c)
Walks superclass and interface graph, superclasses first, then
interfaces, to compute an ancestry list. Supertypes are visited left to
right. Duplicates are removed such that no Class will appear in the list
before one of its subtypes.