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 & Obie Fernandez & Aslak Hellesøy *
09: *****************************************************************************/package org.picocontainer.monitors;
10:
11: import java.io.Serializable;
12: import java.lang.reflect.Constructor;
13: import java.lang.reflect.Method;
14: import java.lang.reflect.Member;
15: import java.lang.reflect.AccessibleObject;
16:
17: import org.picocontainer.ComponentMonitor;
18: import org.picocontainer.PicoLifecycleException;
19: import org.picocontainer.ComponentAdapter;
20: import org.picocontainer.MutablePicoContainer;
21: import org.picocontainer.PicoContainer;
22:
23: /**
24: * A {@link ComponentMonitor} which does nothing.
25: *
26: * @author Paul Hammant
27: * @author Obie Fernandez
28: */
29: @SuppressWarnings("serial")
30: public class NullComponentMonitor implements ComponentMonitor,
31: Serializable {
32:
33: public <T> Constructor<T> instantiating(PicoContainer container,
34: ComponentAdapter<T> componentAdapter,
35: Constructor<T> constructor) {
36: return constructor;
37: }
38:
39: public <T> void instantiationFailed(PicoContainer container,
40: ComponentAdapter<T> componentAdapter,
41: Constructor<T> constructor, Exception e) {
42: }
43:
44: public <T> void instantiated(PicoContainer container,
45: ComponentAdapter<T> componentAdapter,
46: Constructor<T> constructor, Object instantiated,
47: Object[] injected, long duration) {
48: }
49:
50: public void invoking(PicoContainer container,
51: ComponentAdapter<?> componentAdapter, Member member,
52: Object instance) {
53: }
54:
55: public void invoked(PicoContainer container,
56: ComponentAdapter<?> componentAdapter, Method method,
57: Object instance, long duration) {
58: }
59:
60: public void invocationFailed(Member member, Object instance,
61: Exception e) {
62: }
63:
64: public void lifecycleInvocationFailed(
65: MutablePicoContainer container,
66: ComponentAdapter<?> componentAdapter, Method method,
67: Object instance, RuntimeException cause) {
68: throw new PicoLifecycleException(method, instance, cause);
69: }
70:
71: public Object noComponentFound(MutablePicoContainer container,
72: Object componentKey) {
73: return null;
74: }
75:
76: }
|