示例#1
0
 public String toJson(ObjectMapper mapper) {
   ObjectNode rootNode = mapper.createObjectNode();
   ArrayNode keysNode = rootNode.putArray("keys");
   for (Object key : keys) {
     keysNode.addPOJO(key);
   }
   try {
     return mapper.writeValueAsString(rootNode);
   } catch (Exception e) {
     throw Exceptions.propagate(e);
   }
 }
示例#2
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery endKey(Object o) {
   reset();
   try {
     endKey = mapper.writeValueAsString(o);
   } catch (Exception e) {
     throw Exceptions.propagate(e);
   }
   return this;
 }
 @SuppressWarnings("unchecked")
 @Override
 public String success(HttpResponse hr) throws Exception {
   Map<String, ?> rsp = objectMapper.readValue(hr.getContent(), Map.class);
   return (String) rsp.get(REVISION_FIELD_NAME);
 }
示例#4
0
 @Override
 public DocumentOperationResult success(HttpResponse hr) throws Exception {
   return objectMapper.readValue(hr.getContent(), DocumentOperationResult.class);
 }