@Value.Check void validate() { if (isBlocking()) { checkArgument(getIndex().isPresent(), "If wait is specified, index must also be specified"); } }
@Override public Map<String, Object> toQuery() { Map<String, Object> result = new HashMap<>(); switch (getConsistencyMode()) { case CONSISTENT: result.put("consistent", ""); break; case STALE: result.put("stale", ""); break; } if (isBlocking()) { optionallyAdd(result, "wait", getWait()); optionallyAdd(result, "index", getIndex()); } optionallyAdd(result, "token", getToken()); optionallyAdd(result, "near", getNear()); optionallyAdd(result, "dc", getDatacenter()); return result; } }