private < V > V queryValue ( Class < V > classOfV ) { InputStream instream = null ; try { Reader reader = new InputStreamReader ( instream = queryForStream ( ) , Charsets . UTF_8 ) ; JsonArray array = new JsonParser ( ) . parse ( reader ) . getAsJsonObject ( ) . get ( "rows" ) . getAsJsonArray ( ) ; if ( array . size ( ) != 1 ) { throw new NoDocumentException ( "Expecting a single result but was: " + array . size ( ) ) ; } return JsonToObject ( gson , array . get ( 0 ) , "value" , classOfV ) ; } finally { close ( instream ) ; } }
Queries for scalar values . Internal use .