KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Idea by Rachel Davies, Original code by Aslak Hellesoy and Paul Hammant *
9  *****************************************************************************/

10
11 package org.picocontainer.defaults;
12
13 import org.picocontainer.ComponentAdapter;
14 import org.picocontainer.Parameter;
15 import org.picocontainer.PicoIntrospectionException;
16
17 import java.io.Serializable JavaDoc;
18
19 /**
20  * Creates instances of {@link ConstructorInjectionComponentAdapter} decorated by
21  * {@link CachingComponentAdapter}.
22  *
23  * @author Jon Tirsén
24  * @author Aslak Hellesøy
25  * @version $Revision: 1840 $
26  */

27 public class DefaultComponentAdapterFactory implements ComponentAdapterFactory, Serializable JavaDoc {
28
29     private ComponentMonitor componentMonitor;
30
31     public DefaultComponentAdapterFactory(ComponentMonitor componentMonitor) {
32         this.componentMonitor = componentMonitor;
33     }
34
35     public DefaultComponentAdapterFactory() {
36         this.componentMonitor = NullComponentMonitor.getInstance();
37     }
38
39     public ComponentAdapter createComponentAdapter(Object JavaDoc componentKey, Class JavaDoc componentImplementation, Parameter[] parameters) throws PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException {
40         return new CachingComponentAdapter(new ConstructorInjectionComponentAdapter(componentKey, componentImplementation, parameters, false, componentMonitor));
41     }
42 }
43
Popular Tags