alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

PicoContainer example source code file (AbstractDelegatingMutablePicoContainer.java)

This example PicoContainer source code file (AbstractDelegatingMutablePicoContainer.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - PicoContainer tags/keywords

abstractdelegatingmutablepicocontainer, collection, componentadapter, componentadapter, io, list, mutablepicocontainer, mutablepicocontainer, nullpointerexception, object, object, picocompositionexception, serializable, t, t, util

The PicoContainer AbstractDelegatingMutablePicoContainer.java source code

/*****************************************************************************
 * Copyright (C) PicoContainer Organization. All rights reserved.            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *                                                                           *
 * Original code by the committers                                           *
 *****************************************************************************/
package org.picocontainer.containers;

import org.picocontainer.ComponentAdapter;
import org.picocontainer.MutablePicoContainer;
import org.picocontainer.Parameter;
import org.picocontainer.PicoContainer;
import org.picocontainer.PicoException;
import org.picocontainer.PicoVisitor;
import org.picocontainer.PicoCompositionException;
import org.picocontainer.ParameterName;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Properties;

/**
 * @author Paul Hammant
 * @version $Revision: 3693 $
 */
public abstract class AbstractDelegatingMutablePicoContainer implements MutablePicoContainer, Serializable {

    private MutablePicoContainer delegate;

    public AbstractDelegatingMutablePicoContainer(MutablePicoContainer delegate) {
        if (delegate == null) {
            throw new NullPointerException("MutablePicoContainer delegate must not be null");
        }
        this.delegate = delegate;
    }

    protected MutablePicoContainer getDelegate() {
        return delegate;
    }

    public MutablePicoContainer addComponent(Object componentKey,
                                             Object componentImplementationOrInstance,
                                             Parameter... parameters) throws PicoCompositionException {
        return delegate.addComponent(componentKey, componentImplementationOrInstance, parameters);
    }

    public MutablePicoContainer addComponent(Object implOrInstance) throws PicoCompositionException {
        return delegate.addComponent(implOrInstance);
    }

    public MutablePicoContainer addConfig(String name, Object val) {
        return delegate.addConfig(name, val); 
    }

    public MutablePicoContainer addAdapter(ComponentAdapter componentAdapter) throws PicoCompositionException {
        return delegate.addAdapter(componentAdapter);
    }

    public ComponentAdapter removeComponent(Object componentKey) {
        return delegate.removeComponent(componentKey);
    }

    public ComponentAdapter removeComponentByInstance(Object componentInstance) {
        return delegate.removeComponentByInstance(componentInstance);
    }

    public Object getComponent(Object componentKeyOrType) {
        return delegate.getComponent(componentKeyOrType);
    }

    public <T> T getComponent(Class componentType) {
        return componentType.cast(getComponent((Object)componentType));
    }

    public List getComponents() {
        return delegate.getComponents();
    }

    public PicoContainer getParent() {
        return delegate.getParent();
    }

    public ComponentAdapter<?> getComponentAdapter(Object componentKey) {
        return delegate.getComponentAdapter(componentKey);
    }

    public <T> ComponentAdapter getComponentAdapter(Class componentType, ParameterName componentParameterName) {
        return delegate.getComponentAdapter(componentType, componentParameterName);
    }

    public Collection<ComponentAdapter getComponentAdapters() {
        return delegate.getComponentAdapters();
    }

    public <T> List> getComponentAdapters(Class componentType) {
        return delegate.getComponentAdapters(componentType);
    }

    public void start() {
        delegate.start();
    }

    public void stop() {
        delegate.stop();
    }

    public void dispose() {
        delegate.dispose();
    }

    public MutablePicoContainer addChildContainer(PicoContainer child) {
        return delegate.addChildContainer(child);
    }

    public boolean removeChildContainer(PicoContainer child) {
        return delegate.removeChildContainer(child);
    }

    public void accept(PicoVisitor visitor) {
        delegate.accept(visitor);
    }

    public <T> List getComponents(Class type) throws PicoException {
        return delegate.getComponents(type);
    }

    public boolean equals(Object obj) {
        // required to make it pass on both jdk 1.3 and jdk 1.4. Btw, what about overriding hashCode()? (AH)
        return delegate.equals(obj) || this == obj;
    }

    public MutablePicoContainer change(Properties... properties) {
        return delegate.change(properties);
    }

    public MutablePicoContainer as(Properties... properties) {
        return delegate.as(properties);
    }
}

Other PicoContainer examples (source code examples)

Here is a short list of links related to this PicoContainer AbstractDelegatingMutablePicoContainer.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.