[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] pointcut to match inherited methods

Hi Ashank,

   Is this pointcut what you are looking for ?

pointcut p() : execution(* B.m());

public class A {

	public void m(){
		System.out.println( "Test A" );
	}
}

public class B extends A {

	public void m(){
		System.out.println( "Test B" );
	}

}

Thanks,
Mohan

On Thu, Apr 29, 2010 at 3:57 PM, Ashank <k_arvind_shankar@xxxxxxxxx> wrote:
>
> Hello All,
>
> I have a simple question. The same question was asked in this post but it
> seems to have gone unaddressed as far as my understanding goes.
> http://old.nabble.com/Weaving-inherited-methods-to15405848.html#a15405848
>
> Anyway, the question is, I want a pointcut to match method calls/executions
> of inherited methods in a subclass. For instance.
>
> Class A{
>    public void methodA() {}
> }
>
> Class B extends A() {
> }
>
> Class C() {
> B b = new B();
> b.methodA(); // Want to catch this.
> }
>
> As mentioned, I want to match the statement ending with the comment.
> Please help me out with the pointcut. Thank you very much
>
> --
> View this message in context: http://old.nabble.com/pointcut-to-match-inherited-methods-tp28398859p28398859.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>