Package org.jboss.jandex
Class AnnotationTransformation.Builder<THIS extends AnnotationTransformation.Builder<THIS>>
- java.lang.Object
-
- org.jboss.jandex.AnnotationTransformation.Builder<THIS>
-
- Type Parameters:
THIS
- type of this builder
- Direct Known Subclasses:
AnnotationTransformation.ClassBuilder
,AnnotationTransformation.DeclarationBuilder
,AnnotationTransformation.FieldBuilder
,AnnotationTransformation.MethodBuilder
,AnnotationTransformation.MethodParameterBuilder
,AnnotationTransformation.RecordComponentBuilder
- Enclosing interface:
- AnnotationTransformation
public abstract static class AnnotationTransformation.Builder<THIS extends AnnotationTransformation.Builder<THIS>> extends java.lang.Object
Abstract class for annotation transformation builders.- See Also:
priority(int)
,whenAnyMatch(Class...)
,whenAnyMatch(DotName...)
,whenAnyMatch(List)
,whenAnyMatch(Predicate)
,whenAllMatch(Class...)
,whenAllMatch(DotName...)
,whenAllMatch(List)
,whenAllMatch(Predicate)
,whenNoneMatch(Class...)
,whenNoneMatch(DotName...)
,whenNoneMatch(List)
,whenNoneMatch(Predicate)
,when(Predicate)
,AnnotationTransformation.DeclarationBuilder
,AnnotationTransformation.ClassBuilder
,AnnotationTransformation.FieldBuilder
,AnnotationTransformation.MethodBuilder
,AnnotationTransformation.MethodParameterBuilder
,AnnotationTransformation.RecordComponentBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private AnnotationTarget.Kind
kind
private java.util.function.Predicate<AnnotationTransformation.TransformationContext>
predicate
private int
priority
-
Constructor Summary
Constructors Constructor Description Builder(AnnotationTarget.Kind kind)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.util.function.Predicate<AnnotationInstance>
annotationPredicate(java.lang.Class<? extends java.lang.annotation.Annotation>... classes)
private static java.util.function.Predicate<AnnotationInstance>
annotationPredicate(DotName... classes)
THIS
priority(int priority)
Sets the priority of the built annotation transformation.(package private) THIS
self()
AnnotationTransformation
transform(java.util.function.Consumer<AnnotationTransformation.TransformationContext> transformation)
Builds an annotation transformation based on the giventransformation
function.THIS
when(java.util.function.Predicate<AnnotationTransformation.TransformationContext> predicate)
Adds a predicate to the list of predicates that will be tested before applying the transformation.THIS
whenAllMatch(java.lang.Class<? extends java.lang.annotation.Annotation>... classes)
Adds a predicate that tests whether all of the current set of annotations are of givenclasses
.THIS
whenAllMatch(java.util.function.Predicate<AnnotationInstance> predicate)
Adds a predicate that tests whether all of the current set of annotations match the givenpredicate
.THIS
whenAllMatch(java.util.List<DotName> classes)
Adds a predicate that tests whether all of the current set of annotations are of givenclasses
.THIS
whenAllMatch(DotName... classes)
Adds a predicate that tests whether all of the current set of annotations are of givenclasses
.THIS
whenAnyMatch(java.lang.Class<? extends java.lang.annotation.Annotation>... classes)
Adds a predicate that tests whether any of the current set of annotations is of givenclasses
.THIS
whenAnyMatch(java.util.function.Predicate<AnnotationInstance> predicate)
Adds a predicate that tests whether any of the current set of annotations matches the givenpredicate
.THIS
whenAnyMatch(java.util.List<DotName> classes)
Adds a predicate that tests whether any of the current set of annotations is of givenclasses
.THIS
whenAnyMatch(DotName... classes)
Adds a predicate that tests whether any of the current set of annotations is of givenclasses
.THIS
whenNoneMatch(java.lang.Class<? extends java.lang.annotation.Annotation>... classes)
Adds a predicate that tests whether none of the current set of annotations is of givenclasses
.THIS
whenNoneMatch(java.util.function.Predicate<AnnotationInstance> predicate)
Adds a predicate that tests whether none of the current set of annotations matches the givenpredicate
.THIS
whenNoneMatch(java.util.List<DotName> classes)
Adds a predicate that tests whether none of the current set of annotations is of givenclasses
.THIS
whenNoneMatch(DotName... classes)
Adds a predicate that tests whether none of the current set of annotations is of givenclasses
.
-
-
-
Field Detail
-
kind
private final AnnotationTarget.Kind kind
-
priority
private int priority
-
predicate
private java.util.function.Predicate<AnnotationTransformation.TransformationContext> predicate
-
-
Constructor Detail
-
Builder
Builder(AnnotationTarget.Kind kind)
-
-
Method Detail
-
priority
public final THIS priority(int priority)
Sets the priority of the built annotation transformation. By default, the priority isAnnotationTransformation.DEFAULT_PRIORITY_VALUE
.- Parameters:
priority
- the priority- Returns:
- this builder
-
annotationPredicate
@SafeVarargs private static java.util.function.Predicate<AnnotationInstance> annotationPredicate(java.lang.Class<? extends java.lang.annotation.Annotation>... classes)
-
annotationPredicate
private static java.util.function.Predicate<AnnotationInstance> annotationPredicate(DotName... classes)
-
whenAnyMatch
@SafeVarargs public final THIS whenAnyMatch(java.lang.Class<? extends java.lang.annotation.Annotation>... classes)
Adds a predicate that tests whether any of the current set of annotations is of givenclasses
.- Parameters:
classes
- the annotation classes, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenAnyMatch
public final THIS whenAnyMatch(DotName... classes)
Adds a predicate that tests whether any of the current set of annotations is of givenclasses
.- Parameters:
classes
- the annotation classes, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenAnyMatch
public final THIS whenAnyMatch(java.util.List<DotName> classes)
Adds a predicate that tests whether any of the current set of annotations is of givenclasses
.- Parameters:
classes
- the annotation classes, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenAnyMatch
public final THIS whenAnyMatch(java.util.function.Predicate<AnnotationInstance> predicate)
Adds a predicate that tests whether any of the current set of annotations matches the givenpredicate
.- Parameters:
predicate
- the predicate, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenAllMatch
@SafeVarargs public final THIS whenAllMatch(java.lang.Class<? extends java.lang.annotation.Annotation>... classes)
Adds a predicate that tests whether all of the current set of annotations are of givenclasses
.- Parameters:
classes
- the annotation classes, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenAllMatch
public final THIS whenAllMatch(DotName... classes)
Adds a predicate that tests whether all of the current set of annotations are of givenclasses
.- Parameters:
classes
- the annotation classes, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenAllMatch
public final THIS whenAllMatch(java.util.List<DotName> classes)
Adds a predicate that tests whether all of the current set of annotations are of givenclasses
.- Parameters:
classes
- the annotation classes, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenAllMatch
public final THIS whenAllMatch(java.util.function.Predicate<AnnotationInstance> predicate)
Adds a predicate that tests whether all of the current set of annotations match the givenpredicate
.- Parameters:
predicate
- the predicate, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenNoneMatch
@SafeVarargs public final THIS whenNoneMatch(java.lang.Class<? extends java.lang.annotation.Annotation>... classes)
Adds a predicate that tests whether none of the current set of annotations is of givenclasses
.- Parameters:
classes
- the annotation classes, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenNoneMatch
public final THIS whenNoneMatch(DotName... classes)
Adds a predicate that tests whether none of the current set of annotations is of givenclasses
.- Parameters:
classes
- the annotation classes, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenNoneMatch
public final THIS whenNoneMatch(java.util.List<DotName> classes)
Adds a predicate that tests whether none of the current set of annotations is of givenclasses
.- Parameters:
classes
- the annotation classes, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
whenNoneMatch
public final THIS whenNoneMatch(java.util.function.Predicate<AnnotationInstance> predicate)
Adds a predicate that tests whether none of the current set of annotations matches the givenpredicate
.- Parameters:
predicate
- the predicate, must not benull
- Returns:
- this builder
- See Also:
when(Predicate)
-
when
public THIS when(java.util.function.Predicate<AnnotationTransformation.TransformationContext> predicate)
Adds a predicate to the list of predicates that will be tested before applying the transformation. If some of the predicates returnsfalse
, the transformation is not applied. In other words, the predicates are combined using logical and (conjunction).- Parameters:
predicate
- the predicate, must not benull
- Returns:
- this builder
-
transform
public AnnotationTransformation transform(java.util.function.Consumer<AnnotationTransformation.TransformationContext> transformation)
Builds an annotation transformation based on the giventransformation
function.- Parameters:
transformation
- the transformation function, must not benull
- Returns:
- the built annotation transformation, never
null
-
self
THIS self()
-
-