com.jakewharton.domainr
Class DomainrApiBuilder<T>

java.lang.Object
  extended by com.jakewharton.apibuilder.ApiBuilder
      extended by com.jakewharton.domainr.DomainrApiBuilder<T>
Type Parameters:
T - Native class type of the HTTP method call result.
Direct Known Subclasses:
InfoService.InfoBuilder, SearchService.QueryBuilder

public abstract class DomainrApiBuilder<T>
extends com.jakewharton.apibuilder.ApiBuilder

Domainr-specific API builder extension which provides helper methods for adding fields, parameters, and post-parameters commonly used in the API.

Author:
Jake Wharton

Field Summary
 
Fields inherited from class com.jakewharton.apibuilder.ApiBuilder
API_URL_DELIMITER_END, API_URL_DELIMITER_START
 
Constructor Summary
DomainrApiBuilder(DomainrApiService service, com.google.gson.reflect.TypeToken<T> token, String urlFormat)
          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.
 T fire()
          Execute remote API method and unmarshall the result to its native type.
 
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

DomainrApiBuilder

public DomainrApiBuilder(DomainrApiService service,
                         com.google.gson.reflect.TypeToken<T> token,
                         String urlFormat)
Initialize a new builder for the specified HTTP method and API version.

Parameters:
service - Service to bind to.
token - Return type token.
urlFormat - URL format string.
Method Detail

fire

public final T fire()
Execute remote API method and unmarshall the result to its native type.

Returns:
Instance of result type.

execute

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.

Returns:
JSON object instance.


Copyright © 2011 Jake Wharton. All Rights Reserved.