[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] (no subject)
|
Andy
Thanks a lot.. your code helped me get some idea about what i can do to design the code.
On Mon, Oct 17, 2011 at 11:05 PM, Andy Clement
<andrew.clement@xxxxxxxxx> wrote:
Hi,
I don't have a complete solution for you to pick up and use but this
aspect kind of does it:
aspect CallGraph {
int indent =0;
before(): call(* *(..)) && !within(CallGraph) {
for (int i=0;i<indent;i++) { System.out.print(" ");}
System.out.println("> "+thisJoinPointStaticPart);
indent++;
}
after(): call(* *(..))&& !within(CallGraph) {
indent--;
}
}
public class Code {
public static void main(String []argv) {
new Code().foo();
new Code().bar();
}
public void foo() {
bar();
}
public void bar() {
boo();
}
public void boo() {
System.out.println("Hello World");
}
}
Running it gives:
$ java Code
> call(void Code.foo())
> call(void Code.bar())
> call(void Code.boo())
> call(void java.io.PrintStream.println(String))
Hello World
> call(void Code.bar())
> call(void Code.boo())
> call(void java.io.PrintStream.println(String))
Hello World
Andy