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 Paul Hammant *
009 *****************************************************************************/
010 package org.picocontainer.containers;
011
012 import org.picocontainer.ComponentAdapter;
013 import org.picocontainer.PicoContainer;
014 import org.picocontainer.PicoVisitor;
015 import org.picocontainer.ParameterName;
016
017 import java.io.Serializable;
018 import java.util.Collection;
019 import java.util.Collections;
020 import java.util.List;
021
022 /**
023 * empty pico container serving as recoil damper in situations where you
024 * do not like to check whether container reference suplpied to you
025 * is null or not
026 *
027 * @author Konstantin Pribluda
028 */
029 public class EmptyPicoContainer implements PicoContainer, Serializable {
030
031 public Object getComponent(Object componentKeyOrType) {
032 return null;
033 }
034
035 public <T> T getComponent(Class<T> componentType) {
036 return null;
037 }
038
039 public List getComponents() {
040 return Collections.EMPTY_LIST;
041 }
042
043 public PicoContainer getParent() {
044 return null;
045 }
046
047 public ComponentAdapter<?> getComponentAdapter(Object componentKey) {
048 return null;
049 }
050
051 public <T> ComponentAdapter<T> getComponentAdapter(Class<T> componentType, ParameterName componentParameterName) {
052 return null;
053 }
054
055 public Collection<ComponentAdapter<?>> getComponentAdapters() {
056 return Collections.emptyList();
057 }
058
059 public <T> List<ComponentAdapter<T>> getComponentAdapters(Class<T> componentType) {
060 return Collections.emptyList();
061 }
062
063 public void accept(PicoVisitor visitor) {
064 }
065
066 public <T> List<T> getComponents(Class<T> componentType) {
067 return Collections.emptyList();
068 }
069
070 }