org.picocontainer.defaults
Class DecoratingComponentAdapter

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

public class DecoratingComponentAdapter
extends Object
implements ComponentAdapter, Serializable

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

Constructor Summary
DecoratingComponentAdapter(ComponentAdapter delegate)
           
 
Method Summary
 void accept(PicoVisitor visitor)
          Accepts a visitor for this ComponentAdapter.
 Class getComponentImplementation()
          Retrieve the class of the component.
 Object getComponentInstance(PicoContainer container)
          Retrieve the component instance.
 Object getComponentKey()
          Retrieve the key associated with the component.
 ComponentAdapter getDelegate()
           
 String toString()
           
 void verify(PicoContainer container)
          Verify that all dependencies for this adapter can be satisifed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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(PicoContainer container)
                            throws PicoInitializationException,
                                   PicoIntrospectionException
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
Parameters:
container - the PicoContainer, that is used to resolve any possible dependencies of the instance.
Returns:
the component instance.
Throws:
PicoIntrospectionException - if the component has dependencies which could not be resolved, or instantiation of the component lead to an ambigous situation within the container.
PicoInitializationException - if the component could not be instantiated.

verify

public void verify(PicoContainer container)
            throws PicoVerificationException
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
Parameters:
container - the PicoContainer, that is used to resolve any possible dependencies of the instance.
Throws:
PicoVerificationException

getDelegate

public ComponentAdapter getDelegate()

accept

public void accept(PicoVisitor visitor)
Description copied from interface: ComponentAdapter
Accepts a visitor for this ComponentAdapter. The method is normally called by visiting a PicoContainer, that cascades the visitor also down to all its ComponentAdapter instances.

Specified by:
accept in interface ComponentAdapter
Parameters:
visitor - the visitor.

toString

public String toString()


Copyright © 2003-2004 Codehaus. All Rights Reserved.