Package com.composum.sling.core.util
Class StructuredValueMap
- java.lang.Object
-
- com.composum.sling.core.util.StructuredValueMap
-
public class StructuredValueMap extends Object implements org.apache.sling.api.resource.ValueMap
A ValueMap which supports nested maps and resolves paths to properties of nested maps. This is useful if you want to use placeholders for a complex set of values, e.g. in a ValueEmbeddingReader. You can use either a path (delimiter: '/') or an object (delimiter: '.') notation, e.g. ${nested/immediate/prop} or ${nested.immediate.prop}. the path notation has precedence over the object notation, e.g. ${nested/prop.name} references the 'prop.name' property of the 'nested' map.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.sling.api.resource.ValueMapbase
-
Constructor Summary
Constructors Constructor Description StructuredValueMap(Map<String,Object> base)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean_containsKey(@NotNull String name)protected boolean_containsKey(@NotNull String name, @NotNull Map<String,Object> map, @NotNull String delimiter)protected boolean_containsValue(@NotNull Object value)protected boolean_containsValue(@NotNull Object value, @NotNull Map<String,Object> map)protected Object_get(@NotNull String name, @Nullable Class<?> type)protected Object_get(@NotNull String name, @Nullable Class<?> type, @NotNull Map<String,Object> map, @NotNull String delimiter)protected Object_get(@NotNull Map<String,Object> map, @NotNull String name, @Nullable Class<?> type)protected void_keySet(Map<String,Object> map, Set<String> result, String prefix)protected Object_put(@NotNull String name, @Nullable Object value)protected Object_put(@NotNull String name, @Nullable Object value, @NotNull Map<String,Object> map, @NotNull String delimiter)protected Object_remove(@NotNull String name)protected Object_remove(@NotNull String name, @NotNull Map<String,Object> map, @NotNull String delimiter)protected int_size(Map<String,Object> map)protected void_values(Map<String,Object> map, Collection<Object> result)voidclear()booleancontainsKey(Object key)booleancontainsValue(Object value)@NotNull Set<Map.Entry<String,Object>>entrySet()<T> Tget(@NotNull String name, @NotNull Class<T> type)<T> Tget(@NotNull String name, T defaultValue)Objectget(Object key)booleanisEmpty()@NotNull Set<String>keySet()@Nullable Objectput(String key, Object value)puts a new value at the path given by the name; if path starts with '/' the path delimiter is used to build nested maps but ignored in the keyvoidputAll(@NotNull Map<? extends String,?> m)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
-
-
-
-
Method Detail
-
get
public <T> T get(@NotNull @NotNull String name, @NotNull @NotNull Class<T> type)- Specified by:
getin interfaceorg.apache.sling.api.resource.ValueMap
-
get
@NotNull public <T> T get(@NotNull @NotNull String name, @NotNull T defaultValue)- Specified by:
getin interfaceorg.apache.sling.api.resource.ValueMap
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<String,Object>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<String,Object>
-
put
@Nullable public @Nullable Object put(String key, Object value)
puts a new value at the path given by the name; if path starts with '/' the path delimiter is used to build nested maps but ignored in the key
-
values
@NotNull public @NotNull Collection<Object> values()
-
_get
protected Object _get(@NotNull @NotNull String name, @Nullable @Nullable Class<?> type, @NotNull @NotNull Map<String,Object> map, @NotNull @NotNull String delimiter)
-
_get
protected Object _get(@NotNull @NotNull Map<String,Object> map, @NotNull @NotNull String name, @Nullable @Nullable Class<?> type)
-
_put
protected Object _put(@NotNull @NotNull String name, @Nullable @Nullable Object value, @NotNull @NotNull Map<String,Object> map, @NotNull @NotNull String delimiter)
-
_remove
protected Object _remove(@NotNull @NotNull String name, @NotNull @NotNull Map<String,Object> map, @NotNull @NotNull String delimiter)
-
_values
protected void _values(Map<String,Object> map, Collection<Object> result)
-
_containsKey
protected boolean _containsKey(@NotNull @NotNull String name)
-
_containsKey
protected boolean _containsKey(@NotNull @NotNull String name, @NotNull @NotNull Map<String,Object> map, @NotNull @NotNull String delimiter)
-
_containsValue
protected boolean _containsValue(@NotNull @NotNull Object value)
-
-