File tree Expand file tree Collapse file tree 6 files changed +8
-17
lines changed
blackbox-aspect/src/main/java/org/example/external/aspect
blackbox-test-inject/src/main/java/org/example/myapp/aspect
inject/src/main/java/io/avaje/inject/aop
inject-generator/src/main/java/io/avaje/inject/generator Expand file tree Collapse file tree 6 files changed +8
-17
lines changed Original file line number Diff line number Diff line change 1
1
package org .example .external .aspect ;
2
2
3
3
import io .avaje .inject .aop .Aspect ;
4
- import org .example .external .aspect .sub .MyAspectImplementation ;
5
4
6
5
import java .lang .annotation .ElementType ;
7
6
import java .lang .annotation .Retention ;
8
7
import java .lang .annotation .RetentionPolicy ;
9
8
import java .lang .annotation .Target ;
10
9
11
- @ Aspect ( target = MyAspectImplementation . class )
10
+ @ Aspect
12
11
@ Target (ElementType .METHOD )
13
12
@ Retention (RetentionPolicy .RUNTIME )
14
13
public @interface MyExternalAspect {
Original file line number Diff line number Diff line change 10
10
import java .util .Arrays ;
11
11
12
12
@ Component
13
- public class MyAspectImplementation implements AspectProvider <MyExternalAspect >, MethodInterceptor {
13
+ class MyAspectImplementation implements AspectProvider <MyExternalAspect >, MethodInterceptor {
14
14
15
15
@ Override
16
16
public MethodInterceptor interceptor (Method method , MyExternalAspect aspectAnnotation ) {
Original file line number Diff line number Diff line change 7
7
import java .lang .annotation .RetentionPolicy ;
8
8
import java .lang .annotation .Target ;
9
9
10
- @ Aspect ( target = MyAroundAspect . class )
10
+ @ Aspect
11
11
@ Target (ElementType .METHOD )
12
12
@ Retention (RetentionPolicy .RUNTIME )
13
13
public @interface MyAround {
Original file line number Diff line number Diff line change 11
11
import java .util .List ;
12
12
13
13
@ Singleton
14
- //@Aspect(target = MyAround.class)
15
14
public class MyAroundAspect implements AspectProvider <MyAround >, MethodInterceptor {
16
15
17
16
private final List <String > trace = new ArrayList <>();
Original file line number Diff line number Diff line change @@ -44,9 +44,7 @@ private Meta readTarget(Element anElement) {
44
44
Meta meta = new Meta ();
45
45
for (Map .Entry <? extends ExecutableElement , ? extends AnnotationValue > entry : annotationMirror .getElementValues ().entrySet ()) {
46
46
String key = entry .getKey ().toString ();
47
- if (key .equals ("target()" )) {
48
- meta .target (entry .getValue ().getValue ().toString ());
49
- } else if (key .equals ("ordering()" )) {
47
+ if (key .equals ("ordering()" )) {
50
48
meta .ordering (Integer .parseInt (entry .getValue ().getValue ().toString ()));
51
49
}
52
50
}
@@ -59,21 +57,15 @@ private Meta readTarget(Element anElement) {
59
57
60
58
private static class Meta {
61
59
62
- String target ;
63
-
64
60
int ordering = Constants .ORDERING_DEFAULT ;
65
61
66
- void target (String target ) {
67
- this .target = target ;
68
- }
69
-
70
62
void ordering (int ordering ) {
71
63
this .ordering = ordering ;
72
64
}
73
65
74
66
@ Override
75
67
public String toString () {
76
- return "Meta(target=" + target + ", ordering=" + ordering + ')' ;
68
+ return "Meta(ordering=" + ordering + ')' ;
77
69
}
78
70
}
79
71
}
Original file line number Diff line number Diff line change 18
18
public @interface Aspect {
19
19
20
20
/**
21
- * Specify the {@link AspectProvider} for this aspect .
21
+ * Deprecated - the target() attribute is no longer required and should be removed .
22
22
*/
23
- Class <? extends AspectProvider > target ();
23
+ @ Deprecated
24
+ Class <?> target () default Void .class ;
24
25
25
26
/**
26
27
* Specify the priority ordering when multiple aspects are on a method.
You can’t perform that action at this time.
0 commit comments