Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] How do i apply a pointcut to only an object which implements an interface or is of type X.class or subclass

This doesn't work. I've tried a number of variations in the past.

   public pointcut PT_new() :

       within(com.foo.BarInterface) &&
       call(*.new(..));

I would like both one which applys to a constructor and one which applys to a method. I have had good success with other things but still can't figure this one out.

What i have success with is things like

   public pointcut PT_init(
       String suName,
       String suPath) :
execution(public void init(String, String)) &&
       args(suName, suPath);

And or using within() if i know the package.

What i really want is to apply to objects implementing an interface or constructing an object of type X interface or type X class (and subtypes too).

Thanks,
Jason





Back to the top