com.android.dx.rop.annotation
Class Annotations

java.lang.Object
  extended by com.android.dx.util.MutabilityControl
      extended by com.android.dx.rop.annotation.Annotations
All Implemented Interfaces:
Comparable<Annotations>

public final class Annotations
extends MutabilityControl
implements Comparable<Annotations>

List of Annotation instances.


Field Summary
static Annotations EMPTY
          non-null; immutable empty instance
 
Constructor Summary
Annotations()
          Constructs an empty instance.
 
Method Summary
 void add(Annotation annotation)
          Adds an element to this instance.
 void addAll(Annotations toAdd)
          Adds all of the elements of the given instance to this one.
static Annotations combine(Annotations annotations, Annotation annotation)
          Constructs an immutable instance which is the combination of the given instance with the given additional annotation.
static Annotations combine(Annotations a1, Annotations a2)
          Constructs an immutable instance which is the combination of the two given instances.
 int compareTo(Annotations other)
          
 boolean equals(Object other)
          
 Collection<Annotation> getAnnotations()
          Gets the set of annotations contained in this instance.
 int hashCode()
          
 int size()
          Gets the number of elements in this instance.
 String toString()
          
 
Methods inherited from class com.android.dx.util.MutabilityControl
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final Annotations EMPTY
non-null; immutable empty instance

Constructor Detail

Annotations

public Annotations()
Constructs an empty instance.

Method Detail

combine

public static Annotations combine(Annotations a1,
                                  Annotations a2)
Constructs an immutable instance which is the combination of the two given instances. The two instances must contain disjoint sets of types.

Parameters:
a1 - non-null; an instance
a2 - non-null; the other instance
Returns:
non-null; the combination
Throws:
IllegalArgumentException - thrown if there is a duplicate type

combine

public static Annotations combine(Annotations annotations,
                                  Annotation annotation)
Constructs an immutable instance which is the combination of the given instance with the given additional annotation. The latter's type must not already appear in the former.

Parameters:
annotations - non-null; the instance to augment
annotation - non-null; the additional annotation
Returns:
non-null; the combination
Throws:
IllegalArgumentException - thrown if there is a duplicate type

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object other)

Overrides:
equals in class Object

compareTo

public int compareTo(Annotations other)

Specified by:
compareTo in interface Comparable<Annotations>

toString

public String toString()

Overrides:
toString in class Object

size

public int size()
Gets the number of elements in this instance.

Returns:
>= 0; the size

add

public void add(Annotation annotation)
Adds an element to this instance. There must not already be an element of the same type.

Parameters:
annotation - non-null; the element to add
Throws:
IllegalArgumentException - thrown if there is a duplicate type

addAll

public void addAll(Annotations toAdd)
Adds all of the elements of the given instance to this one. The instances must not have any duplicate types.

Parameters:
toAdd - non-null; the annotations to add
Throws:
IllegalArgumentException - thrown if there is a duplicate type

getAnnotations

public Collection<Annotation> getAnnotations()
Gets the set of annotations contained in this instance. The result is always unmodifiable.

Returns:
non-null; the set of annotations


Copyright © 2013. All Rights Reserved.