twitter4j.json
Class DataObjectFactory

java.lang.Object
  extended by twitter4j.json.DataObjectFactory

public final class DataObjectFactory
extends java.lang.Object

Since:
Twitter4J 2.1.7
Author:
Yusuke Yamamoto - yusuke at mac.com

Method Summary
static AccountTotals createAccountTotals(java.lang.String rawJSON)
          Constructs an AccountTotals object from rawJSON string.
static Category createCategory(java.lang.String rawJSON)
          Constructs a Category object from rawJSON string.
static DirectMessage createDirectMessage(java.lang.String rawJSON)
          Constructs a DirectMessage object from rawJSON string.
static IDs createIDs(java.lang.String rawJSON)
          Constructs a IDs object from rawJSON string.
static Location createLocation(java.lang.String rawJSON)
          Constructs a Location object from rawJSON string.
static java.lang.Object createObject(java.lang.String rawJSON)
          Construct an object from rawJSON string.
static Place createPlace(java.lang.String rawJSON)
          Constructs a Place object from rawJSON string.
static RateLimitStatus createRateLimitStatus(java.lang.String rawJSON)
          Constructs a RateLimitStatus object from rawJSON string.
static RelatedResults createRelatedResults(java.lang.String rawJSON)
          Constructs a RelatedResults object from rawJSON string.
static Relationship createRelationship(java.lang.String rawJSON)
          Constructs a Relationship object from rawJSON string.
static SavedSearch createSavedSearch(java.lang.String rawJSON)
          Constructs a SavedSearch object from rawJSON string.
static Status createStatus(java.lang.String rawJSON)
          Constructs a Status object from rawJSON string.
static Trend createTrend(java.lang.String rawJSON)
          Constructs a Trend object from rawJSON string.
static Trends createTrends(java.lang.String rawJSON)
          Constructs a Trends object from rawJSON string.
static Tweet createTweet(java.lang.String rawJSON)
          Constructs a Tweet object from rawJSON string.
static User createUser(java.lang.String rawJSON)
          Constructs a User object from rawJSON string.
static UserList createUserList(java.lang.String rawJSON)
          Constructs a UserList object from rawJSON string.
static java.lang.String getRawJSON(java.lang.Object obj)
          Returns a raw JSON form of the provided object.
Note that raw JSON forms can be retrieved only from the same thread invoked the last method call and will become inaccessible once another method call
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRawJSON

public static java.lang.String getRawJSON(java.lang.Object obj)
Returns a raw JSON form of the provided object.
Note that raw JSON forms can be retrieved only from the same thread invoked the last method call and will become inaccessible once another method call

Parameters:
obj -
Returns:
raw JSON
Since:
Twitter4J 2.1.7

createStatus

public static Status createStatus(java.lang.String rawJSON)
                           throws TwitterException
Constructs a Status object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
Status
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createUser

public static User createUser(java.lang.String rawJSON)
                       throws TwitterException
Constructs a User object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
User
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createAccountTotals

public static AccountTotals createAccountTotals(java.lang.String rawJSON)
                                         throws TwitterException
Constructs an AccountTotals object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
AccountTotals
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.9

createTweet

public static Tweet createTweet(java.lang.String rawJSON)
                         throws TwitterException
Constructs a Tweet object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
Tweet
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createRelationship

public static Relationship createRelationship(java.lang.String rawJSON)
                                       throws TwitterException
Constructs a Relationship object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
Relationship
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createPlace

public static Place createPlace(java.lang.String rawJSON)
                         throws TwitterException
Constructs a Place object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
Place
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createSavedSearch

public static SavedSearch createSavedSearch(java.lang.String rawJSON)
                                     throws TwitterException
Constructs a SavedSearch object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
SavedSearch
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createTrend

public static Trend createTrend(java.lang.String rawJSON)
                         throws TwitterException
Constructs a Trend object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
Trend
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createTrends

public static Trends createTrends(java.lang.String rawJSON)
                           throws TwitterException
Constructs a Trends object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
Trends
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createIDs

public static IDs createIDs(java.lang.String rawJSON)
                     throws TwitterException
Constructs a IDs object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
IDs
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createRateLimitStatus

public static RateLimitStatus createRateLimitStatus(java.lang.String rawJSON)
                                             throws TwitterException
Constructs a RateLimitStatus object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
RateLimitStatus
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createCategory

public static Category createCategory(java.lang.String rawJSON)
                               throws TwitterException
Constructs a Category object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
Category
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createDirectMessage

public static DirectMessage createDirectMessage(java.lang.String rawJSON)
                                         throws TwitterException
Constructs a DirectMessage object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
DirectMessage
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createLocation

public static Location createLocation(java.lang.String rawJSON)
                               throws TwitterException
Constructs a Location object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
Location
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createUserList

public static UserList createUserList(java.lang.String rawJSON)
                               throws TwitterException
Constructs a UserList object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
UserList
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.7

createRelatedResults

public static RelatedResults createRelatedResults(java.lang.String rawJSON)
                                           throws TwitterException
Constructs a RelatedResults object from rawJSON string.

Parameters:
rawJSON - raw JSON form as String
Returns:
RelatedResults
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.8

createObject

public static java.lang.Object createObject(java.lang.String rawJSON)
                                     throws TwitterException
Construct an object from rawJSON string. This method may be called when you do not know what a given raw JSON string contains. It will do the work of determining what type of object the JSON represents, and constructing the respective object type. For example, if the JSON contents represents a Status, then a Status will be returned. If it represents a deletion notice, then a StatusDeletionNotice will be returned. The caller can simply use instanceof to handle the returned object as applicable. NOTE: the raw JSONObject will be returned in cases where there isn't a discrete respective object type that can be constructed. That way, the caller can at least have access to the JSON itself.

Parameters:
rawJSON - raw JSON form as String
Returns:
the respective constructed object, or the JSONObject in the case where we cannot determine the object type.
Throws:
TwitterException - when provided string is not a valid JSON string.
Since:
Twitter4J 2.1.9


Copyright © 2011. All Rights Reserved.