001    /*******************************************************************************
002     * Copyright (C) PicoContainer Organization. All rights reserved.
003     * ----------------------------------------------------------------------------
004     * The software in this package is published under the terms of the BSD style
005     * license a copy of which has been included with this distribution in the
006     * LICENSE.txt file.
007     ******************************************************************************/
008    package org.picocontainer.script;
009    
010    import org.picocontainer.PicoContainer;
011    
012    /**
013     * The responsibility of a ContainerBuilder is to build containers. Composition
014     * of containers is generally a separate reponsibility, although the some
015     * builders may make use of the assembly scope.
016     * 
017     * @author Joe Walnes
018     * @author Mauro Talevi
019     */
020    public interface ContainerBuilder {
021    
022        /**
023         * Builds a new container
024         * 
025         * @param parentContainer the parent PicoContainer (may be <code>null</code>).
026         * @param assemblyScope a hint about the assembly scope (may be
027         *            <code>null</code>)
028         * @param addChildToParent boolean flag, <code>true</code> if the child is
029         *            to be added to the parent
030         * @return A PicoContainer
031         */
032        PicoContainer buildContainer(PicoContainer parentContainer, Object assemblyScope, boolean addChildToParent);
033    
034        /**
035         * Destroys a container.
036         * 
037         * @param container the PicoContainer to be killed
038         */
039        void killContainer(PicoContainer container);
040    
041    }