public RecordedQuery fromJSON ( String json ) { RecordedQuery ret = new RecordedQuery ( false ) ; StringReader sr = new StringReader ( json ) ; JsonReader reader = Json . createReader ( sr ) ; JsonObject jsonResult = reader . readObject ( ) ; ret . setGeneric ( jsonResult . getBoolean ( GENERIC ) ) ; JsonArray augmentations = jsonResult . getJsonArray ( AUGMENTATIONS ) ; if ( augmentations != null ) { Map < String , String > augs = new HashMap < String , String > ( ) ; Iterator < JsonValue > ait = augmentations . iterator ( ) ; while ( ait . hasNext ( ) ) { JsonObject a = ( JsonObject ) ait . next ( ) ; augs . put ( a . getString ( KEY ) , a . getString ( VALUE ) ) ; } ret . setAugmentations ( augs ) ; } JsonArray statements = jsonResult . getJsonArray ( STATEMENTS ) ; Iterator < JsonValue > it = statements . iterator ( ) ; while ( it . hasNext ( ) ) { JsonValue s = it . next ( ) ; readStatement ( s , ret . getStatements ( ) , ret ) ; } return ret ; }
Build a recorded query from it s JSON representation