Announcement Announcement Module
Collapse
No announcement yet.
Pointcut to match meta annotations ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pointcut to match meta annotations ?

    Hi Guys,

    I cannot find an AspectJ Pointcut expression that would match classes which is indirectly annotated. An example would be appropriate:

    Say I have created this annotation:
    Code:
    @Retention(RUNTIME)
    public @Interface Loggable{}
    ... and added it to this custom stereotype:
    Code:
    @Component
    @Retention(RUNTIME)
    @Loggable <-------
    public @Interface MyBusinessService {}
    ... and that I am spraying my annotation around like this:
    Code:
    @MyBusinessService
    public class Victim{}
    The question is then: Is it possible to create an aspect that would be able to advice MyBusinessService with @Loggable behavior?. Obviously I have tried the following pointcut expression without luck: "@within(acme.Loggable)". That however doesn't do the magic...

  • #2
    Hi,

    No there is no pointcut for that yet. I have kind of worked out the syntax for it but haven't had the time to implement it yet. Best you can do is match on more than you need (all annotations...) and then query the annotation in the advice to check if it has the meta.

    cheers
    Andy
    ---
    Andy Clement
    AspectJ Project Lead
    SpringSource

    Comment


    • #3
      thanks... and. a comment

      Hi,

      Thank you for answering


      Nice to get an answer from the source.


      My 2 cents: spring really needs this support so that it can match CDI interceptors on this ...

      Comment

      Working...
      X