    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 the committers                                           *
    009     *****************************************************************************/
    010    package org.picocontainer.containers;
    011
    012    import java.util.Properties;
    013    import org.picocontainer.ComponentAdapter;
    014    import org.picocontainer.MutablePicoContainer;
    015    import org.picocontainer.Parameter;
    016    import org.picocontainer.PicoCompositionException;
    017    import org.picocontainer.PicoContainer;
    018
    019    /**
    020     * abstract base class for delegating to mutable containers
    021     * @author Paul Hammant
    022     */
    023    public abstract class AbstractDelegatingMutablePicoContainer extends AbstractDelegatingPicoContainer implements MutablePicoContainer {
    024
    025        public AbstractDelegatingMutablePicoContainer(MutablePicoContainer delegate) {
    026                    super(delegate);
    027            }
    028
    029            public MutablePicoContainer addComponent(Object componentKey,
    030                                                 Object componentImplementationOrInstance,
    031                                                 Parameter... parameters) throws PicoCompositionException {
    032            return getDelegate().addComponent(componentKey, componentImplementationOrInstance, parameters);
    033        }
    034
    035        public MutablePicoContainer addComponent(Object implOrInstance) throws PicoCompositionException {
    036            return getDelegate().addComponent(implOrInstance);
    037        }
    038
    039        public MutablePicoContainer addConfig(String name, Object val) {
    040            return getDelegate().addConfig(name, val);
    041        }
    042
    043        public MutablePicoContainer addAdapter(ComponentAdapter<?> componentAdapter) throws PicoCompositionException {
    044            return getDelegate().addAdapter(componentAdapter);
    045        }
    046
    047        public <T> ComponentAdapter<T> removeComponent(Object componentKey) {
    048            return getDelegate().removeComponent(componentKey);
    049        }
    050
    051        public <T> ComponentAdapter<T> removeComponentByInstance(T componentInstance) {
    052            return getDelegate().removeComponentByInstance(componentInstance);
    053        }
    054
    055        public MutablePicoContainer addChildContainer(PicoContainer child) {
    056            return getDelegate().addChildContainer(child);
    057        }
    058
    059        public boolean removeChildContainer(PicoContainer child) {
    060            return getDelegate().removeChildContainer(child);
    061        }
    062
    063            public MutablePicoContainer change(Properties... properties) {
    064                return getDelegate().change(properties);
    065            }
    066
    067            public MutablePicoContainer as(Properties... properties) {
    068                return getDelegate().as(properties);
    069            }
    070
    071            public void dispose() {
    072                    getDelegate().dispose();
    073            }
    074
    075            public MutablePicoContainer makeChildContainer() {
    076
    077                    return null;
    078            }
    079
    080            public void start() {
    081                    getDelegate().start();
    082            }
    083
    084            public void stop() {
    085                    getDelegate().stop();
    086            }
    087
    088            public MutablePicoContainer getDelegate() {
    089                    return (MutablePicoContainer) super.getDelegate();
    090            }
    091    }