public final class Annotations extends MutabilityControl implements java.lang.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(java.lang.Object other) |
java.util.Collection<Annotation> |
getAnnotations()
Gets the set of annotations contained in this instance.
|
int |
hashCode() |
int |
size()
Gets the number of elements in this instance.
|
java.lang.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 combinationjava.lang.IllegalArgumentException - 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 combinationjava.lang.IllegalArgumentException - thrown if there is a duplicate typepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int compareTo(Annotations other)
compareTo in interface java.lang.Comparable<Annotations>public java.lang.String toString()
toString in class java.lang.Objectpublic int size()
>= 0; the sizepublic void add(Annotation annotation)
annotation - non-null; the element to addjava.lang.IllegalArgumentException - thrown if there is a duplicate typepublic void addAll(Annotations toAdd)
toAdd - non-null; the annotations to addjava.lang.IllegalArgumentException - thrown if there is a duplicate typepublic java.util.Collection<Annotation> getAnnotations()
non-null; the set of annotationsCopyright © 2020. All Rights Reserved.