org.picocontainer.gems.adapters
Class StaticFactoryComponentAdapter

java.lang.Object
  extended by org.picocontainer.defaults.MonitoringComponentAdapter
      extended by org.picocontainer.defaults.AbstractComponentAdapter
          extended by org.picocontainer.gems.adapters.StaticFactoryComponentAdapter
All Implemented Interfaces:
java.io.Serializable, org.picocontainer.ComponentAdapter, org.picocontainer.defaults.ComponentMonitorStrategy

public class StaticFactoryComponentAdapter
extends org.picocontainer.defaults.AbstractComponentAdapter

Component adapter that wrapps a static factory with the help of StaticFactory.

Since:
1.1
Author:
Jörg Schaible, Leo Simmons
See Also:
Serialized Form

Field Summary
private  StaticFactory staticFactory
           
 
Constructor Summary
StaticFactoryComponentAdapter(java.lang.Class type, StaticFactory staticFactory)
          Construct a ComponentAdapter accessing a static factory creating the component.
StaticFactoryComponentAdapter(java.lang.Object componentKey, java.lang.Class type, StaticFactory staticFactory)
          Construct a ComponentAdapter accessing a static factory creating the component using a special key for component registration.
 
Method Summary
 java.lang.Object getComponentInstance(org.picocontainer.PicoContainer container)
           
 void verify(org.picocontainer.PicoContainer container)
          
 
Methods inherited from class org.picocontainer.defaults.AbstractComponentAdapter
accept, checkTypeCompatibility, getComponentImplementation, getComponentKey, toString
 
Methods inherited from class org.picocontainer.defaults.MonitoringComponentAdapter
changeMonitor, currentMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

staticFactory

private StaticFactory staticFactory
Constructor Detail

StaticFactoryComponentAdapter

public StaticFactoryComponentAdapter(java.lang.Class type,
                                     StaticFactory staticFactory)
Construct a ComponentAdapter accessing a static factory creating the component.

Parameters:
type - The type of the created component.
staticFactory - Wrapper instance for the static factory.

StaticFactoryComponentAdapter

public StaticFactoryComponentAdapter(java.lang.Object componentKey,
                                     java.lang.Class type,
                                     StaticFactory staticFactory)
Construct a ComponentAdapter accessing a static factory creating the component using a special key for component registration.

Parameters:
componentKey - The key of the created component.
type - The type of the created component.
staticFactory - Wrapper instance for the static factory.
Method Detail

getComponentInstance

public java.lang.Object getComponentInstance(org.picocontainer.PicoContainer container)
                                      throws org.picocontainer.PicoInitializationException,
                                             org.picocontainer.PicoIntrospectionException
Returns:
Returns the component created by the static factory.
Throws:
org.picocontainer.PicoInitializationException
org.picocontainer.PicoIntrospectionException
See Also:
ComponentAdapter.getComponentInstance(org.picocontainer.PicoContainer)

verify

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

Throws:
org.picocontainer.PicoVerificationException
See Also:
ComponentAdapter.verify(org.picocontainer.PicoContainer)