E - is the generic type of the elements contained in this map.public abstract class AbstractClassHierarchyMap<E> extends Object
Map that associates elements (<E>) with
Class objects.| Constructor and Description |
|---|
AbstractClassHierarchyMap()
The constructor.
|
AbstractClassHierarchyMap(MapFactory<Map> mapFactory)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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. |
public AbstractClassHierarchyMap()
public AbstractClassHierarchyMap(MapFactory<Map> mapFactory)
mapFactory - is the factory used to create the internal Map.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.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.Copyright © 2001–2016 mmm-Team. All rights reserved.