Class Annotations
java.lang.Object
com.android.dx.util.MutabilityControl
com.android.dx.rop.annotation.Annotations
- All Implemented Interfaces:
Comparable<Annotations>
List of
Annotation instances.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Annotation annotation) Adds an element to this instance.voidaddAll(Annotations toAdd) Adds all of the elements of the given instance to this one.static Annotationscombine(Annotations annotations, Annotation annotation) Constructs an immutable instance which is the combination of the given instance with the given additional annotation.static Annotationscombine(Annotations a1, Annotations a2) Constructs an immutable instance which is the combination of the two given instances.intcompareTo(Annotations other) booleanGets the set of annotations contained in this instance.inthashCode()intsize()Gets the number of elements in this instance.toString()Methods inherited from class MutabilityControl
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutable
-
Field Details
-
EMPTY
non-null;immutable empty instance
-
-
Constructor Details
-
Annotations
public Annotations()Constructs an empty instance.
-
-
Method Details
-
combine
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 instancea2-non-null;the other instance- Returns:
non-null;the combination- Throws:
IllegalArgumentException- thrown if there is a duplicate type
-
combine
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 augmentannotation-non-null;the additional annotation- Returns:
non-null;the combination- Throws:
IllegalArgumentException- thrown if there is a duplicate type
-
hashCode
-
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<Annotations>
-
toString
-
size
public int size()Gets the number of elements in this instance.- Returns:
>= 0;the size
-
add
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
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
Gets the set of annotations contained in this instance. The result is always unmodifiable.- Returns:
non-null;the set of annotations
-