twitter4j
Class TrendsJSONImpl

java.lang.Object
  extended by twitter4j.TrendsJSONImpl
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Trends>, Trends

final class TrendsJSONImpl
extends java.lang.Object
implements Trends, java.io.Serializable

A data class representing Trends.

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

Field Summary
private  java.util.Date asOf
           
private  Location location
           
private static long serialVersionUID
           
private  java.util.Date trendAt
           
private  Trend[] trends
           
 
Constructor Summary
TrendsJSONImpl(java.util.Date asOf, Location location, java.util.Date trendAt, Trend[] trends)
           
TrendsJSONImpl(twitter4j.internal.http.HttpResponse res)
           
TrendsJSONImpl(java.lang.String jsonStr)
           
 
Method Summary
 int compareTo(Trends that)
           
(package private) static java.util.List<Trends> createTrendsList(twitter4j.internal.http.HttpResponse res)
           
 boolean equals(java.lang.Object o)
           
private static Location extractLocation(twitter4j.internal.org.json.JSONObject json)
           
 java.util.Date getAsOf()
          
 Location getLocation()
          Returns the location associated with the trends.
This method is effective only with getLocalTrends() method.
i.e.
 java.util.Date getTrendAt()
          
 Trend[] getTrends()
          
 int hashCode()
           
(package private)  void init(java.lang.String jsonStr)
           
private static Trend[] jsonArrayToTrendArray(twitter4j.internal.org.json.JSONArray array)
           
private static java.util.Date parseTrendsDate(java.lang.String asOfStr)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

asOf

private java.util.Date asOf

trendAt

private java.util.Date trendAt

trends

private Trend[] trends

location

private Location location

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

TrendsJSONImpl

TrendsJSONImpl(twitter4j.internal.http.HttpResponse res)
         throws TwitterException
Throws:
TwitterException

TrendsJSONImpl

TrendsJSONImpl(java.lang.String jsonStr)
         throws TwitterException
Throws:
TwitterException

TrendsJSONImpl

TrendsJSONImpl(java.util.Date asOf,
               Location location,
               java.util.Date trendAt,
               Trend[] trends)
Method Detail

compareTo

public int compareTo(Trends that)
Specified by:
compareTo in interface java.lang.Comparable<Trends>

init

void init(java.lang.String jsonStr)
    throws TwitterException
Throws:
TwitterException

createTrendsList

static java.util.List<Trends> createTrendsList(twitter4j.internal.http.HttpResponse res)
                                        throws TwitterException
Throws:
TwitterException

extractLocation

private static Location extractLocation(twitter4j.internal.org.json.JSONObject json)
                                 throws TwitterException
Throws:
TwitterException

parseTrendsDate

private static java.util.Date parseTrendsDate(java.lang.String asOfStr)
                                       throws TwitterException
Throws:
TwitterException

jsonArrayToTrendArray

private static Trend[] jsonArrayToTrendArray(twitter4j.internal.org.json.JSONArray array)
                                      throws twitter4j.internal.org.json.JSONException
Throws:
twitter4j.internal.org.json.JSONException

getTrends

public Trend[] getTrends()

Specified by:
getTrends in interface Trends

getLocation

public Location getLocation()
Returns the location associated with the trends.
This method is effective only with getLocalTrends() method.
i.e. The return value of this method will be null with Search API Methods (getTrends(), getCurrentTrends(), getDailyTrends(), and getWeeklyTrends()).

Specified by:
getLocation in interface Trends
Returns:
location

getAsOf

public java.util.Date getAsOf()

Specified by:
getAsOf in interface Trends

getTrendAt

public java.util.Date getTrendAt()

Specified by:
getTrendAt in interface Trends

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object