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: * Original code by *
09: *****************************************************************************/package org.picocontainer;
10:
11: import org.picocontainer.ComponentAdapter;
12: import org.picocontainer.Parameter;
13: import org.picocontainer.PicoCompositionException;
14: import org.picocontainer.ComponentMonitor;
15: import org.picocontainer.LifecycleStrategy;
16:
17: import java.util.Properties;
18:
19: /**
20: * <p/>
21: * A component factory is responsible for creating
22: * {@link ComponentAdapter} component adapters. The main use of the component factory is
23: * inside {@link DefaultPicoContainer#DefaultPicoContainer(ComponentFactory)}, where it can
24: * be used to customize the default component adapter that is used when none is specified
25: * explicitly.
26: * </p>
27: *
28: * @author Paul Hammant
29: * @author Mauro Talevi
30: * @author Jon Tirsén
31: */
32: public interface ComponentFactory {
33:
34: /**
35: * Create a new component adapter based on the specified arguments.
36: *
37: * @param componentMonitor the component monitor
38: * @param lifecycleStrategy te lifecycle strategy
39: * @param componentProperties the component properties
40: * @param componentKey the key to be associated with this adapter. This
41: * value should be returned from a call to
42: * {@link ComponentAdapter#getComponentKey()} on the created
43: * adapter.
44: * @param componentImplementation the implementation class to be associated
45: * with this adapter. This value should be returned from a call
46: * to {@link ComponentAdapter#getComponentImplementation()} on
47: * the created adapter. Should not be null.
48: * @param parameters additional parameters to use by the component adapter
49: * in constructing component instances. These may be used, for
50: * example, to make decisions about the arguments passed into the
51: * component constructor. These should be considered hints; they
52: * may be ignored by some implementations. May be null, and may
53: * be of zero length.
54: * @return a new component adapter based on the specified arguments. Should
55: * not return null.
56: * @throws PicoCompositionException if the creation of the component adapter
57: * results in a {@link PicoCompositionException}.
58: * @return The component adapter
59: */
60: <T> ComponentAdapter<T> createComponentAdapter(
61: ComponentMonitor componentMonitor,
62: LifecycleStrategy lifecycleStrategy,
63: Properties componentProperties, Object componentKey,
64: Class<T> componentImplementation, Parameter... parameters)
65: throws PicoCompositionException;
66:
67: }
|