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 java.lang.Object implements AnnotationTransformation.TransformationContext
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<AnnotationInstance>annotationsprivate Declarationdeclarationprivate java.util.Collection<AnnotationInstance>originalAnnotations
-
Constructor Summary
Constructors Constructor Description TransformationContextImpl(Declaration declaration, java.util.Collection<AnnotationInstance> annotations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)Adds an annotation of givenannotationClassto the current set of annotations.voidadd(AnnotationInstance annotation)Adds theannotationto the current set of annotations.voidaddAll(java.util.Collection<AnnotationInstance> annotations)Adds allannotationsto the current set of annotations.voidaddAll(AnnotationInstance... annotations)Adds allannotationsto the current set of annotations.java.util.Collection<AnnotationInstance>annotations()Returns the collection of annotations present on the declaration that is being transformed.Declarationdeclaration()Returns the declaration that is being transformed.booleanhasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)Returns whether the current set of annotations contains an annotation of givenannotationClass.booleanhasAnnotation(java.util.function.Predicate<AnnotationInstance> predicate)Returns whether the current set of annotations contains an annotation that matches givenpredicate.booleanhasAnnotation(DotName annotationName)Returns whether the current set of annotations contains an annotation whose class has givenannotationName.private voidinitializeIfNecessary()(package private) booleanmodified()voidremove(java.util.function.Predicate<AnnotationInstance> predicate)Removes annotations that match givenpredicatefrom the current set of annotations.voidremoveAll()Removes all annotations from current set of annotations.
-
-
-
Field Detail
-
declaration
private final Declaration declaration
-
originalAnnotations
private final java.util.Collection<AnnotationInstance> originalAnnotations
-
annotations
private java.util.Set<AnnotationInstance> annotations
-
-
Constructor Detail
-
TransformationContextImpl
TransformationContextImpl(Declaration declaration, java.util.Collection<AnnotationInstance> annotations)
-
-
Method Detail
-
modified
boolean modified()
-
initializeIfNecessary
private void initializeIfNecessary()
-
declaration
public Declaration declaration()
Description copied from interface:AnnotationTransformation.TransformationContextReturns the declaration that is being transformed.- Specified by:
declarationin interfaceAnnotationTransformation.TransformationContext- Returns:
- the declaration that is being transformed
-
annotations
public java.util.Collection<AnnotationInstance> annotations()
Description copied from interface:AnnotationTransformation.TransformationContextReturns 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
TransformationContextmethods are interchangeable.- Specified by:
annotationsin interfaceAnnotationTransformation.TransformationContext- Returns:
- the collection of annotations present on the declaration that is being transformed
-
hasAnnotation
public boolean hasAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Description copied from interface:AnnotationTransformation.TransformationContextReturns whether the current set of annotations contains an annotation of givenannotationClass.- Specified by:
hasAnnotationin interfaceAnnotationTransformation.TransformationContext- Parameters:
annotationClass- the annotation class, must not benull- Returns:
- whether the current set of annotations contains an annotation of given class
-
hasAnnotation
public boolean hasAnnotation(DotName annotationName)
Description copied from interface:AnnotationTransformation.TransformationContextReturns whether the current set of annotations contains an annotation whose class has givenannotationName.- Specified by:
hasAnnotationin 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
public boolean hasAnnotation(java.util.function.Predicate<AnnotationInstance> predicate)
Description copied from interface:AnnotationTransformation.TransformationContextReturns whether the current set of annotations contains an annotation that matches givenpredicate.- Specified by:
hasAnnotationin interfaceAnnotationTransformation.TransformationContext- Parameters:
predicate- the predicate, must not benull- Returns:
- whether the current set of annotations contains an annotation of given class
-
add
public void add(java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Description copied from interface:AnnotationTransformation.TransformationContextAdds an annotation of givenannotationClassto the current set of annotations.The annotation type must have no members.
- Specified by:
addin interfaceAnnotationTransformation.TransformationContext- Parameters:
annotationClass- the class of annotation to add, must not benull
-
add
public void add(AnnotationInstance annotation)
Description copied from interface:AnnotationTransformation.TransformationContextAdds theannotationto the current set of annotations.- Specified by:
addin interfaceAnnotationTransformation.TransformationContext- Parameters:
annotation- the annotation to add, must not benull
-
addAll
public void addAll(AnnotationInstance... annotations)
Description copied from interface:AnnotationTransformation.TransformationContextAdds allannotationsto the current set of annotations.- Specified by:
addAllin interfaceAnnotationTransformation.TransformationContext- Parameters:
annotations- the annotations to add, must not benull
-
addAll
public void addAll(java.util.Collection<AnnotationInstance> annotations)
Description copied from interface:AnnotationTransformation.TransformationContextAdds allannotationsto the current set of annotations.- Specified by:
addAllin interfaceAnnotationTransformation.TransformationContext- Parameters:
annotations- the annotations to add, must not benull
-
remove
public void remove(java.util.function.Predicate<AnnotationInstance> predicate)
Description copied from interface:AnnotationTransformation.TransformationContextRemoves annotations that match givenpredicatefrom the current set of annotations.- Specified by:
removein interfaceAnnotationTransformation.TransformationContext- Parameters:
predicate- the annotation predicate, must not benull
-
removeAll
public void removeAll()
Description copied from interface:AnnotationTransformation.TransformationContextRemoves all annotations from current set of annotations.- Specified by:
removeAllin interfaceAnnotationTransformation.TransformationContext
-
-