[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| [aspectj-users] generate a StackTraceElement | 
Hello
i'd like to to generate a stack trace element everytime an advice is executed.
what i have now is:
    before(Object obj): myConstructor(obj) {
          traceEntry("" + thisJoinPointStaticPart.getSignature(), obj);
          
          StackTraceElement ste = new StackTraceElement  
(thisJoinPoint.getSignature().getDeclaringType().getName(),
                thisJoinPoint.getSignature().getName(),
                thisJoinPoint.getSourceLocation().getFileName(),
                thisJoinPoint.getSourceLocation().getLine());
            
  System.out.println(ste);
          
    }
    
    after(Object obj): myConstructor(obj) {
             traceExit("" + thisJoinPointStaticPart.getSignature(), obj);
             
StackTraceElement ste = new StackTraceElement 
(thisJoinPoint.getSignature().getDeclaringType().getName(),
                    thisJoinPoint.getSignature().getName(),
                    thisJoinPoint.getSourceLocation().getFileName(),
                    thisJoinPoint.getSourceLocation().getLine());
             System.out.println(ste);
    }
What i'd like to do is to create a StackTracerAspect, which contains the 
construction of  the StackTraceElement.
My question so is: how do I define a pointcut which intercept the after and 
the before advices ? Is it this the right approach?
thanks,
Valerio