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.ValueMap
base
-
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)
void
clear()
boolean
containsKey(Object key)
boolean
containsValue(Object value)
@NotNull Set<Map.Entry<String,Object>>
entrySet()
<T> T
get(@NotNull String name, @NotNull Class<T> type)
<T> T
get(@NotNull String name, T defaultValue)
Object
get(Object key)
boolean
isEmpty()
@NotNull Set<String>
keySet()
@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 keyvoid
putAll(@NotNull Map<? extends String,?> m)
Object
remove(Object key)
int
size()
@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:
get
in interfaceorg.apache.sling.api.resource.ValueMap
-
get
@NotNull public <T> T get(@NotNull @NotNull String name, @NotNull T defaultValue)
- Specified by:
get
in interfaceorg.apache.sling.api.resource.ValueMap
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<String,Object>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in 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)
-
-