Package org.jboss.jandex
Interface MutableAnnotationOverlay
-
- All Superinterfaces:
AnnotationOverlay
- All Known Implementing Classes:
MutableAnnotationOverlayImpl
public interface MutableAnnotationOverlay extends AnnotationOverlay
AnAnnotationOverlaythat can be freely mutated. Thefreeze()operation returns a list of annotation transformations that can later be used to create an equivalent immutable annotation overlay.- Since:
- 3.2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classMutableAnnotationOverlay.BuilderThe builder for a mutable annotation overlay.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddAnnotation(Declaration declaration, AnnotationInstance annotation)Adds given annotation instance to givendeclaration.static MutableAnnotationOverlay.Builderbuilder(IndexView index)Returns a new builder for a mutable annotation overlay for givenindex.java.util.List<AnnotationTransformation>freeze()Freezes this mutable annotation overlay and returns the annotation transformations to create an equivalent immutable annotation overlay.voidremoveAnnotations(Declaration declaration, java.util.function.Predicate<AnnotationInstance> predicate)Removes all annotations matching givenpredicatefrom givendeclaration.-
Methods inherited from interface org.jboss.jandex.AnnotationOverlay
annotation, annotation, annotations, annotationsWithRepeatable, annotationsWithRepeatable, hasAnnotation, hasAnnotation, hasAnyAnnotation, hasAnyAnnotation, index
-
-
-
-
Method Detail
-
builder
static MutableAnnotationOverlay.Builder builder(IndexView index)
Returns a new builder for a mutable annotation overlay for givenindex.Thread safety
The object returned by the builder is not thread safe and should be confined to a single thread. After calling
freeze(), the object becomes immutable and can be shared between threads.- Parameters:
index- the Jandex index, must not benull- Returns:
- the mutable annotation overlay builder, never
null
-
addAnnotation
void addAnnotation(Declaration declaration, AnnotationInstance annotation)
Adds given annotation instance to givendeclaration. When asking this annotation overlay about annotation information for given declaration, the results will include given annotation instance.- Parameters:
declaration- the declaration to modify, must not benullannotation- the annotation instance to add todeclarationfor, must not benull
-
removeAnnotations
void removeAnnotations(Declaration declaration, java.util.function.Predicate<AnnotationInstance> predicate)
Removes all annotations matching givenpredicatefrom givendeclaration. When asking this annotation overlay about annotation information for given declaration, the results will not include matching annotation instances.- Parameters:
declaration- the declaration to modify, must not benullpredicate- the annotation predicate, must not benull
-
freeze
java.util.List<AnnotationTransformation> freeze()
Freezes this mutable annotation overlay and returns the annotation transformations to create an equivalent immutable annotation overlay. After freezing, theaddAnnotation(Declaration, AnnotationInstance)andremoveAnnotations(Declaration, Predicate)methods will throw an exception.- Returns:
- immutable list of annotation transformations equivalent to mutations performed on this annotation overlay,
never
null
-
-