Ihar Hancharenka 5dff80e88e first
2023-03-27 16:52:17 +03:00

24 строки
563 B
Plaintext

public aspect Tracing {
private pointcut mainMethod () :
execution(public static void main(String[]));
before () : mainMethod() {
System.out.println("> " + thisJoinPoint);
}
after () : mainMethod() {
System.out.println("< " + thisJoinPoint);
}
private pointcut getMessageMethod () :
execution(public String getMessage());
before () : getMessageMethod() {
System.out.println(">> " + thisJoinPoint);
HelloWorld helloWorld = (HelloWorld)thisJoinPoint.getThis();
System.out.println(">> otherMessage: " + helloWorld.getOtherMessage());
}
}