01: /*****************************************************************************
02: * Copyright (c) PicoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Idea by Rachel Davies, Original code by Aslak Hellesoy and Paul Hammant *
09: *****************************************************************************/package org.picocontainer.injectors;
10:
11: import java.io.Serializable;
12: import java.util.Properties;
13:
14: import org.picocontainer.Characteristics;
15: import org.picocontainer.ComponentAdapter;
16: import org.picocontainer.ComponentMonitor;
17: import org.picocontainer.InjectionFactory;
18: import org.picocontainer.LifecycleStrategy;
19: import org.picocontainer.Parameter;
20: import org.picocontainer.PicoCompositionException;
21: import org.picocontainer.behaviors.AbstractBehaviorFactory;
22:
23: /**
24: * A {@link org.picocontainer.InjectionFactory} for constructors.
25: * The factory creates {@link ConstructorInjector}.
26: *
27: * @author Paul Hammant
28: * @author Jon Tirsén
29: */
30: public class ConstructorInjection implements InjectionFactory,
31: Serializable {
32:
33: public <T> ComponentAdapter<T> createComponentAdapter(
34: ComponentMonitor componentMonitor,
35: LifecycleStrategy lifecycleStrategy, Properties properties,
36: Object componentKey, Class<T> componentImplementation,
37: Parameter... parameters) throws PicoCompositionException {
38: boolean useNames = AbstractBehaviorFactory
39: .removePropertiesIfPresent(properties,
40: Characteristics.USE_NAMES);
41: return new ConstructorInjector(componentKey,
42: componentImplementation, parameters, componentMonitor,
43: lifecycleStrategy, useNames);
44: }
45: }
|