2 Replies Latest reply on Dec 19, 2008 6:12 AM by vladimir.kovalyuk

    help with poincut for annotation parameter values

    vladimir.kovalyuk

      I'd like to add mixins to all the classes annotated with:

      @Mixins(value={Mixin1.class, Mixin2.class})
      public class TargetClass {
      }

      My understanding is that I have to define 2 aspects for Mixin1 and Mixin2 classes. But I can't work out pointcuts for them. Could anybody help me?

        • 1. Re: help with poincut for annotation parameter values
          dermas

          As far as I know you can only set pointcuts for an annotation, but not for its attributes. So you have to intercept all @Mixins annotations and then you can check out which attributes are set in your aspect/interceptor:


          MethodInvocation methodInvocation = (MethodInvocation) invocation;
          //get your annotation
          @Mixins mixinAnnotation = methodInvocation.getMethod().getAnnotation(ContainerSide.class);
          //get the value attribute
          class[] someClasses = mixinAnnotation.value();
          doSomethingSpecial();
          


          This was just a quick example and might not work like that, but it shows the way to do it.
          Maybe this example helps somehow.

          • 2. Re: help with poincut for annotation parameter values
            vladimir.kovalyuk

            DerMas, thanks for help.
            I'm afraid what I'm looking for is actually not supported. Dynamic interception won't help 'cause I have to reflect aspectized classes.