1 10 package org.picocontainer.defaults; 11 12 import org.picocontainer.ComponentAdapter; 13 import org.picocontainer.Parameter; 14 import org.picocontainer.PicoIntrospectionException; 15 16 import java.util.HashMap ; 17 import java.util.Map ; 18 19 27 public class BeanPropertyComponentAdapterFactory extends DecoratingComponentAdapterFactory { 28 private Map adapterCache = new HashMap (); 29 30 35 public BeanPropertyComponentAdapterFactory(ComponentAdapterFactory delegate) { 36 super(delegate); 37 } 38 39 42 public ComponentAdapter createComponentAdapter(Object componentKey, Class componentImplementation, Parameter[] parameters) throws PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException { 43 ComponentAdapter decoratedAdapter = super.createComponentAdapter(componentKey, componentImplementation, parameters); 44 BeanPropertyComponentAdapter propertyAdapter = new BeanPropertyComponentAdapter(decoratedAdapter); 45 adapterCache.put(componentKey, propertyAdapter); 46 return propertyAdapter; 47 } 48 49 53 public BeanPropertyComponentAdapter getComponentAdapter(Object key) { 54 return (BeanPropertyComponentAdapter) adapterCache.get(key); 55 } 56 } 57 | Popular Tags |