org.picocontainer.injectors
Class IterativeInjector

java.lang.Object
  extended by org.picocontainer.adapters.AbstractAdapter
      extended by org.picocontainer.injectors.AbstractInjector
          extended by org.picocontainer.injectors.IterativeInjector
All Implemented Interfaces:
Serializable, ComponentAdapter, ComponentMonitorStrategy, LifecycleStrategy
Direct Known Subclasses:
AnnotatedFieldInjector, SetterInjector

public abstract class IterativeInjector
extends AbstractInjector

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.picocontainer.injectors.AbstractInjector
AbstractInjector.AmbiguousComponentResolutionException, AbstractInjector.CyclicDependencyException, AbstractInjector.NotConcreteRegistrationException, AbstractInjector.UnsatisfiableDependenciesException
 
Field Summary
protected  List<Member> injectionMembers
           
protected  Class[] injectionTypes
           
 
Fields inherited from class org.picocontainer.injectors.AbstractInjector
lifecycleStrategy, parameters, verifyingGuard
 
Constructor Summary
IterativeInjector(Object componentKey, Class componentImplementation, Parameter[] parameters, ComponentMonitor monitor, LifecycleStrategy lifecycleStrategy)
          Constructs a IterativeInjector
 
Method Summary
 Object getComponentInstance(PicoContainer container)
          Retrieve the component instance.
protected  Constructor getConstructor()
           
protected  Object getOrMakeInstance(PicoContainer container, Constructor constructor, ComponentMonitor componentMonitor)
           
protected  void initializeInjectionMembersAndTypeLists()
           
protected  void injectIntoMember(Member member, Object componentInstance, Object toInject)
           
protected  boolean isInjectorMethod(Method method)
           
protected  void unsatisfiedDependencies(PicoContainer container, Set<Class> unsatisfiableDependencyTypes)
           
 void verify(PicoContainer container)
          Verify that all dependencies for this adapter can be satisifed.
 
Methods inherited from class org.picocontainer.injectors.AbstractInjector
accept, caughtIllegalAccessException, caughtIllegalAccessException, caughtInstantiationException, caughtInvocationTargetException, createDefaultParameters, dispose, hasLifecycle, newInstance, start, stop
 
Methods inherited from class org.picocontainer.adapters.AbstractAdapter
changeMonitor, checkTypeCompatibility, currentMonitor, findAdapterOfType, getComponentImplementation, getComponentKey, getDelegate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

injectionMembers

protected transient List<Member> injectionMembers

injectionTypes

protected transient Class[] injectionTypes
Constructor Detail

IterativeInjector

public IterativeInjector(Object componentKey,
                         Class componentImplementation,
                         Parameter[] parameters,
                         ComponentMonitor monitor,
                         LifecycleStrategy lifecycleStrategy)
                  throws AbstractInjector.NotConcreteRegistrationException
Constructs a IterativeInjector

Parameters:
componentKey - the search key for this implementation
componentImplementation - the concrete implementation
parameters - the parameters to use for the initialization
monitor - the component monitor used by this addAdapter
lifecycleStrategy - the component lifecycle strategy used by this addAdapter
Throws:
AbstractInjector.NotConcreteRegistrationException - if the implementation is not a concrete class.
NullPointerException - if one of the parameters is null
Method Detail

getConstructor

protected Constructor getConstructor()

unsatisfiedDependencies

protected void unsatisfiedDependencies(PicoContainer container,
                                       Set<Class> unsatisfiableDependencyTypes)

getComponentInstance

public Object getComponentInstance(PicoContainer container)
                            throws PicoCompositionException
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, Cached will always return the same instance.

Parameters:
container - the PicoContainer, that is used to resolve any possible dependencies of the instance.
Returns:
the component instance.
Throws:
PicoCompositionException - if the component could not be instantiated.

getOrMakeInstance

protected Object getOrMakeInstance(PicoContainer container,
                                   Constructor constructor,
                                   ComponentMonitor componentMonitor)

injectIntoMember

protected void injectIntoMember(Member member,
                                Object componentInstance,
                                Object toInject)
                         throws IllegalAccessException,
                                InvocationTargetException
Throws:
IllegalAccessException
InvocationTargetException

verify

public void verify(PicoContainer container)
            throws PicoCompositionException
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
Specified by:
verify in class AbstractInjector
Parameters:
container - the PicoContainer, that is used to resolve any possible dependencies of the instance.
Throws:
PicoCompositionException - if one or more dependencies cannot be resolved.

initializeInjectionMembersAndTypeLists

protected void initializeInjectionMembersAndTypeLists()

isInjectorMethod

protected boolean isInjectorMethod(Method method)


Copyright © 2003-2007 Codehaus. All Rights Reserved.