Interface MethodConfig
-
- All Superinterfaces:
DeclarationConfig
public interface MethodConfig extends DeclarationConfig
Allows adding annotations to and removing annotations from a method. Note that the method is not physically altered, the modifications are only seen by the CDI container.- Since:
- 4.0
- See Also:
Enhancement
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MethodConfig
addAnnotation(jakarta.enterprise.lang.model.AnnotationInfo annotation)
Adds given annotation to this method.MethodConfig
addAnnotation(java.lang.annotation.Annotation annotation)
Adds given annotation to this method.MethodConfig
addAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Adds a marker annotation of given type to this method.jakarta.enterprise.lang.model.declarations.MethodInfo
info()
Returns theMethodInfo
corresponding to this transformed method.java.util.List<ParameterConfig>
parameters()
Returns a list ofParameterConfig
objects for each parameter of this method.MethodConfig
removeAllAnnotations()
Removes all annotations from this method.MethodConfig
removeAnnotation(java.util.function.Predicate<jakarta.enterprise.lang.model.AnnotationInfo> predicate)
Removes all annotations matching given predicate from this method.
-
-
-
Method Detail
-
info
jakarta.enterprise.lang.model.declarations.MethodInfo info()
Returns theMethodInfo
corresponding to this transformed method.- Specified by:
info
in interfaceDeclarationConfig
- Returns:
- the
MethodInfo
corresponding to this transformed method, nevernull
-
addAnnotation
MethodConfig addAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Adds a marker annotation of given type to this method. Does not allow configuring annotation members.- Specified by:
addAnnotation
in interfaceDeclarationConfig
- Parameters:
annotationType
- the annotation type, must not benull
- Returns:
- this configurator object, to allow fluent usage
-
addAnnotation
MethodConfig addAnnotation(jakarta.enterprise.lang.model.AnnotationInfo annotation)
Adds given annotation to this method. TheAnnotationInfo
can be obtained from an annotation target, or constructed from scratch usingAnnotationBuilder
.- Specified by:
addAnnotation
in interfaceDeclarationConfig
- Parameters:
annotation
- the annotation to add to this method, must not benull
- Returns:
- this configurator object, to allow fluent usage
-
addAnnotation
MethodConfig addAnnotation(java.lang.annotation.Annotation annotation)
Adds given annotation to this method. The annotation instance is typically a subclass ofAnnotationLiteral
.- Specified by:
addAnnotation
in interfaceDeclarationConfig
- Parameters:
annotation
- the annotation to add to this method, must not benull
- Returns:
- this configurator object, to allow fluent usage
-
removeAnnotation
MethodConfig removeAnnotation(java.util.function.Predicate<jakarta.enterprise.lang.model.AnnotationInfo> predicate)
Removes all annotations matching given predicate from this method.- Specified by:
removeAnnotation
in interfaceDeclarationConfig
- Parameters:
predicate
- an annotation predicate, must not benull
- Returns:
- this configurator object, to allow fluent usage
-
removeAllAnnotations
MethodConfig removeAllAnnotations()
Removes all annotations from this method.- Specified by:
removeAllAnnotations
in interfaceDeclarationConfig
- Returns:
- this configurator object, to allow fluent usage
-
parameters
java.util.List<ParameterConfig> parameters()
Returns a list ofParameterConfig
objects for each parameter of this method.- Returns:
- immutable list of
ParameterConfig
objects, nevernull
-
-