src/main/java/org/lightcouch/View.java
public <K, V, T> ViewResult<K, V, T> queryView(Class<K> classOfK, Class<V> classOfV, Class<T> classOfT) {
		InputStream instream = null;
		try {  
			Reader reader = new InputStreamReader(instream = queryForStream(), Charsets.UTF_8);
			JsonObject json = new JsonParser().parse(reader).getAsJsonObject(); 
			ViewResult<K, V, T> vr = new ViewResult<K, V, T>();
			vr.setTotalRows(getAsLong(json, "total_rows")); 
			vr.setOffset(getAsInt(json, "offset"));
			vr.setUpdateSeq(getAsString(json, "update_seq"));
			JsonArray jsonArray = json.getAsJsonArray("rows");
			for (JsonElement e : jsonArray) {
				ViewResult<K, V, T>.Rows row = vr.new Rows();
				row.setId(JsonToObject(gson, e, "id", String.class));
				if (classOfK != null) {
				    row.setKey(JsonToObject(gson, e, "key", classOfK));
				}
				if (classOfV != null) {
				    row.setValue(JsonToObject(gson, e, "value", classOfV));
				}
				if(Boolean.TRUE.equals(this.includeDocs)) {
					row.setDoc(JsonToObject(gson, e, "doc", classOfT));
				}
				vr.getRows().add(row);
			}
			return vr;
		} finally {
			close(instream);
		}
	}
public <K, V, T> ViewResult<K, V, T> queryView(Class<K> classOfK, Class<V> classOfV, Class<T> classOfT) {
		InputStream instream = null;
		try {  
			Reader reader = new InputStreamReader(instream = queryForStream(), Charsets.UTF_8);
			JsonObject json = new JsonParser().parse(reader).getAsJsonObject(); 
			ViewResult<K, V, T> vr = new ViewResult<K, V, T>();
			vr.setTotalRows(getAsLong(json, "total_rows")); 
			vr.setOffset(getAsInt(json, "offset"));
			vr.setUpdateSeq(getAsString(json, "update_seq"));
			JsonArray jsonArray = json.getAsJsonArray("rows");
			for (JsonElement e : jsonArray) {
				ViewResult<K, V, T>.Rows row = vr.new Rows();
				row.setId(JsonToObject(gson, e, "id", String.class));
				if (classOfK != null) {
				    row.setKey(JsonToObject(gson, e, "key", classOfK));
				}
				if (classOfV != null) {
				    row.setValue(JsonToObject(gson, e, "value", classOfV));
				}
				if(Boolean.TRUE.equals(this.includeDocs)) {
					row.setDoc(JsonToObject(gson, e, "doc", classOfT));
				}
				vr.getRows().add(row);
			}
			return vr;
		} finally {
			close(instream);
		}
	}
public < K , V , T > ViewResult < K , V , T > queryView ( Class < K > classOfK , Class < V > classOfV , Class < T > classOfT ) { InputStream instream = null ; try { Reader reader = new InputStreamReader ( instream = queryForStream ( ) , Charsets . UTF_8 ) ; JsonObject json = new JsonParser ( ) . parse ( reader ) . getAsJsonObject ( ) ; ViewResult < K , V , T > vr = new ViewResult < K , V , T > ( ) ; vr . setTotalRows ( getAsLong ( json , "total_rows" ) ) ; vr . setOffset ( getAsInt ( json , "offset" ) ) ; vr . setUpdateSeq ( getAsString ( json , "update_seq" ) ) ; JsonArray jsonArray = json . getAsJsonArray ( "rows" ) ; for ( JsonElement e : jsonArray ) { ViewResult < K , V , T > . Rows row = vr . new Rows ( ) ; row . setId ( JsonToObject ( gson , e , "id" , String . class ) ) ; if ( classOfK != null ) { row . setKey ( JsonToObject ( gson , e , "key" , classOfK ) ) ; } if ( classOfV != null ) { row . setValue ( JsonToObject ( gson , e , "value" , classOfV ) ) ; } if ( Boolean . TRUE . equals ( this . includeDocs ) ) { row . setDoc ( JsonToObject ( gson , e , "doc" , classOfT ) ) ; } vr . getRows ( ) . add ( row ) ; } return vr ; } finally { close ( instream ) ; } }
Queries a view.
@param <K> Object type K (key)
@param <V> Object type V (value)
@param <T> The class type
@param classOfK The class of type K.
@param classOfV The class of type V.
@param classOfT The class of type T.
@return The View result entries.
Queries a view .