public final class Annotations extends MutabilityControl implements Comparable<Annotations>
Annotation instances.| Modifier and Type | Field and Description |
|---|---|
static Annotations |
EMPTY
non-null; immutable empty instance |
| Constructor and Description |
|---|
Annotations()
Constructs an empty instance.
|
| Modifier and Type | Method and Description |
|---|---|
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() |
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutablepublic static final Annotations EMPTY
non-null; immutable empty instancepublic static Annotations combine(Annotations a1, Annotations a2)
a1 - non-null; an instancea2 - non-null; the other instancenon-null; the combinationIllegalArgumentException - thrown if there is a duplicate typepublic static Annotations combine(Annotations annotations, Annotation annotation)
annotations - non-null; the instance to augmentannotation - non-null; the additional annotationnon-null; the combinationIllegalArgumentException - thrown if there is a duplicate typepublic int compareTo(Annotations other)
compareTo in interface Comparable<Annotations>public int size()
>= 0; the sizepublic void add(Annotation annotation)
annotation - non-null; the element to addIllegalArgumentException - thrown if there is a duplicate typepublic void addAll(Annotations toAdd)
toAdd - non-null; the annotations to addIllegalArgumentException - thrown if there is a duplicate typepublic Collection<Annotation> getAnnotations()
non-null; the set of annotationsCopyright © 2016. All Rights Reserved.