com.twitterapime.search
Class Tweet

java.lang.Object
  extended by com.twitterapime.model.DefaultEntity
      extended by com.twitterapime.search.Tweet
All Implemented Interfaces:
Entity

public final class Tweet
extends DefaultEntity

This class defines an entity that represents a Tweet. A tweet is a message posted by an user to Twitter.

Since:
1.0
Version:
1.3
Author:
Ernandes Mourao Junior (ernandes@gmail.com)
See Also:
SearchDevice, TweetER

Field Summary
static int MAX_CHARACTERS
           Content max number of characters.
 
Fields inherited from class com.twitterapime.model.DefaultEntity
data
 
Constructor Summary
Tweet()
           Create an instance of Tweet class.
Tweet(java.util.Hashtable data)
           Create an instance of Tweet class.
Tweet(java.lang.String content)
           Create an instance of Tweet class.
Tweet(java.lang.String content, GeoLocation location)
           Create an instance of Tweet class.
Tweet(java.lang.String toUserNameOrID, java.lang.String content)
           Create an instance of Tweet class.
This constructor is used when the Tweet object is going to be sent as a Direct Message.
 
Method Summary
 GeoLocation getLocation()
           Get the tweet's location object.
 UserAccount getRecipientAccount()
           Get the recipient account.
Call this method to retrieve info about the recipient user by sending a Direct Message.
 Tweet getRepostedTweet()
           Get the reposted tweet object.
 UserAccount getUserAccount()
           Get the user account.
 void validateContent()
           Validate tweet's content.
 void validateRecipient()
           Validate Direct Messsage's recipient info.
 
Methods inherited from class com.twitterapime.model.DefaultEntity
equals, getArray, getDate, getInt, getLong, getObject, getString, hashCode, setData, setData, size, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_CHARACTERS

public static final int MAX_CHARACTERS

Content max number of characters.

See Also:
Constant Field Values
Constructor Detail

Tweet

public Tweet()

Create an instance of Tweet class.


Tweet

public Tweet(java.util.Hashtable data)

Create an instance of Tweet class.

Parameters:
data - The initial attributes/values.

Tweet

public Tweet(java.lang.String content)

Create an instance of Tweet class.

Parameters:
content - Content (status).
Throws:
java.lang.IllegalArgumentException - If content is invalid.

Tweet

public Tweet(java.lang.String content,
             GeoLocation location)

Create an instance of Tweet class.

To set this tweet's location, enable Tweet Location settings of current authenticated user account on Twitter website.

Parameters:
content - Content (status).
location - Tweet's location.
Throws:
java.lang.IllegalArgumentException - If content is invalid.

Tweet

public Tweet(java.lang.String toUserNameOrID,
             java.lang.String content)

Create an instance of Tweet class.
This constructor is used when the Tweet object is going to be sent as a Direct Message.

Parameters:
toUserNameOrID - Username or ID from recipient user.
content - Content (message).
Throws:
java.lang.IllegalArgumentException - If toUserNameOrID and/or content are invalid.
Method Detail

validateContent

public void validateContent()

Validate tweet's content.

Throws:
java.lang.IllegalArgumentException - If the content is null/empty or exceeds 140 characters.

validateRecipient

public void validateRecipient()

Validate Direct Messsage's recipient info.

Throws:
java.lang.IllegalArgumentException - If the recipient info is null/empty.

getUserAccount

public UserAccount getUserAccount()

Get the user account.

Returns:
User account.

getRecipientAccount

public UserAccount getRecipientAccount()

Get the recipient account.
Call this method to retrieve info about the recipient user by sending a Direct Message.

Returns:
Recipient account.

getRepostedTweet

public Tweet getRepostedTweet()

Get the reposted tweet object.

Returns:
Tweet object.

getLocation

public GeoLocation getLocation()

Get the tweet's location object.

Returns:
Location object.


Copyright © 2010 Twitter API ME Team. All Rights Reserved.