-
Notifications
You must be signed in to change notification settings - Fork 77
/
MethodConfig.java
72 lines (64 loc) · 2.44 KB
/
MethodConfig.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package jakarta.enterprise.inject.build.compatible.spi;
import jakarta.enterprise.lang.model.AnnotationInfo;
import jakarta.enterprise.lang.model.declarations.MethodInfo;
import java.lang.annotation.Annotation;
import java.util.function.Predicate;
/**
* 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.
*
* @see Enhancement
* @since 4.0
*/
public interface MethodConfig extends DeclarationConfig {
/**
* Returns the {@link MethodInfo} corresponding to this transformed method.
*
* @return the {@link MethodInfo} corresponding to this transformed method, never {@code null}
*/
@Override
MethodInfo info();
/**
* Adds a marker annotation of given type to this method.
* Doesn't allow configuring annotation members.
*
* @param annotationType the annotation type, must not be {@code null}
* @return this configurator object, to allow fluent usage
*/
@Override
MethodConfig addAnnotation(Class<? extends Annotation> annotationType);
/**
* Adds given annotation to this method. The {@link AnnotationInfo} can be obtained
* from an annotation target, or constructed from scratch using {@link AnnotationBuilder}.
*
* @param annotation the annotation to add to this method, must not be {@code null}
* @return this configurator object, to allow fluent usage
*/
@Override
MethodConfig addAnnotation(AnnotationInfo annotation);
/**
* Adds given annotation to this method. The annotation instance is typically
* a subclass of {@link jakarta.enterprise.util.AnnotationLiteral AnnotationLiteral}.
*
* @param annotation the annotation to add to this method, must not be {@code null}
* @return this configurator object, to allow fluent usage
*/
@Override
MethodConfig addAnnotation(Annotation annotation);
/**
* Removes all annotations matching given predicate from this method.
*
* @param predicate an annotation predicate, must not be {@code null}
* @return this configurator object, to allow fluent usage
*/
@Override
MethodConfig removeAnnotation(Predicate<AnnotationInfo> predicate);
/**
* Removes all annotations from this method.
*
* @return this configurator object, to allow fluent usage
*/
@Override
MethodConfig removeAllAnnotations();
}