Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] pointcut for overriden or implemented methods

Hi,

Is it possible to write a pointcut with the following requirements:

Match all methods in classes that override or implement methods with
@MyAnnotation defined in the super class or the interface. So in the
following example the pointcut should match both methds in the
WorkPlace class.

@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface MyAnnotation {
}

public interface Work {
    @MyAnnotation
     public void doSomething();
}

public abstract class AbstractPlace {
    @MyAnnotation
     public void getPlace();
}

public class WorkPlace extends AbstractPlace implements Work {
   public void doSomething() {
       ...
   }

   public void getPlace() {
       ...
   }
}

Note: the annotation on the method are not inherited.

Thank you
Monal


Back to the top