1 9 package org.nanocontainer.testmodel; 10 11 import junit.framework.Assert; 12 import org.picocontainer.Disposable; 13 import org.picocontainer.Startable; 14 15 18 public abstract class Xxx implements Startable, Disposable { 19 20 public static String componentRecorder = ""; 21 22 public static void reset() { 23 componentRecorder = ""; 24 } 25 26 public void start() { 27 componentRecorder += "<" + code(); 28 } 29 30 public void stop() { 31 componentRecorder += code() + ">"; 32 } 33 34 public void dispose() { 35 componentRecorder += "!" + code(); 36 } 37 38 private String code() { 39 String name = getClass().getName(); 40 return name.substring(name.indexOf('$') + 1, name.length()); 41 } 42 43 public static class A extends Xxx { 44 } 45 46 public static class B extends Xxx { 47 A a; 48 49 public B(A a) { 50 Assert.assertNotNull(a); 51 this.a = a; 52 } 53 54 public A getA() { 55 return a; 56 } 57 } 58 59 public static class C extends Xxx { 60 } 61 } 62 | Popular Tags |