E
- is the generic type of the elements contained in this map.public abstract class AdvancedClassHierarchyMap<E> extends AbstractClassHierarchyMap<E>
AbstractClassHierarchyMap
with the ability to replace elements (<E>) on
recursive puts
if the new element has a more
general
type
. getClass(Object)
.Constructor and Description |
---|
AdvancedClassHierarchyMap()
The constructor.
|
AdvancedClassHierarchyMap(MapFactory<Map> mapFactory)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Class<?> |
getClass(E element)
This method gets the associated
type for the given element . |
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(E element)
|
get, isAccepted, put
public AdvancedClassHierarchyMap()
public AdvancedClassHierarchyMap(MapFactory<Map> mapFactory)
mapFactory
- is the factory used to create the internal Map
.protected abstract Class<?> getClass(E element)
type
for the given element
.protected E put(E element)
element
- is the element to put.null
if none has been replaced.protected boolean isPreferable(E element, Class<?> elementType, E existing, Class<?> currentType)
AbstractClassHierarchyMap
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.isPreferable
in class AbstractClassHierarchyMap<E>
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
).Copyright © 2001–2016 mmm-Team. All rights reserved.