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