Results 1 to 2 of 2

Thread: checking annotation properties at run time

  1. #1
    Join Date
    Sep 2007
    Posts
    21

    Default checking annotation properties at run time

    I have created an annotation which goes like the one below.
    Code:
    @Retention(RetentionPolicy.RUNTIME)
    @Target(ElementType.METHOD)
    public @interface AnAnnotation{
    	public String value();
    }
    as is there a way with which i can do an equivalent of this ?
    Code:
    execution(@AnAnnotation(value=="somethingInteresting") *.*(..))

  2. #2
    Join Date
    May 2009
    Location
    Vancouver
    Posts
    274

    Default

    In the README for 1.6.0:

    http://www.eclipse.org/aspectj/doc/r...EADME-160.html

    This concept is described, it is called annotation value matching. However it is not yet implemented for all variations of annotation value kinds. As the example in the README shows, it works for enums so far. Please raise an enhancement request against AspectJ for string value matching:

    https://bugs.eclipse.org/bugs/enter_...roduct=AspectJ

    The best you can do right now is checking it at the top of your advice after binding the annotation.

    Andy Clement
    AspectJ Project Lead
    SpringSource

Posting Permissions

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