Class MergingValueMap
- java.lang.Object
-
- org.apache.sling.api.wrappers.impl.MergingValueMap
-
public class MergingValueMap extends Object implements ValueMap
Merge providedValueMapsinto a single viewValueMapthat aggregates all key-value pairs of the given maps. The value for a key-value pair is taken from the firstValueMap(in iteration order) that has a mapping for the given key.
In case you would like to avoid duplicating properties on multiple resources, you can use ato get a concatenated map of properties.MergingValueMap
-
-
Constructor Summary
Constructors Constructor Description MergingValueMap(@NotNull List<ValueMap> valueMaps)Constructor that allows merging any number ofValueMapinstances into a singleValueMapview.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)@NotNull Set<Map.Entry<String,Object>>entrySet()Objectget(Object key)booleanisEmpty()@NotNull Set<String>keySet()Objectput(String aKey, Object value)voidputAll(Map<? extends String,?> properties)Objectremove(Object key)intsize()@NotNull Collection<Object>values()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
MergingValueMap
public MergingValueMap(@NotNull @NotNull List<ValueMap> valueMaps)Constructor that allows merging any number ofValueMapinstances into a singleValueMapview. The keys of the view are the union of the keys of all value maps. The values of the view is the mapping of all keys to their respective value. The entries are the key-value pairs. Values are retrieved by getting the value for a key for eachValueMapuntil a non-null value is found.- Parameters:
valueMaps- The ValueMaps to be merged.- See Also:
ValueMapUtil.merge(List),ValueMapUtil.merge(ValueMap...)
-
-
Method Detail
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<String,Object>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<String,Object>
-
values
@NotNull public @NotNull Collection<Object> values()
-
-