Class CouchbaseMap<V>
- java.lang.Object
-
- java.util.AbstractMap<String,V>
-
- com.couchbase.client.java.datastructures.collections.CouchbaseMap<V>
-
- Type Parameters:
V
- the type of values in the map (restricted toJsonObject
.
@Committed @Public public class CouchbaseMap<V> extends AbstractMap<String,V>
A CouchbaseMap is aMap
backed by aCouchbase
document (more specifically aJSON object
). Null keys are NOT permitted, and keys are restricted toString
. Values in a CouchbaseMap are restricted to the types that aJSON objects
can contain. JSON sub-objects and sub-arrays can be represented asJsonObject
andJsonArray
respectively.- Since:
- 2.3.6
- Author:
- Simon Baslé, Subhashni Balakrishnan
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description CouchbaseMap(String id, Bucket bucket)
CouchbaseMap(String id, Bucket bucket, Map<String,? extends V> data)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(Object key)
boolean
containsValue(Object value)
Set<Map.Entry<String,V>>
entrySet()
V
get(Object key)
V
put(String key, V value)
V
remove(Object key)
int
size()
-
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, isEmpty, keySet, putAll, toString, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
CouchbaseMap
public CouchbaseMap(String id, Bucket bucket)
Create a newCouchbaseMap
, backed by the document identified byid
in the given Couchbasebucket
. Note that if the document already exists, its content will be used as initial content for this collection. Otherwise it is created empty.- Parameters:
id
- the id of the Couchbase document to back the map.bucket
- theBucket
through which to interact with the document.
-
CouchbaseMap
public CouchbaseMap(String id, Bucket bucket, Map<String,? extends V> data)
Create a newCouchbaseMap
, backed by the document identified byid
in the given Couchbasebucket
. Note that if the document already exists, its content is reset to the values copied from the givendata
Map. A null or empty data map will re-initialize any pre-existing document to an empty content.- Parameters:
id
- the id of the Couchbase document to back the list.bucket
- theBucket
through which to interact with the document.data
- Map of the elements to initially store in the CouchbaseMap.
-
-
Method Detail
-
clear
public void clear()
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap<String,V>
- Overrides:
containsKey
in classAbstractMap<String,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in interfaceMap<String,V>
- Overrides:
containsValue
in classAbstractMap<String,V>
-
-