001    /*****************************************************************************
002     * Copyright (C) PicoContainer Organization. All rights reserved.            *
003     * ------------------------------------------------------------------------- *
004     * The software in this package is published under the terms of the BSD      *
005     * style license a copy of which has been included with this distribution in *
006     * the LICENSE.txt file.                                                     *
007     *                                                                           *
008     * Original code by                                                          *
009     *****************************************************************************/
010    package org.picocontainer.defaults;
011    
012    import org.picocontainer.ComponentAdapter;
013    import org.picocontainer.Parameter;
014    import org.picocontainer.PicoIntrospectionException;
015    
016    /**
017     * <p>
018     * A component adapter factory is responsible for creating
019     * {@link ComponentAdapter} component adapters. The main use of the component adapter factory is
020     * inside {@link DefaultPicoContainer#DefaultPicoContainer(ComponentAdapterFactory)}, where it can
021     * be used to customize the default component adapter that is used when none is specified
022     * explicitly.
023     * </p>
024     * 
025     * @author Jon Tirsén
026     * @author Mauro Talevi
027     * @version $Revision: 2230 $
028     */
029    public interface ComponentAdapterFactory {
030        
031        /**
032         * Create a new component adapter based on the specified arguments.
033         *
034         * @param componentKey            the key to be associated with this adapter. This value should be returned
035         *                                from a call to {@link ComponentAdapter#getComponentKey()} on the created adapter.
036         * @param componentImplementation the implementation class to be associated with this adapter.
037         *                                This value should be returned from a call to
038         *                                {@link ComponentAdapter#getComponentImplementation()} on the created adapter. Should not
039         *                                be null.
040         * @param parameters              additional parameters to use by the component adapter in constructing
041         *                                component instances. These may be used, for example, to make decisions about the
042         *                                arguments passed into the component constructor. These should be considered hints; they
043         *                                may be ignored by some implementations. May be null, and may be of zero length.
044         * @return a new component adapter based on the specified arguments. Should not return null.
045         * @throws PicoIntrospectionException if the creation of the component adapter results in a
046         *                                    {@link PicoIntrospectionException}.
047         * @throws AssignabilityRegistrationException
048         *                                    if the creation of the component adapter results in a
049         *                                    {@link AssignabilityRegistrationException}.
050         * @throws NotConcreteRegistrationException
051         *                                    if the creation of the component adapter results in a
052         *                                    {@link NotConcreteRegistrationException}.
053         */
054        ComponentAdapter createComponentAdapter(Object componentKey,
055                                                Class componentImplementation,
056                                                Parameter[] parameters) throws PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException;
057    
058    
059    }