Class Annotations
- java.lang.Object
-
- it.unive.lisa.program.annotations.Annotations
-
- All Implemented Interfaces:
java.lang.Iterable<Annotation>
public class Annotations extends java.lang.Object implements java.lang.Iterable<Annotation>
A collection of annotations.
-
-
Constructor Summary
Constructors Constructor Description Annotations(Annotation... annotations)Builds a collection of annotations from an array of annotations.Annotations(java.util.Collection<Annotation> annotations)Builds a collection of annotations from a given collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(Annotation ann)Adds an annotations to this annotation collection.booleancontains(AnnotationMatcher m)Returnstrueifmatchermatches at least one of this annotations,falseotherwise.booleanequals(java.lang.Object obj)java.util.Collection<Annotation>getAnnotations()Yields the list of annotations.AnnotationsgetAnnotations(AnnotationMatcher m)Yields the annotations that are matched by the matcherm.inthashCode()booleanisEmpty()Yieldstrueif and only if the set of annotations represented by this instance is empty.java.util.Iterator<Annotation>iterator()java.lang.StringtoString()
-
-
-
Constructor Detail
-
Annotations
public Annotations(Annotation... annotations)
Builds a collection of annotations from an array of annotations.- Parameters:
annotations- the array of annotations
-
Annotations
public Annotations(java.util.Collection<Annotation> annotations)
Builds a collection of annotations from a given collection.- Parameters:
annotations- the collection of annotations
-
-
Method Detail
-
getAnnotations
public java.util.Collection<Annotation> getAnnotations()
Yields the list of annotations.- Returns:
- the list of annotations
-
iterator
public java.util.Iterator<Annotation> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<Annotation>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
addAnnotation
public void addAnnotation(Annotation ann)
Adds an annotations to this annotation collection.- Parameters:
ann- the annotation to be added
-
contains
public final boolean contains(AnnotationMatcher m)
Returnstrueifmatchermatches at least one of this annotations,falseotherwise.- Parameters:
m- the annotation matcher- Returns:
trueifmatchermatches at least one of this annotations,falseotherwise
-
getAnnotations
public final Annotations getAnnotations(AnnotationMatcher m)
Yields the annotations that are matched by the matcherm.- Parameters:
m- the annotation matcher- Returns:
- the annotations that are matched by the matcher
m
-
isEmpty
public final boolean isEmpty()
Yieldstrueif and only if the set of annotations represented by this instance is empty.- Returns:
- whether or not this set of annotations is empty
-
-