abstact class AbstractPageRequestHandler() {
public List<Pair<String, String>> getPagingHeaders(ReadFilter filter){
List<Pair<String, String>> toReturn = new ArrayList<>();
return toReturn;
}
public byte[] appendToBody(ReadFilter filter, byte[] body){
return body;| /** | |
| * Task to lookup the LatLng of an address | |
| */ | |
| public class SearchForLocationTask extends AsyncTask<String, Void, LatLng> { | |
| private static final String TAG = SearchForLocationTask.class.getSimpleName(); | |
| Context mContext; | |
| //Get static reference to requestQueue | |
| RequestQueue mRequestQueue = MyApplication.getInstance().getRequestQueue(); |
| /* | |
| * Copyright 2014 Julian Shen | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
| import com.google.gson.Gson; | |
| import com.google.gson.JsonSyntaxException; | |
| import com.android.volley.AuthFailureError; | |
| import com.android.volley.NetworkResponse; | |
| import com.android.volley.ParseError; | |
| import com.android.volley.Request; | |
| import com.android.volley.Response; | |
| import com.android.volley.Response.ErrorListener; | |
| import com.android.volley.Response.Listener; |
| public interface PagedResult<T> { | |
| PagedResult<T> next(); | |
| PagedResult<T> prev(); | |
| PagedResult<T> withOffset(int offset); | |
| PagedResult<T> withLimit(int limit); |
This document describes the client side interfaces which a developer can use to Query and Page through data obtained from remote rest services. This document describes both how to interact with the Aerogear-Controller based paging as well how to extend the libraries and APIs to support most other restful services. It is currently Java centric, but this should be fixed up in the future.
At a high level, Paging and Querying is supported though the Pipe.readWithFilter(ReadFilter, Callback) method. A ReadFilter object will set the current page, number of results perPage, and a where property. The Pipe implementation will be responsible for processing a request along with any paging data and sending the appropriate headers, data, and query parameters to the server. Once the response has been received, the Pipe implementation will provide a List of objects to the supplied callback. If this call used paging, the List will be an instance of PagedList.
PagedList will be a List of results f
//Smart use of enums
public enum DeviceComparator implements Comparator<Device> {
ID {
public int compare(Device o1, Device o2) {
return Integer.valueOf(o1.getId()).compareTo(o2.getId());
}},
NAME {
public int compare(Device o1, Device o2) {| NSDictionary *map = @{ @"key1": @"blah", @"key2": @"foo"}; |
| class apt-get::update { | |
| exec { "apt-get update": | |
| command => "apt-get update" | |
| } | |
| } |
| #!/usr/bin/env bash | |
| domain=$1 | |
| filename="/tmp/$(echo -n "$domain" | md5)" | |
| read -r -d '' screenrc <<SCREENRC | |
| startup_message off | |
| shell /usr/local/bin/bash | |
| autodetach on | |
| defscrollback 10000 |