net.unto.twitter
Class Api.Builder

java.lang.Object
  extended by net.unto.twitter.Api.Builder
Enclosing class:
Api

public static class Api.Builder
extends Object

A builder for an immutable Api instance.

The Api.Builder is the only way to construct a new Api instance. Use the builder to configure a new Api instance with username and password credentials for Twitter API calls.

Example usage:

Api api = Api.builder().username("username").password("password").build();


Constructor Summary
Api.Builder()
           
 
Method Summary
 Api build()
          Use the Builder instance to construct an immutable Api instance.
 Api.Builder host(String host)
          Sets the default host (e.g., "twitter.com") for Twitter API calls.
 Api.Builder httpManager(HttpManager httpManager)
          Sets the default HttpManager for Twitter API calls.
 Api.Builder password(String password)
          Sets the password for authenticated Twitter API calls.
 Api.Builder port(int port)
          Sets the default port (e.g., 80) for Twitter API calls.
 Api.Builder scheme(UtilProtos.Url.Scheme scheme)
          Sets the default http scheme (e.g., Url.Scheme.HTTP) for Twitter API calls.
 Api.Builder username(String username)
          Sets the username for authenticated Twitter API calls.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Api.Builder

public Api.Builder()
Method Detail

build

public Api build()
Use the Builder instance to construct an immutable Api instance.

Returns:
An immutable Api instance.

host

public Api.Builder host(String host)
Sets the default host (e.g., "twitter.com") for Twitter API calls.

Parameters:
host - the default host (e.g., "twitter.com") for Twitter API calls.
Returns:
This Api.Builder instance.

httpManager

public Api.Builder httpManager(HttpManager httpManager)
Sets the default HttpManager for Twitter API calls.

Parameters:
httpManager - the default HttpManager for Twitter API calls.
Returns:
This Api.Builder instance.

password

public Api.Builder password(String password)
Sets the password for authenticated Twitter API calls.

The username must be set if the password is set, and the httpManager should not be set.

Parameters:
password - the password for authenticated Twitter API calls.
Returns:
This Api.Builder instance.

port

public Api.Builder port(int port)
Sets the default port (e.g., 80) for Twitter API calls.

Parameters:
port - the default port (e.g., 80) for Twitter API calls.
Returns:
This Api.Builder instance.

scheme

public Api.Builder scheme(UtilProtos.Url.Scheme scheme)
Sets the default http scheme (e.g., Url.Scheme.HTTP) for Twitter API calls.

Parameters:
scheme - the default http scheme (e.g., Url.Scheme.HTTP) for Twitter API calls.
Returns:
This Api.Builder instance.

username

public Api.Builder username(String username)
Sets the username for authenticated Twitter API calls.

The password must be set if the username is set, and the httpManager should not be set.

Parameters:
username - the username for authenticated Twitter API calls.
Returns:
This Api.Builder instance.


Copyright © 2009 DeWitt Clinton. All Rights Reserved.