twitter4j
Class TwitterFactory

java.lang.Object
  extended by twitter4j.TwitterFactory
All Implemented Interfaces:
Serializable

public final class TwitterFactory
extends Object
implements Serializable

A factory class for Twitter.
An instance of this class is completely thread safe and can be re-used and used concurrently.

Since:
Twitter4J 2.1.0
Author:
Yusuke Yamamoto - yusuke at mac.com
See Also:
Serialized Form

Constructor Summary
TwitterFactory()
          Creates a TwitterFactory with the root configuration.
TwitterFactory(Configuration conf)
          Creates a TwitterFactory with the given configuration.
TwitterFactory(String configTreePath)
          Creates a TwitterFactory with a specified config tree
 
Method Summary
 Twitter getInstance()
          Returns a instance associated with the configuration bound to this factory.
 Twitter getInstance(AccessToken accessToken)
          Returns a OAuth Authenticated instance.
consumer key and consumer Secret must be provided by twitter4j.properties, or system properties.
Unlike OAuthSupport.setOAuthAccessToken(twitter4j.auth.AccessToken), this factory method potentially returns a cached instance.
 Twitter getInstance(Authorization auth)
           
static Twitter getSingleton()
          Returns default singleton Twitter instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwitterFactory

public TwitterFactory()
Creates a TwitterFactory with the root configuration.


TwitterFactory

public TwitterFactory(Configuration conf)
Creates a TwitterFactory with the given configuration.

Parameters:
conf - the configuration to use
Since:
Twitter4J 2.1.1

TwitterFactory

public TwitterFactory(String configTreePath)
Creates a TwitterFactory with a specified config tree

Parameters:
configTreePath - the path
Method Detail

getInstance

public Twitter getInstance()
Returns a instance associated with the configuration bound to this factory.

Returns:
default singleton instance

getInstance

public Twitter getInstance(AccessToken accessToken)
Returns a OAuth Authenticated instance.
consumer key and consumer Secret must be provided by twitter4j.properties, or system properties.
Unlike OAuthSupport.setOAuthAccessToken(twitter4j.auth.AccessToken), this factory method potentially returns a cached instance.

Parameters:
accessToken - access token
Returns:
an instance
Since:
Twitter4J 2.1.9

getInstance

public Twitter getInstance(Authorization auth)

getSingleton

public static Twitter getSingleton()
Returns default singleton Twitter instance.

Returns:
default singleton Twitter instance
Since:
Twitter4J 2.2.4


Copyright © 2012. All Rights Reserved.