Package com.android.dx.rop.annotation
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Gets the set of annotations contained in this instance.int
hashCode()
int
size()
Gets the number of elements in this instance.toString()
Methods inherited from class com.android.dx.util.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
public int hashCode() -
equals
-
compareTo
- Specified by:
compareTo
in 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
-