KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > picocontainer > alternatives > EmptyPicoContainer


1 /*****************************************************************************
2  * Copyright (C) PicoContainer 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  * Original code by Paul Hammant *
9  *****************************************************************************/

10 package org.picocontainer.alternatives;
11
12 import java.io.Serializable JavaDoc;
13 import java.util.Collections JavaDoc;
14 import java.util.Collection JavaDoc;
15 import java.util.List JavaDoc;
16 import org.picocontainer.PicoContainer;
17 import org.picocontainer.PicoVisitor;
18 import org.picocontainer.ComponentAdapter;
19
20 /**
21  * empty pico container serving as recoil damper in situations where you
22  * do not like to check whether container reference suplpied to you
23  * is null or not
24  * @author Konstantin Pribluda
25  * @since 1.1
26 */

27 public class EmptyPicoContainer implements PicoContainer, Serializable JavaDoc {
28     public Object JavaDoc getComponentInstance(Object JavaDoc componentKey) {
29         return null;
30     }
31    
32     public Object JavaDoc getComponentInstanceOfType(Class JavaDoc componentType) {
33         return null;
34     }
35     public List JavaDoc getComponentInstances() {
36         return Collections.EMPTY_LIST;
37     }
38     
39     public PicoContainer getParent() {
40         return null;
41     }
42     public ComponentAdapter getComponentAdapter(Object JavaDoc componentKey) {
43         return null;
44     }
45     
46     public ComponentAdapter getComponentAdapterOfType(Class JavaDoc componentType) {
47         return null;
48     }
49    
50     public Collection JavaDoc getComponentAdapters() {
51         return Collections.EMPTY_LIST;
52     }
53     
54     public List JavaDoc getComponentAdaptersOfType(Class JavaDoc componentType) {
55         return Collections.EMPTY_LIST;
56     }
57     
58     public void verify() {}
59     
60     public void accept(PicoVisitor visitor) { }
61     
62     public List JavaDoc getComponentInstancesOfType(Class JavaDoc componentType) {
63         return Collections.EMPTY_LIST;
64     }
65
66     public void start() {}
67     public void stop() {}
68     public void dispose() {}
69 }
70
Popular Tags