org.picocontainer.defaults
Class DecoratingComponentAdapter

java.lang.Object
  extended byorg.picocontainer.defaults.DecoratingComponentAdapter
All Implemented Interfaces:
ComponentAdapter, Serializable
Direct Known Subclasses:
BeanPropertyComponentAdapter, CachingComponentAdapter, SynchronizedComponentAdapter

public class DecoratingComponentAdapter
extends Object
implements ComponentAdapter, Serializable

Version:
$Revision: 1.4 $
Author:
Jon Tirsen (tirsen@codehaus.org), Aslak Hellesoy
See Also:
Serialized Form

Constructor Summary
DecoratingComponentAdapter(ComponentAdapter delegate)
           
 
Method Summary
 Class getComponentImplementation()
          Retrieve the class of the component.
 Object getComponentInstance()
          Retrieve the component instance.
 Object getComponentKey()
          Retrieve the key associated with the component.
 PicoContainer getContainer()
          Retrieve the container in which the component is registered.
 ComponentAdapter getDelegate()
           
 void setContainer(PicoContainer picoContainer)
          Set the container in which this adapter is registered.
 void verify()
          Verify that all dependencies for this adapter can be satisifed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecoratingComponentAdapter

public DecoratingComponentAdapter(ComponentAdapter delegate)
Method Detail

getComponentKey

public Object getComponentKey()
Description copied from interface: ComponentAdapter
Retrieve the key associated with the component.

Specified by:
getComponentKey in interface ComponentAdapter
Returns:
the component's key. Should either be a class type (normally an interface) or an identifier that is unique (within the scope of the current PicoContainer).

getComponentImplementation

public Class getComponentImplementation()
Description copied from interface: ComponentAdapter
Retrieve the class of the component.

Specified by:
getComponentImplementation in interface ComponentAdapter
Returns:
the component's implementation class. Should normally be a concrete class (ie, a class that can be instantiated).

getComponentInstance

public Object getComponentInstance()
                            throws PicoInitializationException,
                                   PicoIntrospectionException,
                                   AssignabilityRegistrationException,
                                   NotConcreteRegistrationException
Description copied from interface: ComponentAdapter
Retrieve the component instance. This method will usually create a new instance each time it is called, but that is not required. For example, CachingComponentAdapter will always return the same instance.

Specified by:
getComponentInstance in interface ComponentAdapter
Returns:
the component instance.
Throws:
PicoInitializationException - if the component could not be instantiated.
PicoIntrospectionException - if the component has dependencies which could not be resolved, or instantiation of the component lead to an ambigous situation within the container.
AssignabilityRegistrationException
NotConcreteRegistrationException

verify

public void verify()
Description copied from interface: ComponentAdapter
Verify that all dependencies for this adapter can be satisifed. Normally, the adapter should verify this by checking that the associated PicoContainer contains all the needed dependnecies.

Specified by:
verify in interface ComponentAdapter

getContainer

public PicoContainer getContainer()
Description copied from interface: ComponentAdapter
Retrieve the container in which the component is registered.

Specified by:
getContainer in interface ComponentAdapter
Returns:
the container in which the component is registered.

getDelegate

public ComponentAdapter getDelegate()

setContainer

public void setContainer(PicoContainer picoContainer)
Description copied from interface: ComponentAdapter
Set the container in which this adapter is registered. This method will be called once by the container when the adapter is registered in that container. It should usually not be called directly.

Specified by:
setContainer in interface ComponentAdapter
Parameters:
picoContainer - the container in which this adapter is registered.


Copyright © 2003-2004 Codehaus. All Rights Reserved.