org.objectledge.pico.customization
Class CustomizedComponentAdapter

java.lang.Object
  extended by org.objectledge.pico.customization.CustomizedComponentAdapter
All Implemented Interfaces:
org.picocontainer.ComponentAdapter

public class CustomizedComponentAdapter
extends Object
implements org.picocontainer.ComponentAdapter

An adapter for a component that is customized on behalf of a component that is asking for it.

When another component is being initialized and it depends on the component that is managed by this adapter (identified by the componentKey), the customizedContainerProvider is asked to produce an instance of the customized component. Thus, different components may recieve different instnaces of the managed component, depending on the customizedComponentProvider's semantics.

Version:
$Id: CustomizedComponentAdapter.java,v 1.15 2005/02/04 02:28:00 rafal Exp $
Author:
rafal@caltha.pl

Field Summary
private  Object componentKey
           
private  CustomizedComponentProvider customizedComponentProvider
           
 
Constructor Summary
CustomizedComponentAdapter(Object componentKey, CustomizedComponentProvider customizedComponentProvider)
          Crates a new instance of the adapter.
 
Method Summary
 void accept(org.picocontainer.PicoVisitor visitor)
          
 Class getComponentImplementation()
          
 Object getComponentInstance(org.picocontainer.PicoContainer container)
          
 Object getComponentInstance(org.picocontainer.PicoContainer container, Object componentKey, Class componentImplementation)
          Returns a customized components instance.
 Object getComponentKey()
          
 void verify(org.picocontainer.PicoContainer container)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

componentKey

private Object componentKey

customizedComponentProvider

private CustomizedComponentProvider customizedComponentProvider
Constructor Detail

CustomizedComponentAdapter

public CustomizedComponentAdapter(Object componentKey,
                                  CustomizedComponentProvider customizedComponentProvider)
Crates a new instance of the adapter.

Parameters:
componentKey - the component key this adapter manages.
customizedComponentProvider - a provider of customized components.
Method Detail

getComponentInstance

public Object getComponentInstance(org.picocontainer.PicoContainer container)
                            throws org.picocontainer.PicoInitializationException,
                                   org.picocontainer.PicoIntrospectionException

Specified by:
getComponentInstance in interface org.picocontainer.ComponentAdapter
Throws:
org.picocontainer.PicoInitializationException
org.picocontainer.PicoIntrospectionException

getComponentInstance

public Object getComponentInstance(org.picocontainer.PicoContainer container,
                                   Object componentKey,
                                   Class componentImplementation)
                            throws org.picocontainer.PicoInitializationException,
                                   org.picocontainer.PicoIntrospectionException,
                                   UnsupportedKeyTypeException
Returns a customized components instance.

This method is called by the CustomizingConstructorComponentAdapter.

Parameters:
container - the container for resolving references.
componentKey - the key of the requesting component.
componentImplementation - the implemenation class of the requesting component.
Returns:
a customized component instance.
Throws:
org.picocontainer.PicoInitializationException - if the customized component cannot be instantiated.
org.picocontainer.PicoIntrospectionException - if there is a problem introspecting classes.
UnsupportedKeyTypeException - if the requesting component key if an unsupported type.

verify

public void verify(org.picocontainer.PicoContainer container)
            throws org.picocontainer.PicoVerificationException

Specified by:
verify in interface org.picocontainer.ComponentAdapter
Throws:
org.picocontainer.PicoVerificationException

getComponentImplementation

public Class getComponentImplementation()

Specified by:
getComponentImplementation in interface org.picocontainer.ComponentAdapter

getComponentKey

public Object getComponentKey()

Specified by:
getComponentKey in interface org.picocontainer.ComponentAdapter

accept

public void accept(org.picocontainer.PicoVisitor visitor)

Specified by:
accept in interface org.picocontainer.ComponentAdapter


Copyright © 2003-2006 objectledge.org. All Rights Reserved.