KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nanocontainer > testmodel > X


1 /*****************************************************************************
2  * Copyright (C) NanoContainer Organization. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  * *
8  *****************************************************************************/

9 package org.nanocontainer.testmodel;
10
11 import org.picocontainer.Disposable;
12 import org.picocontainer.Startable;
13
14 /**
15  * An abstract component and three dependancies used for testing.
16  */

17 public abstract class X implements Startable, Disposable {
18
19     public static String JavaDoc componentRecorder = "";
20
21     public static void reset() {
22         componentRecorder = "";
23     }
24
25     public void start() {
26         componentRecorder += "<" + code();
27     }
28
29     public void stop() {
30         componentRecorder += code() + ">";
31     }
32
33     public void dispose() {
34         componentRecorder += "!" + code();
35     }
36
37     private String JavaDoc code() {
38         String JavaDoc name = getClass().getName();
39         return name.substring(name.lastIndexOf('.') + 1, name.length());
40     }
41
42 }
43
Popular Tags