src/main/java/org/lightcouch/View.java
public <T> Page<T> queryPage(int rowsPerPage, String param, Class<T> classOfT) {
		if(param == null) { // assume first page
			return queryNextPage(rowsPerPage, null, null, null, null, classOfT);
		}
		String currentStartKey;
		String currentStartKeyDocId;
		String startKey;
		String startKeyDocId;
		String action;
		try {
			// extract fields from the returned HEXed JSON object
			final JsonObject json = new JsonParser().parse(new String(Base64.decodeBase64(param.getBytes()))).getAsJsonObject();
			if(log.isDebugEnabled()) {
				log.debug("Paging Param Decoded = " + json);
			}
			final JsonObject jsonCurrent = json.getAsJsonObject(CURRENT_KEYS);
			currentStartKey = jsonCurrent.get(CURRENT_START_KEY).getAsString();
			currentStartKeyDocId = jsonCurrent.get(CURRENT_START_KEY_DOC_ID).getAsString();
			startKey = json.get(START_KEY).getAsString();
			startKeyDocId = json.get(START_KEY_DOC_ID).getAsString();
			action = json.get(ACTION).getAsString();
		} catch (Exception e) {
			throw new CouchDbException("could not parse the given param!", e);
		}
		if(PREVIOUS.equals(action)) { // previous
			return queryPreviousPage(rowsPerPage, currentStartKey, currentStartKeyDocId, startKey, startKeyDocId, classOfT);
		} else { // next
			return queryNextPage(rowsPerPage, currentStartKey, currentStartKeyDocId, startKey, startKeyDocId, classOfT);
		}
	}
public <T> Page<T> queryPage(int rowsPerPage, String param, Class<T> classOfT) {
		if(param == null) { // assume first page
			return queryNextPage(rowsPerPage, null, null, null, null, classOfT);
		}
		String currentStartKey;
		String currentStartKeyDocId;
		String startKey;
		String startKeyDocId;
		String action;
		try {
			// extract fields from the returned HEXed JSON object
			final JsonObject json = new JsonParser().parse(new String(Base64.decodeBase64(param.getBytes()))).getAsJsonObject();
			if(log.isDebugEnabled()) {
				log.debug("Paging Param Decoded = " + json);
			}
			final JsonObject jsonCurrent = json.getAsJsonObject(CURRENT_KEYS);
			currentStartKey = jsonCurrent.get(CURRENT_START_KEY).getAsString();
			currentStartKeyDocId = jsonCurrent.get(CURRENT_START_KEY_DOC_ID).getAsString();
			startKey = json.get(START_KEY).getAsString();
			startKeyDocId = json.get(START_KEY_DOC_ID).getAsString();
			action = json.get(ACTION).getAsString();
		} catch (Exception e) {
			throw new CouchDbException("could not parse the given param!", e);
		}
		if(PREVIOUS.equals(action)) { // previous
			return queryPreviousPage(rowsPerPage, currentStartKey, currentStartKeyDocId, startKey, startKeyDocId, classOfT);
		} else { // next
			return queryNextPage(rowsPerPage, currentStartKey, currentStartKeyDocId, startKey, startKeyDocId, classOfT);
		}
	}
Queries a view for pagination, returns a next or a previous page, this method
figures out which page to return based on the given param that is generated by an
earlier call to this method, quering the first page is done by passing a {@code null} param.
@param <T> Object type T
@param rowsPerPage The number of rows per page.
@param param The request parameter to use to query a page, or {@code null} to return the first page.
@param classOfT The class of type T.
@return {@link Page}