@Override public void parseJson(JsonValue json) { if(json.isObject()) { JsonObject o = json.asJsonObject(); this.user = toRule(o.get("user")); this.client = toRule(o.get("client")); return; } Object v = json.raw(); if(v instanceof String) { this.parseString((String)v); return; } throw new IllegalStateException("Can't parse json value '" + v + "'"); }
public void read(MetaApi api, Resource resource, boolean global) { JsonValue v = JsonValue.of(JSON.decode(resource.getContent())); String path = !global ? PathDefParser.path("/app/operations/", resource) : null; if(v.isObject()) { read(api, global, path,(Map)v.raw()); }else if(v.isArray()) { for(Object map : v.asArray()) { read(api, global, path,(Map)map); } }else { throw new IllegalStateException("Invalid json format of tags, must be an array or an object"); } }