@Test public void testFromJson() throws IOException { RValueExpression expResult = new RValueExpression(Path.ANYPATH); RValueExpression result = RValueExpression.fromJson(JsonUtils.json("{\"$valueof\":\"*\"}")); assertEquals(expResult, result); }
public static RValueExpression fromJson(JsonNode node) { if (node instanceof ObjectNode) { if (node.size() == 1) { JsonNode path = node.get("$valueof"); if (path != null && path.isValueNode()) { return new RValueExpression(new Path(path.asText())); } else { return new RValueExpression(new Value(node)); } } else { return new RValueExpression(new Value(node)); } } if (node instanceof ArrayNode) { return new RValueExpression(new Value(node)); } else if (node.isValueNode()) { if (node.asText().equals("$null")) { return NULL; } else { return new RValueExpression(Value.fromJson(node)); } } throw Error.get(QueryConstants.ERR_INVALID_RVALUE_EXPRESSION, node.toString()); }
RValueExpression extends JsonObject { public static RValueExpression fromJson(JsonNode node) { if (node instanceof ObjectNode) { if (node.size() == 1) { JsonNode path = node.get("$valueof"); if (path != null && path.isValueNode()) { return new RValueExpression(new Path(path.asText())); } else { return new RValueExpression(new Value(node)); } } else { return new RValueExpression(new Value(node)); } } if (node instanceof ArrayNode) { return new RValueExpression(new Value(node)); } else if (node.isValueNode()) { if (node.asText().equals("$null")) { return NULL; } else { return new RValueExpression(Value.fromJson(node)); } } throw Error.get(QueryConstants.ERR_INVALID_RVALUE_EXPRESSION, node.toString()); } }
RValueExpression extends JsonObject { public static RValueExpression fromJson(JsonNode node) { if (node instanceof ObjectNode) { if (node.size() == 1) { JsonNode path = node.get("$valueof"); if (path != null && path.isValueNode()) { return new RValueExpression(new Path(path.asText())); } else { return new RValueExpression(new Value(node)); } } else { return new RValueExpression(new Value(node)); } } if (node instanceof ArrayNode) { return new RValueExpression(new Value(node)); } else if (node.isValueNode()) { if (node.asText().equals("$null")) { return NULL; } else { return new RValueExpression(Value.fromJson(node)); } } throw Error.get(QueryConstants.ERR_INVALID_RVALUE_EXPRESSION, node.toString()); } RValueExpression(Value value);  RValueExpression(Path p); private  RValueExpression(Value value, Path path, RValueType type); }
RValueExpression extends JsonObject { public static RValueExpression fromJson(JsonNode node) { if (node instanceof ObjectNode) { if (node.size() == 1) { JsonNode path = node.get("$valueof"); if (path != null && path.isValueNode()) { return new RValueExpression(new Path(path.asText())); } else { return new RValueExpression(new Value(node)); } } else { return new RValueExpression(new Value(node)); } } if (node instanceof ArrayNode) { return new RValueExpression(new Value(node)); } else if (node.isValueNode()) { if (node.asText().equals("$null")) { return NULL; } else { return new RValueExpression(Value.fromJson(node)); } } throw Error.get(QueryConstants.ERR_INVALID_RVALUE_EXPRESSION, node.toString()); } RValueExpression(Value value);  RValueExpression(Path p); private  RValueExpression(Value value, Path path, RValueType type); static RValueExpression nullRValue(); Value getValue(); Path getPath(); RValueType getType(); @Override JsonNode toJson(); static RValueExpression fromJson(JsonNode node); @Override int hashCode(); @Override boolean equals(Object obj); }
RValueExpression extends JsonObject { public static RValueExpression fromJson(JsonNode node) { if (node instanceof ObjectNode) { if (node.size() == 1) { JsonNode path = node.get("$valueof"); if (path != null && path.isValueNode()) { return new RValueExpression(new Path(path.asText())); } else { return new RValueExpression(new Value(node)); } } else { return new RValueExpression(new Value(node)); } } if (node instanceof ArrayNode) { return new RValueExpression(new Value(node)); } else if (node.isValueNode()) { if (node.asText().equals("$null")) { return NULL; } else { return new RValueExpression(Value.fromJson(node)); } } throw Error.get(QueryConstants.ERR_INVALID_RVALUE_EXPRESSION, node.toString()); } RValueExpression(Value value);  RValueExpression(Path p); private  RValueExpression(Value value, Path path, RValueType type); static RValueExpression nullRValue(); Value getValue(); Path getPath(); RValueType getType(); @Override JsonNode toJson(); static RValueExpression fromJson(JsonNode node); @Override int hashCode(); @Override boolean equals(Object obj); static final RValueExpression NULL; }