twitter4j
Class Annotations

java.lang.Object
  extended by twitter4j.Annotations
All Implemented Interfaces:
java.io.Serializable

public class Annotations
extends java.lang.Object
implements java.io.Serializable

A data class representing the Annotations of a Status or a Tweet

Since:
Twitter4J 2.1.4
Author:
Roy Reshef - royreshef at gmail.com
See Also:
Annotations Overview | dev.twitter.com, Serialized Form

Field Summary
private  java.util.List<Annotation> annotations
           
static int lengthLimit
           
private static long serialVersionUID
           
 
Constructor Summary
Annotations()
          Construct empty Annotations instance
Annotations(twitter4j.internal.org.json.JSONArray jsonArray)
          Construct Annotations instance from a JSON Array, returned from Twitter API Package visibility only!
Annotations(java.util.List<Annotation> annotations)
          Construct Annotations instance from an exisiting List of Annotation instances
 
Method Summary
 void addAnnotation(Annotation annotation)
          Adds a single Annotation to the List of Annotation instances
 Annotations annotation(Annotation annotation)
          Adds a single Annotation to the List of Annotation instances
(package private)  java.lang.String asParameterValue()
          Package visibility only!
 boolean equals(java.lang.Object obj)
           
 java.util.List<Annotation> getAnnotations()
           
private  java.util.List<Annotation> getSortedAnnotations()
           
 int hashCode()
           
 boolean isEmpty()
           
 boolean isExceedingLengthLimit()
           
static boolean isExceedingLengthLimit(Annotations annotations)
           
 void setAnnotations(java.util.List<Annotation> annotations)
          Sets the List of Annotation instances Ensures the class's property is not null
 java.lang.Integer size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

lengthLimit

public static final int lengthLimit
See Also:
Constant Field Values

annotations

private java.util.List<Annotation> annotations
Constructor Detail

Annotations

public Annotations()
Construct empty Annotations instance


Annotations

public Annotations(java.util.List<Annotation> annotations)
Construct Annotations instance from an exisiting List of Annotation instances

Parameters:
annotations - - the List of Annotation instances

Annotations

Annotations(twitter4j.internal.org.json.JSONArray jsonArray)
Construct Annotations instance from a JSON Array, returned from Twitter API Package visibility only!

Parameters:
jsonArray - - the JSON Array
Method Detail

getAnnotations

public java.util.List<Annotation> getAnnotations()
Returns:
the List of Annotation instances

setAnnotations

public void setAnnotations(java.util.List<Annotation> annotations)
Sets the List of Annotation instances Ensures the class's property is not null

Parameters:
annotations - - the List of Annotation instances

addAnnotation

public void addAnnotation(Annotation annotation)
Adds a single Annotation to the List of Annotation instances

Parameters:
annotation - - the Annotation to add

annotation

public Annotations annotation(Annotation annotation)
Adds a single Annotation to the List of Annotation instances

Parameters:
annotation - - the Annotation to add
Returns:
this (for coding convenience)

isEmpty

public boolean isEmpty()
Returns:
true if the List of Annotation instances is empty, false otherwise

size

public java.lang.Integer size()
Returns:
the number of Annotation instances in the List

isExceedingLengthLimit

public static boolean isExceedingLengthLimit(Annotations annotations)
Parameters:
annotations - - the instance to test
Returns:
true if the JSON String representation of the instance exceeds the limit imposed by Twitter, false otherwise

isExceedingLengthLimit

public boolean isExceedingLengthLimit()
Returns:
true if the JSON String representation of this exceeds the limit imposed by Twitter, false otherwise

asParameterValue

java.lang.String asParameterValue()
Package visibility only!

Returns:
the JSON String representation of this

equals

public boolean equals(java.lang.Object obj)
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

getSortedAnnotations

private java.util.List<Annotation> getSortedAnnotations()
Returns:
a sorted copy of the List of Annotation instances