|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jakewharton.apibuilder.ApiBuilder com.jakewharton.pingdom.PingdomApiBuilder<T>
T
- Native class type of the HTTP method call result.public abstract class PingdomApiBuilder<T>
Pingdom-specific API builder extension which provides helper methods for adding fields, parameters, and post-parameters commonly used in the API.
Nested Class Summary | |
---|---|
protected static class |
PingdomApiBuilder.HttpMethod
Valid HTTP request methods. |
Field Summary |
---|
Fields inherited from class com.jakewharton.apibuilder.ApiBuilder |
---|
API_URL_PLACEHOLDER_END, API_URL_PLACEHOLDER_START |
Constructor Summary | |
---|---|
PingdomApiBuilder(PingdomApiService service,
com.google.gson.reflect.TypeToken<T> token,
String urlFormat)
Initialize a new builder for an HTTP GET call. |
|
PingdomApiBuilder(PingdomApiService service,
com.google.gson.reflect.TypeToken<T> token,
String urlFormat,
double apiVersion)
Initalize a new builder for an HTTP GET call with specified API version. |
|
PingdomApiBuilder(PingdomApiService service,
com.google.gson.reflect.TypeToken<T> token,
String urlFormat,
PingdomApiBuilder.HttpMethod method)
Initialize a new builder for the specified HTTP method call. |
|
PingdomApiBuilder(PingdomApiService service,
com.google.gson.reflect.TypeToken<T> token,
String urlFormat,
PingdomApiBuilder.HttpMethod method,
double apiVersion)
Initialize a new builder for the specified HTTP method and API version. |
Method Summary | ||
---|---|---|
protected com.google.gson.JsonElement |
execute()
Execute the remote API method and return the JSON object result. |
|
protected
|
field(String name,
K value)
Add a URL field value. |
|
T |
fire()
Execute remote API method and unmarshall the result to its native type. |
|
protected com.jakewharton.apibuilder.ApiBuilder |
parameter(String name,
Date value)
Add a URL parameter value. |
|
protected
|
parameter(String name,
K value)
Add a URL parameter value. |
|
protected
|
parameter(String name,
List<K> valueList)
Add a URL parameter value. |
|
protected
|
parameter(String name,
Set<K> valueSet)
Add a URL parameter value. |
|
protected PingdomApiBuilder<T> |
postParameter(String name,
boolean value)
Add a request body parameter value. |
|
protected PingdomApiBuilder<T> |
postParameter(String name,
int value)
Add a request body parameter value. |
|
protected
|
postParameter(String name,
K value)
Add a request body parameter value. |
|
protected
|
postParameter(String name,
List<K> valueList)
Add a request body parameter value. |
|
protected PingdomApiBuilder<T> |
postParameter(String name,
String value)
Add a request body parameter value. |
Methods inherited from class com.jakewharton.apibuilder.ApiBuilder |
---|
buildUrl, buildUrl, encodeUrl, field, field, field, field, field, hasField, hasParameter, parameter, parameter, parameter, parameter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PingdomApiBuilder(PingdomApiService service, com.google.gson.reflect.TypeToken<T> token, String urlFormat)
service
- Service to bind to.token
- Return type token.urlFormat
- URL format string.public PingdomApiBuilder(PingdomApiService service, com.google.gson.reflect.TypeToken<T> token, String urlFormat, PingdomApiBuilder.HttpMethod method)
service
- Service to bind to.token
- Return type token.urlFormat
- URL format string.method
- HTTP method.public PingdomApiBuilder(PingdomApiService service, com.google.gson.reflect.TypeToken<T> token, String urlFormat, double apiVersion)
service
- Service to bind to.token
- Return type token.urlFormat
- URL format string.apiVersion
- API version.public PingdomApiBuilder(PingdomApiService service, com.google.gson.reflect.TypeToken<T> token, String urlFormat, PingdomApiBuilder.HttpMethod method, double apiVersion)
service
- Service to bind to.token
- Return type token.urlFormat
- URL format string.method
- HTTP method.apiVersion
- API version.Method Detail |
---|
public final T fire()
protected com.google.gson.JsonElement execute()
Execute the remote API method and return the JSON object result.
This method can be overridden to select a specific subset of the JSON object. The overriding implementation should still call 'super.execute()' and then perform the filtering from there.
protected com.jakewharton.apibuilder.ApiBuilder parameter(String name, Date value)
name
- Name.value
- Value.
protected <K extends PingdomEnumeration> com.jakewharton.apibuilder.ApiBuilder parameter(String name, K value)
name
- Name.value
- Value.
protected <K> com.jakewharton.apibuilder.ApiBuilder parameter(String name, List<K> valueList)
name
- Name.valueList
- List of values.
protected <K extends PingdomEnumeration> com.jakewharton.apibuilder.ApiBuilder parameter(String name, Set<K> valueSet)
name
- Name.valueSet
- Set of values.
protected <K extends PingdomEnumeration> com.jakewharton.apibuilder.ApiBuilder field(String name, K value)
name
- Name.value
- Value.
protected PingdomApiBuilder<T> postParameter(String name, String value)
name
- Name.value
- Value.
protected PingdomApiBuilder<T> postParameter(String name, boolean value)
name
- Name.value
- Value.
protected PingdomApiBuilder<T> postParameter(String name, int value)
name
- Name.value
- Value.
protected <K> PingdomApiBuilder<T> postParameter(String name, List<K> valueList)
name
- Name.valueList
- List of value.
protected <K extends PingdomEnumeration> PingdomApiBuilder<T> postParameter(String name, K value)
name
- Name.value
- Value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |