Package oracle.dbtools.plugin.api.types
Class AnnotationSet
- java.lang.Object
-
- oracle.dbtools.plugin.api.types.AnnotationSet
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.annotation.Annotation>
public class AnnotationSet extends java.lang.Object implements java.lang.Iterable<java.lang.annotation.Annotation>Immutable set ofAnnotationinstances- Since:
- 19.3.0
- Author:
- cdivilly
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.AnnotatedElementelement()The element which is annotated with theseAnnotationsbooleanequals(java.lang.Object obj)static AnnotationSetfrom(java.lang.reflect.AnnotatedElement element)Generate the set of annotations that this element is annotated with<T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<T> annotationClass)Returns this element's annotation for the specified type if such an annotation is present, else null.inthashCode()booleanisAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)Returns true if an annotation for the specified type is present on this element, else false.booleanisEmpty()Indicates if this annotation set is emptyjava.util.Iterator<java.lang.annotation.Annotation>iterator()java.util.Set<java.lang.annotation.Annotation>qualifiers()Gives the subset of Annotations that representQualifierannotationsjava.lang.annotation.Annotationscope()Indicates theScopeannotation if any is presentintsize()Indicates the number of annotations presentjava.lang.StringtoString()
-
-
-
Method Detail
-
element
public java.lang.reflect.AnnotatedElement element()
The element which is annotated with theseAnnotations- Returns:
AnnotatedElementinstance
-
isAnnotationPresent
public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Returns true if an annotation for the specified type is present on this element, else false. This method is designed primarily for convenient access to marker annotations.The truth value returned by this method is equivalent to:
getAnnotation(annotationClass) != nullThe body of the default method is specified to be the code above.
- Parameters:
annotationClass- the Class object corresponding to the annotation type- Returns:
- true if an annotation for the specified annotation type is present on this element, else false
- Throws:
java.lang.NullPointerException- if the given annotation class is null
-
getAnnotation
public <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<T> annotationClass)
Returns this element's annotation for the specified type if such an annotation is present, else null.- Type Parameters:
T- the type of the annotation to query for and return if present- Parameters:
annotationClass- the Class object corresponding to the annotation type- Returns:
- this element's annotation for the specified annotation type if present on this element, else null
- Throws:
java.lang.NullPointerException- if the given annotation class is null
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
isEmpty
public boolean isEmpty()
Indicates if this annotation set is empty- Returns:
- true if the set is empty, false otherwise
-
iterator
public java.util.Iterator<java.lang.annotation.Annotation> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.annotation.Annotation>
-
qualifiers
public java.util.Set<java.lang.annotation.Annotation> qualifiers()
Gives the subset of Annotations that representQualifierannotations
-
scope
public java.lang.annotation.Annotation scope()
Indicates theScopeannotation if any is present- Returns:
- Annotation annotated with
Scopeor null if no such annotation is present
-
size
public int size()
Indicates the number of annotations present- Returns:
- The number of annotations in this set
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
from
public static AnnotationSet from(java.lang.reflect.AnnotatedElement element)
Generate the set of annotations that this element is annotated with- Parameters:
element- The element to examine- Returns:
AnnotationSetfor the element
-
-