org.picocontainer.containers.AbstractDelegatingPicoContainer Maven / Gradle / Ivy
package org.picocontainer.containers;
import org.picocontainer.ComponentAdapter;
import org.picocontainer.Converters;
import org.picocontainer.Converting;
import org.picocontainer.NameBinding;
import org.picocontainer.PicoContainer;
import org.picocontainer.PicoException;
import org.picocontainer.PicoVisitor;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.List;
/**
* Abstract base class for immutable delegation to a PicoContainer
*
* @author Konstantin Pribluda
*
*/
@SuppressWarnings("serial")
public abstract class AbstractDelegatingPicoContainer implements PicoContainer, Converting, Serializable{
private PicoContainer delegate;
public AbstractDelegatingPicoContainer(PicoContainer delegate) {
if (delegate == null) {
throw new NullPointerException(
"PicoContainer delegate must not be null");
}
this.delegate = delegate;
}
public final void accept(PicoVisitor visitor) {
visitor.visitContainer(this);
delegate.accept(visitor);
}
@Override
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 T getComponent(Class componentType) {
return componentType.cast(getComponent((Object) componentType));
}
public T getComponent(Class componentType, Class extends Annotation> binding) {
return delegate.getComponent(componentType, binding);
}
public Object getComponent(Object componentKeyOrType) {
return delegate.getComponent(componentKeyOrType);
}
public Object getComponent(Object componentKeyOrType, Type into) {
return delegate.getComponent(componentKeyOrType, into);
}
public ComponentAdapter getComponentAdapter(Class componentType,
NameBinding componentNameBinding) {
return delegate.getComponentAdapter(componentType,
componentNameBinding);
}
public ComponentAdapter getComponentAdapter(Class componentType, Class extends Annotation> binding) {
return delegate.getComponentAdapter(componentType, binding);
}
public ComponentAdapter> getComponentAdapter(Object componentKey) {
return delegate.getComponentAdapter(componentKey);
}
public Collection> getComponentAdapters() {
return delegate.getComponentAdapters();
}
public List> getComponentAdapters(
Class componentType) {
return delegate.getComponentAdapters(componentType);
}
public List> getComponentAdapters(Class componentType, Class extends Annotation> binding) {
return delegate.getComponentAdapters(componentType, binding);
}
public List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy