Package org.apache.sling.api.wrappers
Class CompositeValueMap
- java.lang.Object
-
- org.apache.sling.api.wrappers.CompositeValueMap
-
- All Implemented Interfaces:
java.util.Map<java.lang.String,java.lang.Object>
,ValueMap
@Deprecated public class CompositeValueMap extends java.lang.Object implements ValueMap
Deprecated.UseValueMapUtil.merge(ValueMap...)
instead. Note that it does not support the parametermerge = false
. However, this could easily be achieved with another decorator that restricts the set of allowed keys.An implementation of theValueMap
based on twoValueMap
s: - One containing the properties - Another one containing the defaults to use in case the properties map does not contain the values. In case you would like to avoid duplicating properties on multiple resources, you can use aCompositeValueMap
to get a concatenated map of properties.- Since:
- 2.3 (Sling API Bundle 2.5.0)
-
-
Constructor Summary
Constructors Constructor Description CompositeValueMap(ValueMap properties, ValueMap defaults)
Deprecated.ConstructorCompositeValueMap(ValueMap properties, ValueMap defaults, boolean merge)
Deprecated.Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clear()
Deprecated.boolean
containsKey(java.lang.Object key)
Deprecated.boolean
containsValue(java.lang.Object value)
Deprecated.java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>>
entrySet()
Deprecated.<T> T
get(@NotNull java.lang.String name, @NotNull java.lang.Class<T> type)
Deprecated.Get a named property and convert it into the given type.<T> T
get(@NotNull java.lang.String name, T defaultValue)
Deprecated.Get a named property and convert it into the given type.java.lang.Object
get(java.lang.Object key)
Deprecated.boolean
isEmpty()
Deprecated.java.util.Set<java.lang.String>
keySet()
Deprecated.java.lang.Object
put(java.lang.String aKey, java.lang.Object value)
Deprecated.void
putAll(java.util.Map<? extends java.lang.String,?> properties)
Deprecated.java.lang.Object
remove(java.lang.Object key)
Deprecated.int
size()
Deprecated.java.util.Collection<java.lang.Object>
values()
Deprecated.
-
-
-
Constructor Detail
-
CompositeValueMap
public CompositeValueMap(ValueMap properties, ValueMap defaults)
Deprecated.Constructor
-
CompositeValueMap
public CompositeValueMap(ValueMap properties, ValueMap defaults, boolean merge)
Deprecated.Constructor- Parameters:
properties
- TheValueMap
to read fromdefaults
- The defaultValueMap
to use as fallbackmerge
- Merge flag - Iftrue
, getting a key would return the current property map's value (if available), even if the corresponding default does not exist. - Iffalse
, getting a key would returnnull
if the corresponding default does not exist
-
-
Method Detail
-
get
@Nullable public <T> T get(@NotNull @NotNull java.lang.String name, @NotNull @NotNull java.lang.Class<T> type)
Deprecated.Get a named property and convert it into the given type. This method does not support conversion into a primitive type or an array of a primitive type. It should returnnull
in this case.
-
get
@NotNull public <T> T get(@NotNull @NotNull java.lang.String name, @NotNull T defaultValue)
Deprecated.Get a named property and convert it into the given type. This method does not support conversion into a primitive type or an array of a primitive type. It should return the default value in this case.
Implementation hint: In the past it was allowed to call this with a 2nd parameter beingnull
. Therefore all implementations should internally callMap.get(Object)
when the 2nd parameter has valuenull
.- Specified by:
get
in interfaceValueMap
- Type Parameters:
T
- The expected type- Parameters:
name
- 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. Must not benull
. If you want to returnnull
by default rather rely onValueMap.get(String, Class)
.- Returns:
- Return named value converted to type T or the default value if non existing or can't be converted.
-
size
public int size()
Deprecated.- Specified by:
size
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
isEmpty
public boolean isEmpty()
Deprecated.- Specified by:
isEmpty
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
containsKey
public boolean containsKey(java.lang.Object key)
Deprecated.- Specified by:
containsKey
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
containsValue
public boolean containsValue(java.lang.Object value)
Deprecated.- Specified by:
containsValue
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
get
public java.lang.Object get(java.lang.Object key)
Deprecated.- Specified by:
get
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
put
public java.lang.Object put(java.lang.String aKey, java.lang.Object value)
Deprecated.- Specified by:
put
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
remove
public java.lang.Object remove(java.lang.Object key)
Deprecated.- Specified by:
remove
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
putAll
public void putAll(java.util.Map<? extends java.lang.String,?> properties)
Deprecated.- Specified by:
putAll
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
clear
public void clear()
Deprecated.- Specified by:
clear
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
keySet
public java.util.Set<java.lang.String> keySet()
Deprecated.- Specified by:
keySet
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
values
public java.util.Collection<java.lang.Object> values()
Deprecated.- Specified by:
values
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
entrySet
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
Deprecated.- Specified by:
entrySet
in interfacejava.util.Map<java.lang.String,java.lang.Object>
-
-