Created
June 17, 2012 03:24
-
-
Save yurenju/2943291 to your computer and use it in GitHub Desktop.
SampleClient
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package idv.yurenju.google.sample; | |
import com.google.api.client.http.GenericUrl; | |
import com.google.api.client.http.HttpTransport; | |
import com.google.api.client.http.json.JsonHttpClient; | |
import com.google.api.client.json.JsonFactory; | |
public class SampleClient extends JsonHttpClient { | |
public static final String DEFAULT_BASE_URL = "https://api.twitter.com/"; | |
public SampleClient(HttpTransport transport, JsonFactory factory, | |
String baseUrl) { | |
super(transport, factory, baseUrl); | |
} | |
public static Builder builder(HttpTransport transport, JsonFactory factory) { | |
Builder builder = new Builder(transport, factory); | |
return builder; | |
} | |
public static final class Builder extends JsonHttpClient.Builder { | |
protected Builder(HttpTransport transport, JsonFactory factory) { | |
super(transport, factory, new GenericUrl(DEFAULT_BASE_URL)); | |
} | |
@Override | |
public SampleClient build() { | |
return new SampleClient(getTransport(), getJsonFactory(), | |
getBaseUrl().build()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment