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 void
addAnnotation(Annotation ann)
Adds an annotations to this annotation collection.boolean
contains(AnnotationMatcher m)
Returnstrue
ifmatcher
matches at least one of this annotations,false
otherwise.boolean
equals(java.lang.Object obj)
java.util.Collection<Annotation>
getAnnotations()
Yields the list of annotations.Annotations
getAnnotations(AnnotationMatcher m)
Yields the annotations that are matched by the matcherm
.int
hashCode()
boolean
isEmpty()
Yieldstrue
if and only if the set of annotations represented by this instance is empty.java.util.Iterator<Annotation>
iterator()
java.lang.String
toString()
-
-
-
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:
iterator
in interfacejava.lang.Iterable<Annotation>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in 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)
Returnstrue
ifmatcher
matches at least one of this annotations,false
otherwise.- Parameters:
m
- the annotation matcher- Returns:
true
ifmatcher
matches at least one of this annotations,false
otherwise
-
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()
Yieldstrue
if and only if the set of annotations represented by this instance is empty.- Returns:
- whether or not this set of annotations is empty
-
-