1 8 package examples.logging; 9 10 14 public class ArgLoggingTarget { 15 16 private int m_counter1; 17 18 private int m_counter2; 19 20 public int getCounter() { 21 System.out.println("getCounter before"); 22 return m_counter1; 23 } 24 25 public void increment() { 26 System.out.println("increment before = " + m_counter2); 27 m_counter2 = m_counter2 + 1; 28 System.out.println("increment after = " + m_counter2); 29 } 30 31 34 public int toLog_1(int typeMatch, String s, int i) { 35 System.out.println("toLog_1"); 36 toLog_2(0, "b", 2); 37 return 0; 38 } 39 40 public java.lang.String [] toLog_2(int typeMatch, String s, int i) { 41 System.out.println("toLog_2"); 42 int result = toLog_3(0, new String []{"c"}); 43 return null; 44 } 45 46 private static int toLog_3(int typeMatch, String [] sarr) { 47 System.out.println("toLog_2"); 48 return -1; 49 } 50 51 public static void main(String args[]) throws Throwable { 52 new Runner().run(); 53 } 54 } 55 56 class Runner { 57 58 public void run() { 59 ArgLoggingTarget target = new ArgLoggingTarget(); 60 doRun(target); 61 } 62 63 public void doRun(ArgLoggingTarget target) { 64 target.toLog_1(0, "a", 1); 65 int counter1 = target.getCounter(); 66 System.out.println("getCounter after = " + counter1); 67 target.increment(); 68 } 69 } | Popular Tags |