1 10 11 package org.picocontainer.gems; 12 13 import com.thoughtworks.proxy.ProxyFactory; 14 import com.thoughtworks.proxy.factory.StandardProxyFactory; 15 import org.picocontainer.ComponentAdapter; 16 import org.picocontainer.Parameter; 17 import org.picocontainer.PicoIntrospectionException; 18 import org.picocontainer.defaults.AssignabilityRegistrationException; 19 import org.picocontainer.defaults.ComponentAdapterFactory; 20 import org.picocontainer.defaults.DecoratingComponentAdapterFactory; 21 import org.picocontainer.defaults.DefaultComponentAdapterFactory; 22 import org.picocontainer.defaults.NotConcreteRegistrationException; 23 24 32 public class HotSwappingComponentAdapterFactory extends DecoratingComponentAdapterFactory { 33 private final ProxyFactory proxyFactory; 34 35 public HotSwappingComponentAdapterFactory() { 36 this(new DefaultComponentAdapterFactory()); 37 } 38 39 public HotSwappingComponentAdapterFactory(ComponentAdapterFactory delegate) { 40 this(delegate, new StandardProxyFactory()); 41 } 42 43 public HotSwappingComponentAdapterFactory(ComponentAdapterFactory delegate, ProxyFactory proxyFactory) { 44 super(delegate); 45 this.proxyFactory = proxyFactory; 46 } 47 48 public ComponentAdapter createComponentAdapter(Object componentKey, 49 Class componentImplementation, 50 Parameter[] parameters) 51 throws PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException { 52 ComponentAdapter componentAdapter = super.createComponentAdapter(componentKey, componentImplementation, parameters); 53 return new HotSwappingComponentAdapter(componentAdapter, proxyFactory); 54 } 55 } 56
| Popular Tags
|