Example usage for org.springframework.data.couchbase.core.mapping CouchbaseList put

List of usage examples for org.springframework.data.couchbase.core.mapping CouchbaseList put

Introduction

In this page you can find the example usage for org.springframework.data.couchbase.core.mapping CouchbaseList put.

Prototype

public final CouchbaseList put(final Object value) 

Source Link

Document

Add content to the underlying list.

Usage

From source file:org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.java

/**
 * Helper method to decode an array recusrively.
 *
 * @param parser the JSON parser with the content.
 * @param target the target where the content should be stored.
 *
 * @throws IOException//w w  w  .  j  a v a2s  . com
 * @returns the decoded list.
 */
private CouchbaseList decodeArray(final JsonParser parser, final CouchbaseList target) throws IOException {
    JsonToken currentToken = parser.nextToken();

    while (currentToken != null && currentToken != JsonToken.END_ARRAY) {
        if (currentToken == JsonToken.START_OBJECT) {
            target.put(decodeObject(parser, new CouchbaseDocument()));
        } else if (currentToken == JsonToken.START_ARRAY) {
            target.put(decodeArray(parser, new CouchbaseList()));
        } else {
            target.put(decodePrimitive(currentToken, parser));
        }

        currentToken = parser.nextToken();
    }

    return target;
}