public class HierarchyNodeInheritanceValueMap extends ValueMapWrapper implements InheritanceValueMap
InheritanceValueMap for a given Resource that will inherit values from
ancestral pages.
For example, given: /content/parent/page/jcr:content/footer/image/@width,
the HierarchyNodeInheritanceValueMap will search for a footer/image/@width
property in:
/content/parent/page/jcr:content/footer/image/@width/content/parent/jcr:content/footer/image/@width/content/jcr:content/footer/image/@widthnull.
Note that HierarchyNodeInheritanceValueMap searches only the page
hierarchy. It will not (for instance), look in:
/content/parent/page/jcr:content/footer/@widthComponentInheritanceValueMap for that functionality.| Constructor and Description |
|---|
HierarchyNodeInheritanceValueMap(Resource resource)
Will wrap the
ValueMap returned by
resource.adaptTo(ValueMap.class), or use an empty map if
resource is null or if it doesn't adapt to a ValueMap. |
HierarchyNodeInheritanceValueMap(ValueMap map)
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
get(java.lang.String name,
java.lang.Class<T> type)
Get a named property and convert it into the given type.
|
<T> T |
getInherited(java.lang.String name,
java.lang.Class<T> type)
Get a named property and convert it into the given type, and take the
properties of parent resources / pages into account, if the property is
not found locally.
|
<T> T |
getInherited(java.lang.String name,
T defaultValue)
Get a named property and convert it into the given type, and take the
properties of parent resources / pages into account, if the property is
not found locally.
|
clear, containsKey, containsValue, entrySet, get, get, isEmpty, keySet, put, putAll, remove, size, toString, valuespublic HierarchyNodeInheritanceValueMap(Resource resource)
ValueMap returned by
resource.adaptTo(ValueMap.class), or use an empty map if
resource is null or if it doesn't adapt to a ValueMap. The
inheritance is internally resolved by fetching the parent resource and
wrapping it into an HierarchyNodeInheritanceValueMap as well.resource - the resource to start frompublic HierarchyNodeInheritanceValueMap(ValueMap map)
Resource for a ValueMap is not
available and no inheritance is needed. Using the inheritance-enabled
getter
methods will behave exactly like
the normal ValueMap getters.map - a ValueMap to wrappublic <T> T get(java.lang.String name,
java.lang.Class<T> type)
ValueMapnull in this
case.get in interface ValueMapget in class ValueMapWrapperT - The class of the typename - The name of the propertytype - The class of the typenull if
non existing or can't be converted.public <T> T getInherited(java.lang.String name,
java.lang.Class<T> type)
InheritanceValueMapThe exact inheritance mechanism depends on the implementation.
getInherited in interface InheritanceValueMapT - type parametername - The name of the propertytype - The class of the typenull if
non existing or can't be converted.public <T> T getInherited(java.lang.String name,
T defaultValue)
InheritanceValueMapThe exact inheritance mechanism depends on the implementation.
getInherited in interface InheritanceValueMapT - type parametername - The name of the propertydefaultValue - The default value to use if the named property does not exist
or cannot be converted to the requested type. The default
value is also used to define the type to convert the value to.
If this is null any existing property is not
converted.Copyright © 2010 - 2023 Adobe. All Rights Reserved