org.picocontainer.defaults
Class InstantiatingComponentAdapter
java.lang.Object
org.picocontainer.defaults.AbstractComponentAdapter
org.picocontainer.defaults.InstantiatingComponentAdapter
- All Implemented Interfaces:
- ComponentAdapter, Serializable
- Direct Known Subclasses:
- ConstructorInjectionComponentAdapter, SetterInjectionComponentAdapter
- public abstract class InstantiatingComponentAdapter
- extends AbstractComponentAdapter
This ComponentAdapter will instantiate a new object for each call to
ComponentAdapter.getComponentInstance()
. That means that
when used with a PicoContainer, getComponentInstance will return a new
object each time.
- Version:
- $Revision: 1.20 $
- Author:
- Aslak Hellesøy, Paul Hammant
- See Also:
- Serialized Form
parameters
protected Parameter[] parameters
InstantiatingComponentAdapter
protected InstantiatingComponentAdapter(Object componentKey,
Class componentImplementation,
Parameter[] parameters,
boolean allowNonPublicClasses)
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.
- 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
createDefaultParameters
protected Parameter[] createDefaultParameters(Class[] parameters)
verify
public void verify()
throws UnsatisfiableDependenciesException
- 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.
- Throws:
UnsatisfiableDependenciesException
newInstance
protected Object newInstance(Constructor constructor,
Object[] parameters)
throws InstantiationException,
IllegalAccessException,
InvocationTargetException
- Throws:
InstantiationException
IllegalAccessException
InvocationTargetException
instantiateComponent
protected abstract Object instantiateComponent(List adapterInstantiationOrderTrackingList)
throws PicoInitializationException,
PicoIntrospectionException,
AssignabilityRegistrationException,
NotConcreteRegistrationException
- Instantiate the object.
- Parameters:
adapterInstantiationOrderTrackingList
- This list is filled with the dependent adapters of the instance.
- Returns:
- Returns the new instance.
- Throws:
PicoInitializationException
PicoIntrospectionException
AssignabilityRegistrationException
NotConcreteRegistrationException
getGreediestSatisifableConstructor
protected abstract Constructor getGreediestSatisifableConstructor(List adapterInstantiationOrderTrackingList)
throws PicoIntrospectionException,
UnsatisfiableDependenciesException,
AmbiguousComponentResolutionException,
AssignabilityRegistrationException,
NotConcreteRegistrationException
- Throws:
PicoIntrospectionException
UnsatisfiableDependenciesException
AmbiguousComponentResolutionException
AssignabilityRegistrationException
NotConcreteRegistrationException
Copyright © 2003-2004 Codehaus. All Rights Reserved.