winterwell.jtwitter
Class TwitterEvent

java.lang.Object
  extended by winterwell.jtwitter.TwitterEvent

public class TwitterEvent
extends java.lang.Object


Nested Class Summary
static interface TwitterEvent.Type
           
 
Field Summary
 java.util.Date createdAt
           
 User source
          The user who initiated the event
 User target
          The user who was affected, or who owns the affected object.
 java.lang.String type
          What type of event this is.
 
Constructor Summary
TwitterEvent(winterwell.json.JSONObject jo, Twitter jtwit)
           
 
Method Summary
 java.util.Date getCreatedAt()
           
 User getSource()
          The user who initiated the event
 User getTarget()
          The user who was affected, or who owns the affected object.
 java.lang.Object getTargetObject()
          The affected object, if not a user.
 java.lang.String getType()
           
 boolean is(java.lang.String type)
          Convenience method for filtering events.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

createdAt

public final java.util.Date createdAt

source

public final User source
The user who initiated the event


target

public final User target
The user who was affected, or who owns the affected object.


type

public final java.lang.String type
What type of event this is. Known values: See the TwitterEvent.Type constants for known definitions.

Constructor Detail

TwitterEvent

public TwitterEvent(winterwell.json.JSONObject jo,
                    Twitter jtwit)
             throws winterwell.json.JSONException
Throws:
winterwell.json.JSONException
Method Detail

getCreatedAt

public java.util.Date getCreatedAt()

getSource

public User getSource()
The user who initiated the event


getTarget

public User getTarget()
The user who was affected, or who owns the affected object.


getTargetObject

public java.lang.Object getTargetObject()
The affected object, if not a user. E.g. For a favorite event, target=the owner of the favorited tweet, target object=the actual favorited tweet. Can be null.


getType

public java.lang.String getType()

is

public boolean is(java.lang.String type)
Convenience method for filtering events. E.g. given a TwitterEvent event use event.is(TwitterEvent.Type.FOLLOW) to pick out follow events.

Parameters:
type -
Returns:
true if this is an event of the given type.

toString

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