Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] aspectj help : pointcut annotation binding not work

Hi, 

I'm beginner on aspectj.
My aspect want to catch method scoped annotation of type Security using 
MyFirstWeaveAspect aspect on MyClass class

The AJDT detect the poincut matching but during runtime, the advise is never 
executing.

Please help me.
Thanks
MAC

Aspect code :
public aspect MyFirstWeaveAspect {
public pointcut checkSecurityCallAdd(Security securityAnnotation) : 
execution(@Security public * *(..)) && @this(securityAnnotation) 

before(Security annotation) : checkSecurityCallAdd(annotation){
 if (annotation.style().equals(SecurityType.NORMAL)) {
 System.out.println("NORMAL SECURITY");
 }
 if (annotation.style().equals(SecurityType.PARANOIAC)) {
 System.out.println("PARANOIAC SECURITY");
 }
 if (annotation.style().equals(SecurityType.SIMPLE)) {
 System.out.println("SIMPLE SECURITY");
 } else
 {
 System.out.println("BIZARRE"); 
}
 }
}

Class to weave : 

public class MyClass extends MyBaseClass{

 @Security (style=SecurityType.NORMAL)
 public void doGoodThing () {
 System.out.println("doGoodthing");
 }


Back to the top