K - Key type of the map.
The type must have toString(), which can uniquely identify the entry.V - Value typepublic class CMap<K,V> extends Object
| Constructor and Description |
|---|
CMap(org.onosproject.store.service.DatabaseAdminService dbAdminService,
org.onosproject.store.service.DatabaseService dbService,
String tableName,
org.onosproject.store.serializers.StoreSerializer serializer)
Creates a CMap instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected V |
dV(byte[] valBytes) |
V |
get(K key)
Gets the value in the map.
|
V |
put(K key,
V value)
Puts a value int the map.
|
boolean |
putIfAbsent(K key,
V value)
Puts an entry to the map, if not already present.
|
V |
remove(K key)
Removes an entry associated to specified key.
|
boolean |
replace(K key,
V oldVal,
V newVal)
Replaces the value in the map if the value matches the expected.
|
long |
size()
Returns the size of the map.
|
protected String |
sK(K key) |
protected byte[] |
sV(V val) |
Iterable<V> |
values()
Returns all the values contained in the map.
|
public CMap(org.onosproject.store.service.DatabaseAdminService dbAdminService,
org.onosproject.store.service.DatabaseService dbService,
String tableName,
org.onosproject.store.serializers.StoreSerializer serializer)
dbAdminService - DatabaseAdminService to use for this instancedbService - DatabaseService to use for this instancetableName - table which this Map corresponds toserializer - Value serializerprotected byte[] sV(V val)
protected V dV(byte[] valBytes)
public boolean putIfAbsent(K key, V value)
key - the key of the value to put if absentvalue - the value to be put if previous value does not existpublic V remove(K key)
key - key of the value to removepublic long size()
public Iterable<V> values()
public V get(K key)
key - to get from the mappublic boolean replace(K key, V oldVal, V newVal)
key - of the entry to replaceoldVal - value expected to be in the mapnewVal - value to be replaced withCopyright © 2014. All rights reserved.