|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mmm.util.collection.base.AbstractClassHierarchieMap<E>
E - is the generic type of the elements contained in this map.public abstract class AbstractClassHierarchieMap<E>
This is the abstract base class for a simplified Map that associates
elements (<E>) with Class objects.
| Field Summary | |
|---|---|
private Map<Class<?>,E> |
classMap
|
| Constructor Summary | |
|---|---|
AbstractClassHierarchieMap()
The constructor. |
|
AbstractClassHierarchieMap(MapFactory<Map> mapFactory)
The constructor. |
|
| Method Summary | |
|---|---|
E |
get(Class<?> type)
This method gets the element that has been registered for the given type or a sub-type. |
protected boolean |
isAccepted(Class<?> type)
This method determines whether the given type is accepted in
the hierarchy. |
protected boolean |
isPreferable(E element,
Class<?> elementType,
E existing,
Class<?> currentType)
This method determines if the given element should be
associated with currentType in preference
to the element existing that is already registered and will be
replaced according to the result of this method. |
protected E |
put(Class<?> type,
E element)
This method registers the given element for the given
type. |
private void |
putRecursive(Class<?> type,
E element,
Class<?> elementType)
This method performs the put recursively. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final Map<Class<?>,E> classMap
get(Class)| Constructor Detail |
|---|
public AbstractClassHierarchieMap()
public AbstractClassHierarchieMap(MapFactory<Map> mapFactory)
mapFactory - is the factory used to create the internal Map.| Method Detail |
|---|
public E get(Class<?> type)
registered for the given type or a sub-type.
type - is the Class for which the associated element is
requested.
null if no element
is registered for the given
type.
protected boolean isPreferable(E element,
Class<?> elementType,
E existing,
Class<?> currentType)
element should be
associated with currentType in preference
to the element existing that is already registered and will be
replaced according to the result of this method.
element - is the element to register.elementType - is the type for which the given element is
to be registered originally.existing - is the element that has already been registered before and
is associated with currentType.currentType - is the registration type.
true if the given element is preferable
and should replace existing for
currentType, false otherwise (if
existing should remain associated
with currentType).
protected E put(Class<?> type,
E element)
element for the given
type. Unlike a regular Map this method will also
recursively put the given element for all
super-classes and
super-interfaces of the given
type.
type - is the Class used as key to associate the given
element.element - is the element to put.
type and has NOW been replaced with
element.Map.put(Object, Object)
private void putRecursive(Class<?> type,
E element,
Class<?> elementType)
put recursively.
type - is the current Class used as key to associate the given
element.element - is the element to put.elementType - is the the type of the original
put.protected boolean isAccepted(Class<?> type)
type is accepted in
the hierarchy.marker-interfaces).
type - is the Class reflecting the type to check.
true if the given type should be
accepted, false to ignore type.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||