twitter4j

## Class AsyncTwitterFactory

- java.lang.Object
- - twitter4j.AsyncTwitterFactory

All Implemented Interfaces:
  Serializable

    public final class AsyncTwitterFactory
    extends Object
    implements Serializable

A factory class for AsyncTwitter.
An instance of this class is completely thread safe and can be re-used and used concurrently.
Note that currently AsyncTwitter is NOT compatible with Google App Engine as it is maintaining threads internally.

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

### Constructor Summary

Constructors
Constructor and Description
`AsyncTwitterFactory()` Creates an AsyncTwitterFactory with the root configuration, with no listener.
`AsyncTwitterFactory(Configuration conf)` Creates an AsyncTwitterFactory with the given configuration.
`AsyncTwitterFactory(String configTreePath)` Creates a AsyncTwitterFactory with the specified config tree, with given listener

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`AsyncTwitter` `getInstance()` Returns an instance associated with the configuration bound to this factory.
`AsyncTwitter` `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.
`AsyncTwitter` `getInstance(Authorization auth)`
`AsyncTwitter` `getInstance(Twitter twitter)` a kind of copy factory method constructs an AsyncTwitter from Twitter instance
`static AsyncTwitter` `getSingleton()` Returns default singleton AsyncTwitter instance.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AsyncTwitterFactory

    public AsyncTwitterFactory()

Creates an AsyncTwitterFactory with the root configuration, with no listener. AsyncTwitter instances will not perform callbacks when using this constructor.

#### AsyncTwitterFactory

    public AsyncTwitterFactory(Configuration conf)

Creates an AsyncTwitterFactory with the given configuration.

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

#### AsyncTwitterFactory

    public AsyncTwitterFactory(String configTreePath)

Creates a AsyncTwitterFactory with the specified config tree, with given listener

Parameters:
  `configTreePath` - the path
Since:
  Twitter4J 2.1.12

### Method Detail

#### getInstance

    public AsyncTwitter getInstance()

Returns an instance associated with the configuration bound to this factory.

Returns:
  default singleton instance

#### getInstance

    public AsyncTwitter 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

#### getInstance

    public AsyncTwitter getInstance(Authorization auth)

Parameters:
  `auth` - authorization
Returns:
  an instance

#### getInstance

    public AsyncTwitter getInstance(Twitter twitter)

a kind of copy factory method constructs an AsyncTwitter from Twitter instance

Parameters:
  `twitter` - Twitter instance
Returns:
  an instance

#### getSingleton

    public static AsyncTwitter getSingleton()

Returns default singleton AsyncTwitter instance.

Returns:
  default singleton AsyncTwitter instance
Since:
  Twitter4J 2.2.4