List of usage examples for org.springframework.data.couchbase.core.mapping CouchbaseDocument put
public final CouchbaseDocument put(final String key, final Object value)
From source file:org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.java
/** * Helper method to decode an object recursively. * * @param parser the JSON parser with the content. * @param target the target where the content should be stored. * * @throws IOException/*from w w w. j a va 2 s . c om*/ * @returns the decoded object. */ private CouchbaseDocument decodeObject(final JsonParser parser, final CouchbaseDocument target) throws IOException { JsonToken currentToken = parser.nextToken(); String fieldName = ""; while (currentToken != null && currentToken != JsonToken.END_OBJECT) { if (currentToken == JsonToken.START_OBJECT) { target.put(fieldName, decodeObject(parser, new CouchbaseDocument())); } else if (currentToken == JsonToken.START_ARRAY) { target.put(fieldName, decodeArray(parser, new CouchbaseList())); } else if (currentToken == JsonToken.FIELD_NAME) { fieldName = parser.getCurrentName(); } else { target.put(fieldName, decodePrimitive(currentToken, parser)); } currentToken = parser.nextToken(); } return target; }