KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > picocontainer > defaults > DecoratingComponentAdapter


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 Jon Tirsen *
9  *****************************************************************************/

10
11 package org.picocontainer.defaults;
12
13 import org.picocontainer.ComponentAdapter;
14 import org.picocontainer.PicoContainer;
15 import org.picocontainer.PicoInitializationException;
16 import org.picocontainer.PicoIntrospectionException;
17 import org.picocontainer.PicoVisitor;
18
19 import java.io.Serializable JavaDoc;
20
21 /**
22  * @author Jon Tirsen (tirsen@codehaus.org)
23  * @author Aslak Hellesoy
24  * @version $Revision: 2024 $
25  */

26 public class DecoratingComponentAdapter implements ComponentAdapter, Serializable JavaDoc {
27
28     private ComponentAdapter delegate;
29
30     public DecoratingComponentAdapter(ComponentAdapter delegate) {
31         this.delegate = delegate;
32     }
33
34     public Object JavaDoc getComponentKey() {
35         return delegate.getComponentKey();
36     }
37
38     public Class JavaDoc getComponentImplementation() {
39         return delegate.getComponentImplementation();
40     }
41
42     public Object JavaDoc getComponentInstance(PicoContainer container) throws PicoInitializationException, PicoIntrospectionException {
43         return delegate.getComponentInstance(container);
44     }
45
46     public void verify(PicoContainer container) throws PicoIntrospectionException {
47         delegate.verify(container);
48     }
49
50     public ComponentAdapter getDelegate() {
51         return delegate;
52     }
53
54     public void accept(PicoVisitor visitor) {
55         visitor.visitComponentAdapter(this);
56         delegate.accept(visitor);
57     }
58
59     public String JavaDoc toString() {
60         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(this.getClass().getName());
61         buffer.append("[");
62         buffer.append(delegate.toString());
63         buffer.append("]");
64         return buffer.toString();
65     }
66 }
67
Popular Tags