Results 1 to 3 of 3

Thread: Pointcut to match meta annotations ?

  1. #1
    Join Date
    Dec 2010
    Posts
    2

    Default 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. #2
    Join Date
    May 2009
    Location
    Vancouver
    Posts
    274

    Default

    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

  3. #3
    Join Date
    Dec 2010
    Posts
    2

    Default 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 ...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •