Class AnnotationOverlayImpl
- java.lang.Object
-
- org.jboss.jandex.AnnotationOverlayImpl
-
- All Implemented Interfaces:
AnnotationOverlay
- Direct Known Subclasses:
MutableAnnotationOverlayImpl
class AnnotationOverlayImpl extends java.lang.Object implements AnnotationOverlay
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
AnnotationOverlayImpl.TransformationContextImpl
-
Nested classes/interfaces inherited from interface org.jboss.jandex.AnnotationOverlay
AnnotationOverlay.Builder
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
compatibleMode
(package private) IndexView
index
(package private) boolean
inheritedAnnotations
(package private) java.util.Map<EquivalenceKey,java.util.Collection<AnnotationInstance>>
overlay
(package private) boolean
runtimeAnnotationsOnly
(package private) java.util.List<AnnotationTransformation>
transformations
-
Constructor Summary
Constructors Constructor Description AnnotationOverlayImpl(IndexView index, boolean compatibleMode, boolean runtimeAnnotationsOnly, boolean inheritedAnnotations, java.util.Collection<AnnotationTransformation> annotationTransformations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnotationInstance
annotation(Declaration declaration, DotName name)
Returns the annotation instance with givenname
declared on givendeclaration
.java.util.Collection<AnnotationInstance>
annotations(Declaration declaration)
Returns the annotation instances declared on givendeclaration
.java.util.Collection<AnnotationInstance>
annotationsWithRepeatable(Declaration declaration, DotName name)
Returns the annotation instances with givenname
declared on givendeclaration
.(package private) java.util.Collection<AnnotationInstance>
getAnnotationsFor(Declaration declaration)
(package private) java.util.Collection<AnnotationInstance>
getOriginalAnnotations(Declaration declaration)
boolean
hasAnnotation(Declaration declaration, DotName name)
Returns whether an annotation instance with givenname
is declared on givendeclaration
.boolean
hasAnyAnnotation(Declaration declaration, java.util.Set<DotName> names)
Returns whether any annotation instance with one of givennames
is declared on givendeclaration
.IndexView
index()
Returns the index whose annotation information is being overlaid.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.jandex.AnnotationOverlay
annotation, annotationsWithRepeatable, hasAnnotation, hasAnyAnnotation
-
-
-
-
Field Detail
-
index
final IndexView index
-
compatibleMode
final boolean compatibleMode
-
runtimeAnnotationsOnly
final boolean runtimeAnnotationsOnly
-
inheritedAnnotations
final boolean inheritedAnnotations
-
transformations
final java.util.List<AnnotationTransformation> transformations
-
overlay
final java.util.Map<EquivalenceKey,java.util.Collection<AnnotationInstance>> overlay
-
-
Constructor Detail
-
AnnotationOverlayImpl
AnnotationOverlayImpl(IndexView index, boolean compatibleMode, boolean runtimeAnnotationsOnly, boolean inheritedAnnotations, java.util.Collection<AnnotationTransformation> annotationTransformations)
-
-
Method Detail
-
index
public final IndexView index()
Description copied from interface:AnnotationOverlay
Returns the index whose annotation information is being overlaid.- Specified by:
index
in interfaceAnnotationOverlay
- Returns:
- the index underlying this annotation overlay, never
null
-
hasAnnotation
public final boolean hasAnnotation(Declaration declaration, DotName name)
Description copied from interface:AnnotationOverlay
Returns whether an annotation instance with givenname
is declared on givendeclaration
.Like
AnnotationTarget.hasDeclaredAnnotation(DotName)
, and unlikeAnnotationTarget.hasAnnotation(DotName)
, this method ignores annotations declared on nested annotation targets. This doesn't hold in case of methods in the compatible mode, where method parameters are considered part of methods.- Specified by:
hasAnnotation
in interfaceAnnotationOverlay
- Parameters:
declaration
- the declaration to inspect, must not benull
name
- name of the annotation type to look for, must not benull
- Returns:
true
if the annotation is present,false
otherwise
-
hasAnyAnnotation
public final boolean hasAnyAnnotation(Declaration declaration, java.util.Set<DotName> names)
Description copied from interface:AnnotationOverlay
Returns whether any annotation instance with one of givennames
is declared on givendeclaration
.This method ignores annotations declared on nested annotation targets. This doesn't hold in case of methods in the compatible mode, where method parameters are considered part of methods.
- Specified by:
hasAnyAnnotation
in interfaceAnnotationOverlay
- Parameters:
declaration
- the declaration to inspect, must not benull
names
- names of the annotation types to look for, must not benull
- Returns:
true
if any of the annotations is present,false
otherwise
-
annotation
public final AnnotationInstance annotation(Declaration declaration, DotName name)
Description copied from interface:AnnotationOverlay
Returns the annotation instance with givenname
declared on givendeclaration
.Like
AnnotationTarget.declaredAnnotation(DotName)
, and unlikeAnnotationTarget.annotation(DotName)
, this method doesn't return annotations declared on nested annotation targets. This doesn't hold in case of methods in the compatible mode, where method parameters are considered part of methods. In such case, if more than one annotation of givenname
is present, an unspecified instance is returned.- Specified by:
annotation
in interfaceAnnotationOverlay
- Parameters:
declaration
- the declaration to inspect, must not benull
name
- name of the annotation type to look for, must not benull
- Returns:
- the annotation instance, or
null
if not found
-
annotationsWithRepeatable
public final java.util.Collection<AnnotationInstance> annotationsWithRepeatable(Declaration declaration, DotName name)
Description copied from interface:AnnotationOverlay
Returns the annotation instances with givenname
declared on givendeclaration
. If the specified annotation is repeatable, the result also contains all values from the container annotation instance.The annotation class must be present in the index underlying this annotation overlay.
Like
AnnotationTarget.declaredAnnotationsWithRepeatable(DotName, IndexView)
, and unlikeAnnotationTarget.annotationsWithRepeatable(DotName, IndexView)
, this method doesn't return annotations declared on nested annotation targets. This doesn't hold in case of methods in the compatible mode, where method parameters are considered part of methods.- Specified by:
annotationsWithRepeatable
in interfaceAnnotationOverlay
- Parameters:
declaration
- the declaration to inspect, must not benull
name
- name of the annotation type, must not benull
- Returns:
- immutable collection of annotation instances, never
null
-
annotations
public final java.util.Collection<AnnotationInstance> annotations(Declaration declaration)
Description copied from interface:AnnotationOverlay
Returns the annotation instances declared on givendeclaration
.Like
AnnotationTarget.declaredAnnotations()
, and unlikeAnnotationTarget.annotations()
, this method doesn't return annotations declared on nested annotation targets. This doesn't hold in case of methods in the compatible mode, where method parameters are considered part of methods.- Specified by:
annotations
in interfaceAnnotationOverlay
- Parameters:
declaration
- the declaration to inspect, must not benull
- Returns:
- immutable collection of annotation instances, never
null
-
getAnnotationsFor
java.util.Collection<AnnotationInstance> getAnnotationsFor(Declaration declaration)
-
getOriginalAnnotations
final java.util.Collection<AnnotationInstance> getOriginalAnnotations(Declaration declaration)
-
-