public abstract class AbstractAdapter<T> extends Object implements ComponentAdapter<T>, ComponentMonitorStrategy, Serializable
null for the component key or the implementation,
ensures that the implementation is a concrete class and that the key is assignable from the
implementation if the key represents a type.ComponentAdapter.NOTHING| Constructor and Description |
|---|
AbstractAdapter(Object componentKey,
Class componentImplementation)
Constructs a new ComponentAdapter for the given key and implementation.
|
AbstractAdapter(Object componentKey,
Class componentImplementation,
ComponentMonitor monitor)
Constructs a new ComponentAdapter for the given key and implementation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(PicoVisitor visitor)
Accepts a visitor for this ComponentAdapter.
|
void |
changeMonitor(ComponentMonitor monitor)
Changes the component monitor used
|
protected void |
checkTypeCompatibility() |
ComponentMonitor |
currentMonitor()
Returns the monitor currently used
|
<U extends ComponentAdapter> |
findAdapterOfType(Class<U> adapterType)
Locates a component adapter of type componentAdapterType in the ComponentAdapter chain.
|
Class<? extends T> |
getComponentImplementation()
Retrieve the class of the component.
|
T |
getComponentInstance(PicoContainer container)
Retrieve the component instance.
|
Object |
getComponentKey()
Retrieve the key associated with the component.
|
ComponentAdapter<T> |
getDelegate()
Component adapters may be nested in a chain, and this method is used to grab the next ComponentAdapter in the chain.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetComponentInstance, getDescriptor, verifypublic AbstractAdapter(Object componentKey, Class componentImplementation)
componentKey - the search key for this implementationcomponentImplementation - the concrete implementationpublic AbstractAdapter(Object componentKey, Class componentImplementation, ComponentMonitor monitor)
componentKey - the search key for this implementationcomponentImplementation - the concrete implementationmonitor - the component monitor used by this ComponentAdapterpublic Object getComponentKey()
getComponentKey in interface ComponentAdapter<T>ComponentAdapter.getComponentKey()public Class<? extends T> getComponentImplementation()
getComponentImplementation in interface ComponentAdapter<T>ComponentAdapter.getComponentImplementation()protected void checkTypeCompatibility()
public T getComponentInstance(PicoContainer container) throws PicoCompositionException
ComponentAdapterCached will always return the
same instance.getComponentInstance in interface ComponentAdapter<T>container - the PicoContainer, that is used to resolve any possible dependencies of the instance.PicoCompositionException - if the component has dependencies which could not be resolved, or
instantiation of the component lead to an ambigous situation within the
container.public String toString()
toString in class ObjectObject.toString()public void accept(PicoVisitor visitor)
ComponentAdapterPicoContainer, that
cascades the visitor also down to all its ComponentAdapter instances.accept in interface ComponentAdapter<T>visitor - the visitor.public void changeMonitor(ComponentMonitor monitor)
ComponentMonitorStrategychangeMonitor in interface ComponentMonitorStrategymonitor - the new ComponentMonitor to usepublic ComponentMonitor currentMonitor()
currentMonitor in interface ComponentMonitorStrategypublic final ComponentAdapter<T> getDelegate()
ComponentAdaptergetDelegate in interface ComponentAdapter<T>public final <U extends ComponentAdapter> U findAdapterOfType(Class<U> adapterType)
ComponentAdapterfindAdapterOfType in interface ComponentAdapter<T>U - the type of ComponentAdapter being located.adapterType - the class of the adapter type being located. Never null.Copyright © 2003-2014 Codehaus. All Rights Reserved.