public class CompositeValueMap extends java.lang.Object implements ValueMap
ValueMap
based on two ValueMap
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 a CompositeValueMap
to get a concatenated map of
properties.Constructor and Description |
---|
CompositeValueMap(ValueMap properties,
ValueMap defaults)
Constructor
|
CompositeValueMap(ValueMap properties,
ValueMap defaults,
boolean merge)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet() |
java.lang.Object |
get(java.lang.Object key) |
<T> T |
get(java.lang.String key,
java.lang.Class<T> type)
Get a named property and convert it into the given type.
|
<T> T |
get(java.lang.String key,
T defaultValue)
Get a named property and convert it into the given type.
|
boolean |
isEmpty() |
java.util.Set<java.lang.String> |
keySet() |
java.lang.Object |
put(java.lang.String aKey,
java.lang.Object value) |
void |
putAll(java.util.Map<? extends java.lang.String,?> properties) |
java.lang.Object |
remove(java.lang.Object key) |
int |
size() |
java.util.Collection<java.lang.Object> |
values() |
public CompositeValueMap(ValueMap properties, ValueMap defaults, boolean merge)
properties
- The ValueMap
to read fromdefaults
- The default ValueMap
to use as fallbackmerge
- Merge flag
- If true
, getting a key would return the
current property map's value (if available), even if the
corresponding default does not exist.
- If false
, getting a key would return
null
if the corresponding default does not
existpublic <T> T get(java.lang.String key, java.lang.Class<T> type)
null
in this
case.public <T> T get(java.lang.String key, T defaultValue)
null
.
Therefore all implementations should internally call Map.get(Object)
when the 2nd parameter
has value null
.get
in interface ValueMap
T
- The expected typekey
- 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 be null
. If you want to return null
by default
rather rely on ValueMap.get(String, Class)
.public int size()
size
in interface java.util.Map<java.lang.String,java.lang.Object>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.String,java.lang.Object>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.String,java.lang.Object>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.lang.Object put(java.lang.String aKey, java.lang.Object value)
put
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.String,java.lang.Object>
public void putAll(java.util.Map<? extends java.lang.String,?> properties)
putAll
in interface java.util.Map<java.lang.String,java.lang.Object>
public void clear()
clear
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Collection<java.lang.Object> values()
values
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.lang.Object>
Copyright © 2010 - 2020 Adobe. All Rights Reserved