KickJava   Java API By Example, From Geeks To Geeks.

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


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 the committers *
9  *****************************************************************************/

10 package org.picocontainer.alternatives;
11
12 import org.picocontainer.ComponentAdapter;
13 import org.picocontainer.MutablePicoContainer;
14 import org.picocontainer.Parameter;
15 import org.picocontainer.PicoContainer;
16 import org.picocontainer.PicoException;
17 import org.picocontainer.PicoRegistrationException;
18 import org.picocontainer.PicoVerificationException;
19 import org.picocontainer.PicoVisitor;
20
21 import java.io.Serializable JavaDoc;
22 import java.util.Collection JavaDoc;
23 import java.util.List JavaDoc;
24
25 /**
26  * @author Paul Hammant
27  * @version $Revision: 1802 $
28  */

29 public abstract class AbstractDelegatingMutablePicoContainer implements MutablePicoContainer, Serializable JavaDoc {
30
31     private MutablePicoContainer delegate;
32
33     public AbstractDelegatingMutablePicoContainer(MutablePicoContainer delegate) {
34         this.delegate = delegate;
35     }
36
37     protected MutablePicoContainer getDelegate() {
38         return delegate;
39     }
40
41     public ComponentAdapter registerComponentImplementation(Object JavaDoc componentKey, Class JavaDoc componentImplementation) throws PicoRegistrationException {
42         return delegate.registerComponentImplementation(componentKey, componentImplementation);
43     }
44
45     public ComponentAdapter registerComponentImplementation(Object JavaDoc componentKey, Class JavaDoc componentImplementation, Parameter[] parameters) throws PicoRegistrationException {
46         return delegate.registerComponentImplementation(componentKey, componentImplementation, parameters);
47     }
48
49
50     public ComponentAdapter registerComponentImplementation(Class JavaDoc componentImplementation) throws PicoRegistrationException {
51         return delegate.registerComponentImplementation(componentImplementation);
52     }
53
54     public ComponentAdapter registerComponentInstance(Object JavaDoc componentInstance) throws PicoRegistrationException {
55         return delegate.registerComponentInstance(componentInstance);
56     }
57
58     public ComponentAdapter registerComponentInstance(Object JavaDoc componentKey, Object JavaDoc componentInstance) throws PicoRegistrationException {
59         return delegate.registerComponentInstance(componentKey, componentInstance);
60     }
61
62     public ComponentAdapter registerComponent(ComponentAdapter componentAdapter) throws PicoRegistrationException {
63         return delegate.registerComponent(componentAdapter);
64     }
65
66     public ComponentAdapter unregisterComponent(Object JavaDoc componentKey) {
67         return delegate.unregisterComponent(componentKey);
68     }
69
70     public ComponentAdapter unregisterComponentByInstance(Object JavaDoc componentInstance) {
71         return delegate.unregisterComponentByInstance(componentInstance);
72     }
73
74     public Object JavaDoc getComponentInstance(Object JavaDoc componentKey) {
75         return delegate.getComponentInstance(componentKey);
76     }
77
78     public Object JavaDoc getComponentInstanceOfType(Class JavaDoc componentType) {
79         return delegate.getComponentInstanceOfType(componentType);
80     }
81
82     public List JavaDoc getComponentInstances() {
83         return delegate.getComponentInstances();
84     }
85
86     public PicoContainer getParent() {
87         return delegate.getParent();
88     }
89
90     public ComponentAdapter getComponentAdapter(Object JavaDoc componentKey) {
91         return delegate.getComponentAdapter(componentKey);
92     }
93
94     public ComponentAdapter getComponentAdapterOfType(Class JavaDoc componentType) {
95         return delegate.getComponentAdapterOfType(componentType);
96     }
97
98     public Collection JavaDoc getComponentAdapters() {
99         return delegate.getComponentAdapters();
100     }
101
102     public List JavaDoc getComponentAdaptersOfType(Class JavaDoc componentType) {
103         return delegate.getComponentAdaptersOfType(componentType);
104     }
105
106     /**
107      * @deprecated since 1.1 - Use new VerifyingVisitor().traverse(this)
108      */

109    public void verify() throws PicoVerificationException {
110         delegate.verify();
111     }
112
113     public void start() {
114         delegate.start();
115     }
116
117     public void stop() {
118         delegate.stop();
119     }
120
121     public void dispose() {
122         delegate.dispose();
123     }
124
125     public boolean addChildContainer(PicoContainer child) {
126         return delegate.addChildContainer(child);
127     }
128
129     public boolean removeChildContainer(PicoContainer child) {
130         return delegate.removeChildContainer(child);
131     }
132
133     public void accept(PicoVisitor visitor) {
134         delegate.accept(visitor);
135     }
136
137     public List JavaDoc getComponentInstancesOfType(Class JavaDoc type) throws PicoException {
138         return delegate.getComponentInstancesOfType(type);
139     }
140
141     public boolean equals(Object JavaDoc obj) {
142         // required to make it pass on both jdk 1.3 and jdk 1.4. Btw, what about overriding hashCode()? (AH)
143
final boolean result = delegate.equals(obj) || this == obj;
144         return result;
145     }
146
147 }
148
Popular Tags