public class CouchbaseList extends Object implements CouchbaseStorable
CouchbaseList is an abstract list that represents an array stored in a (most of the times JSON) document.
This CouchbaseList is part of the potentially nested structure inside one or more CouchbaseDocuments.
It can also contain them recursively, depending on how the document is modeled.
| Constructor and Description |
|---|
CouchbaseList()
Create a new (empty) list.
|
CouchbaseList(List<Object> initialPayload)
Create a new list with a given payload on construction.
|
CouchbaseList(List<Object> initialPayload,
SimpleTypeHolder simpleTypeHolder)
Create a new list with a given payload on construction and an existing
SimpleTypeHolder. |
CouchbaseList(SimpleTypeHolder simpleTypeHolder)
Create a new (empty) list with an existing
SimpleTypeHolder. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsValue(Object value)
Returns true if it contains the given value.
|
List<Object> |
export()
Returns the current payload, including all recursive elements.
|
Object |
get(int index)
Return the stored element at the given index.
|
boolean |
isEmpty()
Checks if the underlying payload is empty or not.
|
CouchbaseList |
put(Object value)
Add content to the underlying list.
|
int |
size()
Returns the size of the attributes in this document (not nested).
|
int |
size(boolean recursive)
Retruns the size of the attributes in this and recursive documents.
|
String |
toString()
A string reprensation of the payload.
|
public CouchbaseList()
public CouchbaseList(List<Object> initialPayload)
initialPayload - the initial data to store.public CouchbaseList(SimpleTypeHolder simpleTypeHolder)
SimpleTypeHolder.simpleTypeHolder - context instance.public CouchbaseList(List<Object> initialPayload, SimpleTypeHolder simpleTypeHolder)
SimpleTypeHolder.initialPayload - the initial data to store.simpleTypeHolder - context instance.public final CouchbaseList put(Object value)
value - the value to be added.CouchbaseList object for chaining purposes.public final Object get(int index)
index - the index where the document is located.public final int size()
public final int size(boolean recursive)
recursive - wheter nested attributes should be taken into account.public final List<Object> export()
It either returns the raw results or makes sure that the recusrive elements are also exported properly.
public final boolean containsValue(Object value)
value - the value to check for.public final boolean isEmpty()
Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.