com.twitterapime.model
Class DefaultEntity

java.lang.Object
  extended by com.twitterapime.model.DefaultEntity
All Implemented Interfaces:
Entity
Direct Known Subclasses:
Credential, GeoLocation, RateLimitStatus, Tweet, UserAccount

public class DefaultEntity
extends java.lang.Object
implements Entity

This class provides a basic implementation of Entity interface.

Since:
1.0
Version:
1.3
Author:
Ernandes Mourao Junior (ernandes@gmail.com)
See Also:
Tweet, Credential, RateLimitStatus, UserAccount

Field Summary
protected  java.util.Hashtable data
           Hashtable object that stores the attributes/values.
 
Constructor Summary
DefaultEntity()
           Create an instance of DefaultEntity class.
DefaultEntity(java.util.Hashtable data)
           Create an instance of DefaultEntity class.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.Object[] getArray(java.lang.String attr)
           Get the values of an array attribute.
 java.util.Date getDate(java.lang.String attr)
           Get the value of a date attribute.
 int getInt(java.lang.String attr)
           Get the value of an int attribute.
 long getLong(java.lang.String attr)
           Get the value of a long attribute.
 java.lang.Object getObject(java.lang.String attr)
           Get the value of an object attribute.
 java.lang.String getString(java.lang.String attr)
           Get the value of a string attribute.
 int hashCode()
           
 void setData(DefaultEntity e)
           Set the given entity's data to the object.
 void setData(java.util.Hashtable data)
           Set a new pack of attributes/values.
 int size()
          Return the number of entries in the entity.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected java.util.Hashtable data

Hashtable object that stores the attributes/values.

Constructor Detail

DefaultEntity

public DefaultEntity()

Create an instance of DefaultEntity class.


DefaultEntity

public DefaultEntity(java.util.Hashtable data)

Create an instance of DefaultEntity class.

Parameters:
data - The initial attributes/values.
Method Detail

setData

public final void setData(java.util.Hashtable data)

Set a new pack of attributes/values.

Parameters:
data - Pack of attributes/values.

setData

public final void setData(DefaultEntity e)

Set the given entity's data to the object.

Parameters:
e - Entity.

getArray

public final java.lang.Object[] getArray(java.lang.String attr)
Description copied from interface: Entity

Get the values of an array attribute.

Specified by:
getArray in interface Entity
Parameters:
attr - Array attribute to query the data for.
Returns:
The array values of the given attribute.
See Also:
Entity.getArray(java.lang.String)

getDate

public final java.util.Date getDate(java.lang.String attr)
Description copied from interface: Entity

Get the value of a date attribute.

Specified by:
getDate in interface Entity
Parameters:
attr - Date attribute to query the data for.
Returns:
The date value of the given attribute.
See Also:
Entity.getDate(java.lang.String)

getInt

public final int getInt(java.lang.String attr)
Description copied from interface: Entity

Get the value of an int attribute.

Specified by:
getInt in interface Entity
Parameters:
attr - Int attribute to query the data for.
Returns:
The int value of the given attribute.
See Also:
Entity.getInt(java.lang.String)

getLong

public final long getLong(java.lang.String attr)
Description copied from interface: Entity

Get the value of a long attribute.

Specified by:
getLong in interface Entity
Parameters:
attr - Long attribute to query the data for.
Returns:
The long value of the given attribute.
See Also:
Entity.getLong(java.lang.String)

getObject

public final java.lang.Object getObject(java.lang.String attr)
Description copied from interface: Entity

Get the value of an object attribute.

Specified by:
getObject in interface Entity
Parameters:
attr - Object attribute to query the data for.
Returns:
The object value of the given attribute.
See Also:
Entity.getObject(java.lang.String)

getString

public final java.lang.String getString(java.lang.String attr)
Description copied from interface: Entity

Get the value of a string attribute.

Specified by:
getString in interface Entity
Parameters:
attr - String attribute to query the data for.
Returns:
The string value of the given attribute.
See Also:
Entity.getString(java.lang.String)

equals

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

hashCode

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

toString

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

size

public final int size()
Return the number of entries in the entity.

Returns:
Number.


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