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); } }
/** * @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); }
@Override public DocumentOperationResult success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), DocumentOperationResult.class); }