Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Aspect precedence/ordering?

Hi Neil

Yes DeclarePrecedence is implemented and was in M4
Let us know if the behavior is not the one described in the docs pointed by Wes
Alex

On 10/22/05, AVERY, Neil, FM <Neil.AVERY@xxxxxxxx> wrote:
>
>
> Apologies regarding the previous email. I  have found it at the following
> link.
>
> http://www.eclipse.org/aspectj/doc/next/adk15notebook/ataspectj-declare.html
>
> Ive a simple test however the annotation declare-precedence does not  have
> any affect of the order in which the aspects are applied.  Has it been
> implemented yet?
> Regards Neil.
>
>  ie.
>
> FIRSTASPECT:
> @Aspect("perthis( within(@org.stuff.SomeAnnotation *) )")
> public class AnnotatedAspectOne implements AroundAspect {
>  public static int callCount = 0;
>
>   @Around("within(@org.stuff.SomeAnnotation *)")
>   public Object invoke(ProceedingJoinPoint thisJoinPoint) throws Throwable {
>
>    StaticPart staticPart = thisJoinPoint.getStaticPart();
>    Signature signature = staticPart.getSignature();
>    if (signature instanceof MethodSignature){
>     MethodSignature ms = (MethodSignature) signature;
>     System.err.println("method:" + ms.getMethod().getName());
>    }
>
>   System.err.println("called onto AnnotationONE:" + callCount++ + " method:"
> + staticPart);
>    return thisJoinPoint.proceed();
>   };
> }
>
> SECONDASPECT:
> @Aspect("perthis( within(@org.stuff.SomeAnnotation *) )")
> @DeclarePrecedence("*Two*,*One*")
> public class AnnotatedAspectTwo implements AroundAspect {
>  public static int callCount = 0;
>
>   @Around("within(@org.stuff.SomeAnnotation *)")
>   public Object invoke(ProceedingJoinPoint thisJoinPoint) throws Throwable {
>
>    System.err.println("called onto AnnotationTWO:" + callCount++ + "
> method:" + thisJoinPoint.getStaticPart());
>    return thisJoinPoint.proceed();
>   };
> }
>
>
> AOP.XML
>  <aspectj>
>
>
> <aspects>
>
> <aspect name="org.stuff.SimpleAroundAspect"/>
>
> <aspect name="org.stuff.FieldAspect"/>
>
> <aspect name="org.stuff.AnnotatedAspectOne"/>
>
> <aspect name="org.stuff.AnnotatedAspectTwo"/>
>
> </aspects>
>
> <weaver options="-verbose -showWeaveInfo -1.5">
>
> <include within="org.stuff..*"/>
>
>
>
> <exclude within="org.eclipse..*"/>
>
> <exclude within="junit.framework.*"/>
>
> </weaver>
>
>
>
> </aspectj>
>
>
> ***********************************************************************************
>  The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered
> Office: 36 St Andrew Square, Edinburgh EH2 2YB.
>  Authorised and regulated by the Financial Services Authority
>
>  This e-mail message is confidential and for use by the
>  addressee only. If the message is received by anyone other
>  than the addressee, please return the message to the sender
>  by replying to it and then delete the message from your
>  computer. Internet e-mails are not necessarily secure. The
>  Royal Bank of Scotland plc does not accept responsibility for
>  changes made to this message after it was sent.
>
>  Whilst all reasonable care has been taken to avoid the
>  transmission of viruses, it is the responsibility of the recipient to
>  ensure that the onward transmission, opening or use of this
>  message and any attachments will not adversely affect its
>  systems or data. No responsibility is accepted by The Royal
>  Bank of Scotland plc in this regard and the recipient should carry
>  out such virus and other checks as it considers appropriate.
>  Visit our websites at:
>  http://www.rbs.co.uk/CBFM
>  http://www.rbsmarkets.com
> ********************************************************************************
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
>


Back to the top