blob: c436b8fcae42bd6abba171573dc579ef66be849e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import org.aspectj.lang.annotation.Aspect;
import java.lang.annotation.*;
public aspect PerTargetAspect pertarget(fooCall()) {
pointcut fooCall() : call(* Foo.foo(..));
public static void main(String[] args) {
Annotation[] annotations = PerTargetAspect.class.getAnnotations();
if (annotations.length != 1) throw new RuntimeException("Should have one annotation");
Aspect aspectAnnotation = (Aspect) annotations[0];
if (!aspectAnnotation.value().equals("pertarget(fooCall())")) throw new RuntimeException("value should be equal to perclause");
}
}
class Foo {
void foo() {}
}
|