Apologies regarding the previous email. I have found it at the following link.
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>