01: /**************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package examples.logging;
08:
09: /**
10: * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
11: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
12: */
13: public class ArgLoggingTarget {
14:
15: private int m_counter1;
16:
17: private int m_counter2;
18:
19: public int getCounter() {
20: System.out.println("getCounter before");
21: return m_counter1;
22: }
23:
24: public void increment() {
25: System.out.println("increment before = " + m_counter2);
26: m_counter2 = m_counter2 + 1;
27: System.out.println("increment after = " + m_counter2);
28: }
29:
30: /**
31: * @Annotation
32: */
33: public int toLog_1(int typeMatch, String s, int i) {
34: System.out.println("toLog_1");
35: toLog_2(0, "b", 2);
36: return 0;
37: }
38:
39: public java.lang.String[] toLog_2(int typeMatch, String s, int i) {
40: System.out.println("toLog_2");
41: int result = toLog_3(0, new String[] { "c" });
42: return null;
43: }
44:
45: private static int toLog_3(int typeMatch, String[] sarr) {
46: System.out.println("toLog_2");
47: return -1;
48: }
49:
50: public static void main(String args[]) throws Throwable {
51: new Runner().run();
52: }
53: }
54:
55: class Runner {
56:
57: public void run() {
58: ArgLoggingTarget target = new ArgLoggingTarget();
59: doRun(target);
60: }
61:
62: public void doRun(ArgLoggingTarget target) {
63: target.toLog_1(0, "a", 1);
64: int counter1 = target.getCounter();
65: System.out.println("getCounter after = " + counter1);
66: target.increment();
67: }
68: }
|