Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Tracing method using AspectJ


Samuel,

1. Yes
public class HelloWorld {

        public boolean println () {
                System.out.println("Hello World!");
                return true;
        }
       
        public static void main(String[] args) {
                new HelloWorld().println();
        }

}

aspect Tracing1 {
        before () : execution(boolean HelloWorld.*(..)) {
                System.err.println(thisJoinPoint);
        }
}

2. Yes
aspect Tracing2 {
        before () : call(boolean *(..)) && withincode(public void main(..)) {
                System.err.println(thisJoinPoint);
        }
}

3. No, unless you want to use new Java 5 language features like annotations.

Cheers

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx

http://w3.hursley.ibm.com/~websterm/

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:        aspectj-users-bounces@xxxxxxxxxxx

To:        aspectj-users@xxxxxxxxxxx
cc:        
Subject:        [aspectj-users] Tracing method using AspectJ


Hi,

I am new to AspectJ, I have a few questions. I appreciate if anyone
can help with me that:
1. I read the tracing example,
http://eclipse.org/aspectj/doc/released/progguide/examples-development.html#d0e2490

I would like to know if I can setup so that I only trace method
depends on the Return value of the method that I am trying to trace.
And if I can get the value of the input parameters?

2. Is it possible to trace a method depends on the CALLER of that method?

3. Do I need to use Java5 for AspectJ?

Thank you.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top