[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] About target~
|
Why i can't limite the join point
generate only
at parent.m();?
Now the join point are
generate at parent.m();
and child.m(); in Main class.
Thank you~
================================================
public aspect Example {
pointcut jp_call_Parent_m():
call(void m()) && target(Parent);
before(): jp_call_Parent_m(){
System.out.println("entering: " + thisJoinPoint);
System.out.println(" at: " +
thisJoinPoint.getSourceLocation());
}
}
================================================
public class Main {
public Main(){
Parent parent = new Parent();
parent.m();
Child child = new Child();
child.m();
}
public static void main(String[] args) {
new Main();
}
}
================================================
public class Parent {
public Parent(){
System.out.println("Constructor of Parent
execution.");
}
public void x(){
System.out.println("Method x of Parent execution.");
}
public void m(){
System.out.println("Method m of Parent execution.");
}
}
================================================
public class Child extends Parent{
}