org.picocontainer.gems.adapters
Class HotSwappingComponentAdapter

java.lang.Object
  extended by org.picocontainer.defaults.DecoratingComponentAdapter
      extended by org.picocontainer.gems.adapters.HotSwappingComponentAdapter
All Implemented Interfaces:
java.io.Serializable, org.picocontainer.ComponentAdapter, org.picocontainer.defaults.ComponentMonitorStrategy, org.picocontainer.defaults.LifecycleStrategy, org.picocontainer.LifecycleManager

public class HotSwappingComponentAdapter
extends org.picocontainer.defaults.DecoratingComponentAdapter

This component adapter makes it possible to hide the implementation of a real subject (behind a proxy). If the key of the component is of type Class and that class represents an interface, the proxy will only implement the interface represented by that Class. Otherwise (if the key is something else), the proxy will implement all the interfaces of the underlying subject. In any case, the proxy will also implement Swappable, making it possible to swap out the underlying subject at runtime.

Note that this class doesn't cache instances. If you want caching, use a CachingComponentAdapter around this one.

Version:
$Revision: 2631 $
Author:
Paul Hammant, Aslak Hellesøy
See Also:
Serialized Form

Nested Class Summary
private static class HotSwappingComponentAdapter.ImplementationHidingReference
           
 
Field Summary
private  com.thoughtworks.proxy.ProxyFactory proxyFactory
           
 
Constructor Summary
HotSwappingComponentAdapter(org.picocontainer.ComponentAdapter delegate)
           
HotSwappingComponentAdapter(org.picocontainer.ComponentAdapter delegate, com.thoughtworks.proxy.ProxyFactory proxyFactory)
           
 
Method Summary
 java.lang.Object getComponentInstance(org.picocontainer.PicoContainer container)
           
 
Methods inherited from class org.picocontainer.defaults.DecoratingComponentAdapter
accept, changeMonitor, currentMonitor, dispose, dispose, getComponentImplementation, getComponentKey, getDelegate, hasLifecycle, hasLifecycle, start, start, stop, stop, toString, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

proxyFactory

private final com.thoughtworks.proxy.ProxyFactory proxyFactory
Constructor Detail

HotSwappingComponentAdapter

public HotSwappingComponentAdapter(org.picocontainer.ComponentAdapter delegate,
                                   com.thoughtworks.proxy.ProxyFactory proxyFactory)

HotSwappingComponentAdapter

public HotSwappingComponentAdapter(org.picocontainer.ComponentAdapter delegate)
Method Detail

getComponentInstance

public java.lang.Object getComponentInstance(org.picocontainer.PicoContainer container)
Specified by:
getComponentInstance in interface org.picocontainer.ComponentAdapter
Overrides:
getComponentInstance in class org.picocontainer.defaults.DecoratingComponentAdapter