peilaus alkaen
https://github.com/eclipse-aspectj/aspectj.git
synced 2024-08-27 05:54:38 +02:00
25 rivejä
593 B
Java
25 rivejä
593 B
Java
import org.aspectj.testing.Tester;
|
|
|
|
import org.aspectj.lang.reflect.*;
|
|
|
|
public class JoinPointFields {
|
|
public static void main(String[] args) {
|
|
Tester.checkEqual(new JoinPointFields().foo("xxx-"), "xxx-arg", "parameterNames");
|
|
}
|
|
|
|
public String foo(String arg) {
|
|
return arg;
|
|
}
|
|
}
|
|
|
|
aspect A {
|
|
String around(String arg):
|
|
this(JoinPointFields) &&
|
|
execution(String foo(String)) &&
|
|
args(arg)
|
|
{
|
|
return arg + (((MethodSignature)thisJoinPoint.getSignature()).
|
|
getParameterNames())[0];
|
|
}
|
|
}
|