helloworld in aspectj code example
Example: helloworld in aspectj
// HelloWorld.java
public class HelloWorld {
public static void say(String message) {
System.out.println(message);
}
public static void sayToPerson(String message, String name) {
System.out.println(name + ", " + message);
}
}
// MannersAspect.java
public aspect MannersAspect {
pointcut callSayMessage() : call(public static void HelloWorld.say*(..));
before() : callSayMessage() {
System.out.println("Good day!");
}
after() : callSayMessage() {
System.out.println("Thank you!");
}
}