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: *****************************************************************************/package org.picocontainer.injectors;
09:
10: import org.picocontainer.ComponentFactory;
11: import org.picocontainer.ComponentMonitor;
12: import org.picocontainer.PicoContainer;
13: import org.picocontainer.InjectionFactory;
14: import org.picocontainer.ComponentAdapter;
15: import org.picocontainer.LifecycleStrategy;
16: import org.picocontainer.Parameter;
17: import org.picocontainer.PicoCompositionException;
18: import org.picocontainer.Characteristics;
19: import org.picocontainer.behaviors.AbstractBehaviorFactory;
20:
21: import java.io.Serializable;
22: import java.util.Properties;
23:
24: /** @author Paul Hammant */
25: public class MultiInjection implements InjectionFactory, Serializable {
26: private final String setterPrefix;
27:
28: public MultiInjection(String setterPrefix) {
29: this .setterPrefix = setterPrefix;
30: }
31:
32: public MultiInjection() {
33: this ("set");
34: }
35:
36: public <T> ComponentAdapter<T> createComponentAdapter(
37: ComponentMonitor componentMonitor,
38: LifecycleStrategy lifecycleStrategy,
39: Properties componentProperties, Object componentKey,
40: Class<T> componentImplementation, Parameter... parameters)
41: throws PicoCompositionException {
42: boolean useNames = AbstractBehaviorFactory
43: .removePropertiesIfPresent(componentProperties,
44: Characteristics.USE_NAMES);
45: return new MultiInjector(componentKey, componentImplementation,
46: parameters, componentMonitor, lifecycleStrategy,
47: setterPrefix, useNames);
48: }
49: }
|