Package org.jboss.jandex
Class AnnotationOverlayImpl.TransformationContextImpl
java.lang.Object
org.jboss.jandex.AnnotationOverlayImpl.TransformationContextImpl
- All Implemented Interfaces:
AnnotationTransformation.TransformationContext
- Enclosing class:
AnnotationOverlayImpl
private static final class AnnotationOverlayImpl.TransformationContextImpl
extends Object
implements AnnotationTransformation.TransformationContext
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Set
<AnnotationInstance> private final Declaration
private final Collection
<AnnotationInstance> -
Constructor Summary
ConstructorsConstructorDescriptionTransformationContextImpl
(Declaration declaration, Collection<AnnotationInstance> annotations) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Class<? extends Annotation> annotationClass) Adds an annotation of givenannotationClass
to the current set of annotations.void
add
(AnnotationInstance annotation) Adds theannotation
to the current set of annotations.void
addAll
(Collection<AnnotationInstance> annotations) Adds allannotations
to the current set of annotations.void
addAll
(AnnotationInstance... annotations) Adds allannotations
to the current set of annotations.Returns the collection of annotations present on the declaration that is being transformed.Returns the declaration that is being transformed.boolean
hasAnnotation
(Class<? extends Annotation> annotationClass) Returns whether the current set of annotations contains an annotation of givenannotationClass
.boolean
hasAnnotation
(Predicate<AnnotationInstance> predicate) Returns whether the current set of annotations contains an annotation that matches givenpredicate
.boolean
hasAnnotation
(DotName annotationName) Returns whether the current set of annotations contains an annotation whose class has givenannotationName
.private void
(package private) boolean
modified()
void
remove
(Predicate<AnnotationInstance> predicate) Removes annotations that match givenpredicate
from the current set of annotations.void
Removes all annotations from current set of annotations.
-
Field Details
-
declaration
-
originalAnnotations
-
annotations
-
-
Constructor Details
-
TransformationContextImpl
TransformationContextImpl(Declaration declaration, Collection<AnnotationInstance> annotations)
-
-
Method Details
-
modified
boolean modified() -
initializeIfNecessary
private void initializeIfNecessary() -
declaration
Description copied from interface:AnnotationTransformation.TransformationContext
Returns the declaration that is being transformed.- Specified by:
declaration
in interfaceAnnotationTransformation.TransformationContext
- Returns:
- the declaration that is being transformed
-
annotations
Description copied from interface:AnnotationTransformation.TransformationContext
Returns the collection of annotations present on the declaration that is being transformed. Reflects all changes done by this annotation transformation and all annotation transformations executed prior to this one.Changes made directly to this collection and changes made through the other
TransformationContext
methods are interchangeable.- Specified by:
annotations
in interfaceAnnotationTransformation.TransformationContext
- Returns:
- the collection of annotations present on the declaration that is being transformed
-
hasAnnotation
Description copied from interface:AnnotationTransformation.TransformationContext
Returns whether the current set of annotations contains an annotation of givenannotationClass
.- Specified by:
hasAnnotation
in interfaceAnnotationTransformation.TransformationContext
- Parameters:
annotationClass
- the annotation class, must not benull
- Returns:
- whether the current set of annotations contains an annotation of given class
-
hasAnnotation
Description copied from interface:AnnotationTransformation.TransformationContext
Returns whether the current set of annotations contains an annotation whose class has givenannotationName
.- Specified by:
hasAnnotation
in interfaceAnnotationTransformation.TransformationContext
- Parameters:
annotationName
- name of the annotation class, must not benull
- Returns:
- whether the current set of annotations contains an annotation of given class
-
hasAnnotation
Description copied from interface:AnnotationTransformation.TransformationContext
Returns whether the current set of annotations contains an annotation that matches givenpredicate
.- Specified by:
hasAnnotation
in interfaceAnnotationTransformation.TransformationContext
- Parameters:
predicate
- the predicate, must not benull
- Returns:
- whether the current set of annotations contains an annotation of given class
-
add
Description copied from interface:AnnotationTransformation.TransformationContext
Adds an annotation of givenannotationClass
to the current set of annotations.The annotation type must have no members.
- Specified by:
add
in interfaceAnnotationTransformation.TransformationContext
- Parameters:
annotationClass
- the class of annotation to add, must not benull
-
add
Description copied from interface:AnnotationTransformation.TransformationContext
Adds theannotation
to the current set of annotations.- Specified by:
add
in interfaceAnnotationTransformation.TransformationContext
- Parameters:
annotation
- the annotation to add, must not benull
-
addAll
Description copied from interface:AnnotationTransformation.TransformationContext
Adds allannotations
to the current set of annotations.- Specified by:
addAll
in interfaceAnnotationTransformation.TransformationContext
- Parameters:
annotations
- the annotations to add, must not benull
-
addAll
Description copied from interface:AnnotationTransformation.TransformationContext
Adds allannotations
to the current set of annotations.- Specified by:
addAll
in interfaceAnnotationTransformation.TransformationContext
- Parameters:
annotations
- the annotations to add, must not benull
-
remove
Description copied from interface:AnnotationTransformation.TransformationContext
Removes annotations that match givenpredicate
from the current set of annotations.- Specified by:
remove
in interfaceAnnotationTransformation.TransformationContext
- Parameters:
predicate
- the annotation predicate, must not benull
-
removeAll
public void removeAll()Description copied from interface:AnnotationTransformation.TransformationContext
Removes all annotations from current set of annotations.- Specified by:
removeAll
in interfaceAnnotationTransformation.TransformationContext
-