|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jminor.common.model.valuemap.ValueMapImpl<K,V>
K
- the key typeV
- the value typepublic class ValueMapImpl<K,V>
A default ValueMap implementation.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.jminor.common.model.valuemap.ValueMap |
---|
ValueMap.ToString<K> |
Constructor Summary | |
---|---|
ValueMapImpl()
|
Method Summary | |
---|---|
void |
clear()
Removes all values from this map. |
boolean |
containsValue(K key)
Returns true if this ValueMap contains a value for the given key, that value can be null. |
V |
copyValue(V value)
Returns a deep copy of the given value, immutable values are simply returned. |
boolean |
equals(Object obj)
Two ValueMapImpl objects are equal if they contain the same number of values and all their values are equal. |
V |
getValue(K key)
Retrieves the value mapped to the given key |
String |
getValueAsString(K key)
Retrieves the value mapped to the given key as a String |
Collection<K> |
getValueKeys()
|
Collection<V> |
getValues()
Retrieves the values associated with this value provider. |
protected void |
handleClear()
Called after the value map has been cleared. |
protected void |
handleValueRemoved(K key,
V value)
Called after a value has been removed from this map. |
protected void |
handleValueSet(K key,
V value,
V previousValue,
boolean initialization)
Called after a value has been set. |
int |
hashCode()
|
boolean |
isValueNull(K key)
Returns true if a null value is mapped to the given key. |
V |
removeValue(K key)
Removes the given key and value from this value map along with the original value if any. |
V |
setValue(K key,
V value)
Maps the given value to the given key, returning the old value if any. |
int |
size()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ValueMapImpl()
Method Detail |
---|
public boolean isValueNull(K key)
isValueNull
in interface ValueMap<K,V>
key
- the key
public V setValue(K key, V value)
setValue
in interface ValueMap<K,V>
key
- the keyvalue
- the value
public V getValue(K key)
getValue
in interface ValueProvider<K,V>
key
- the key
public String getValueAsString(K key)
getValueAsString
in interface ValueAsStringProvider<K>
key
- the key
public V copyValue(V value)
copyValue
in interface ValueMap<K,V>
value
- the value to copy
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public final boolean containsValue(K key)
containsValue
in interface ValueMap<K,V>
key
- the key
public final V removeValue(K key)
removeValue
in interface ValueMap<K,V>
key
- the key to remove
public final Collection<K> getValueKeys()
getValueKeys
in interface ValueMap<K,V>
public final void clear()
clear
in interface ValueMap<K,V>
public final int size()
size
in interface ValueMap<K,V>
public final Collection<V> getValues()
getValues
in interface ValueCollectionProvider<V>
getValues
in interface ValueMap<K,V>
protected void handleValueSet(K key, V value, V previousValue, boolean initialization)
key
- the keyvalue
- the valuepreviousValue
- the previous valueinitialization
- true if the value was being initializedprotected void handleValueRemoved(K key, V value)
key
- the keyvalue
- the value that was removedprotected void handleClear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |