01: /*****************************************************************************
02: * Copyright (C) PicoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Original code by Paul Hammant *
09: *****************************************************************************/package org.picocontainer.containers;
10:
11: import org.picocontainer.ComponentAdapter;
12: import org.picocontainer.PicoContainer;
13: import org.picocontainer.PicoVisitor;
14: import org.picocontainer.NameBinding;
15:
16: import java.io.Serializable;
17: import java.util.Collection;
18: import java.util.Collections;
19: import java.util.List;
20: import java.lang.annotation.Annotation;
21:
22: /**
23: * empty pico container serving as recoil damper in situations where you
24: * do not like to check whether container reference suplpied to you
25: * is null or not
26: *
27: * @author Konstantin Pribluda
28: */
29: public class EmptyPicoContainer implements PicoContainer, Serializable {
30:
31: public Object getComponent(Object componentKeyOrType) {
32: return null;
33: }
34:
35: public <T> T getComponent(Class<T> componentType) {
36: return null;
37: }
38:
39: public <T> T getComponent(Class<T> componentType,
40: Class<? extends Annotation> binding) {
41: return null;
42: }
43:
44: public List getComponents() {
45: return Collections.EMPTY_LIST;
46: }
47:
48: public PicoContainer getParent() {
49: return null;
50: }
51:
52: public ComponentAdapter<?> getComponentAdapter(Object componentKey) {
53: return null;
54: }
55:
56: public <T> ComponentAdapter<T> getComponentAdapter(
57: Class<T> componentType, NameBinding componentNameBinding) {
58: return null;
59: }
60:
61: public <T> ComponentAdapter<T> getComponentAdapter(
62: Class<T> componentType, Class<? extends Annotation> binding) {
63: return null;
64: }
65:
66: public Collection<ComponentAdapter<?>> getComponentAdapters() {
67: return Collections.emptyList();
68: }
69:
70: public <T> List<ComponentAdapter<T>> getComponentAdapters(
71: Class<T> componentType) {
72: return Collections.emptyList();
73: }
74:
75: public <T> List<ComponentAdapter<T>> getComponentAdapters(
76: Class<T> componentType, Class<? extends Annotation> binding) {
77: return Collections.emptyList();
78: }
79:
80: /**
81: * we do not have anything to do here.
82: */
83: public void accept(PicoVisitor visitor) {
84: }
85:
86: public <T> List<T> getComponents(Class<T> componentType) {
87: return Collections.emptyList();
88: }
89:
90: }
|