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 ofAnnotation
instances- Since:
- 19.3.0
- Author:
- cdivilly
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.AnnotatedElement
element()
The element which is annotated with theseAnnotation
sboolean
equals(java.lang.Object obj)
static AnnotationSet
from(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.int
hashCode()
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.boolean
isEmpty()
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 representQualifier
annotationsjava.lang.annotation.Annotation
scope()
Indicates theScope
annotation if any is presentint
size()
Indicates the number of annotations presentjava.lang.String
toString()
-
-
-
Method Detail
-
element
public java.lang.reflect.AnnotatedElement element()
The element which is annotated with theseAnnotation
s- Returns:
AnnotatedElement
instance
-
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) != null
The 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in 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:
iterator
in interfacejava.lang.Iterable<java.lang.annotation.Annotation>
-
qualifiers
public java.util.Set<java.lang.annotation.Annotation> qualifiers()
Gives the subset of Annotations that representQualifier
annotations
-
scope
public java.lang.annotation.Annotation scope()
Indicates theScope
annotation if any is present- Returns:
- Annotation annotated with
Scope
or 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:
toString
in 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:
AnnotationSet
for the element
-
-