|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jibx.util.ChainedMap
public class ChainedMap
Partial implementation of Map which provides a merged view of a defaults map with an overrides map.
Although this can be used as a map for most purposes, methods which return live views of the keys or values in the
map only take into account the overrides, not the defaults.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
ChainedMap(Map defaults)
Constructor. |
|
| Method Summary | |
|---|---|
void |
clear()
Clear all override key-value pairs. |
boolean |
containsKey(Object key)
Check if a key has a defined value. |
boolean |
containsValue(Object value)
Check if a value is present. |
Set |
entrySet()
Get the set of entries. |
Object |
get(Object key)
Get value for key. |
boolean |
isEmpty()
Check if no overrides are defined. |
Set |
keySet()
Get the set of keys. |
Object |
put(Object key,
Object value)
Set an override value. |
void |
putAll(Map map)
Add all key-value pairs from another map into the overrides map. |
Object |
remove(Object key)
Remove a key-value pair. |
int |
size()
Get the number of entries in the map. |
Collection |
values()
Get the 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 |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public ChainedMap(Map defaults)
defaults - map providing defaults for keys not set directly| Method Detail |
|---|
public void clear()
clear in interface Mappublic boolean containsKey(Object key)
true if the key is present in the overrides map
with a non-null value, or if the key is not present in the overrides map but is present in the defaults map.
containsKey in interface Mapkey -
true if key defined, false if notpublic boolean containsValue(Object value)
containsValue in interface Mapvalue -
true if value present as an override, false if notpublic Set entrySet()
entrySet in interface Mappublic Object get(Object key)
get in interface Mapkey -
null if key not present)public boolean isEmpty()
isEmpty in interface Maptrue if no overrides, false if any presentpublic Set keySet()
keySet in interface Map
public Object put(Object key,
Object value)
put in interface Mapkey - value -
public void putAll(Map map)
putAll in interface Mapmap - public Object remove(Object key)
remove in interface Mapkey -
public int size()
size in interface Mappublic Collection values()
values in interface Map
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||