org.picocontainer.injectors
Class SetterInjector<T>

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

public class SetterInjector<T>
extends IterativeInjector<T>

Instantiates components using empty constructors and Setter Injection. For easy setting of primitive properties, also see PropertyApplicator.

Note that this class doesn't cache instances. If you want caching, use a Cached around this one.

Author:
Aslak Hellesøy, Jörg Schaible, Mauro Talevi, Paul Hammant
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
 
Nested classes/interfaces inherited from interface org.picocontainer.ComponentAdapter
ComponentAdapter.NOTHING
 
Field Summary
 
Fields inherited from class org.picocontainer.injectors.IterativeInjector
bindings, injectionMembers, injectionTypes
 
Fields inherited from class org.picocontainer.injectors.AbstractInjector
lifecycleStrategy, parameters, verifyingGuard
 
Constructor Summary
SetterInjector(Object componentKey, Class componentImplementation, Parameter[] parameters, ComponentMonitor monitor, LifecycleStrategy lifecycleStrategy, String setterMethodPrefix, boolean useNames)
          Constructs a SetterInjector
 
Method Summary
 String getDescriptor()
          Get a string key descriptor of the component adapter.
protected  String getInjectorPrefix()
           
protected  void injectIntoMember(AccessibleObject member, Object componentInstance, Object toInject)
           
protected  boolean isInjectorMethod(Method method)
           
 
Methods inherited from class org.picocontainer.injectors.IterativeInjector
decorateComponentInstance, getComponentInstance, getConstructor, getParanamer, initializeInjectionMembersAndTypeLists, makeParameterNameImpl, unsatisfiedDependencies, verify
 
Methods inherited from class org.picocontainer.injectors.AbstractInjector
accept, box, caughtIllegalAccessException, caughtIllegalAccessException, caughtInstantiationException, caughtInvocationTargetException, createDefaultParameters, dispose, getComponentInstance, hasLifecycle, newInstance, start, stop, useNames
 
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
 
Methods inherited from interface org.picocontainer.ComponentAdapter
findAdapterOfType, getComponentImplementation, getComponentKey, getDelegate
 

Constructor Detail

SetterInjector

public SetterInjector(Object componentKey,
                      Class componentImplementation,
                      Parameter[] parameters,
                      ComponentMonitor monitor,
                      LifecycleStrategy lifecycleStrategy,
                      String setterMethodPrefix,
                      boolean useNames)
               throws AbstractInjector.NotConcreteRegistrationException
Constructs a SetterInjector

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
setterMethodPrefix -
Throws:
AbstractInjector.NotConcreteRegistrationException - if the implementation is not a concrete class.
NullPointerException - if one of the parameters is null
Method Detail

injectIntoMember

protected void injectIntoMember(AccessibleObject member,
                                Object componentInstance,
                                Object toInject)
                         throws IllegalAccessException,
                                InvocationTargetException
Specified by:
injectIntoMember in class IterativeInjector<T>
Throws:
IllegalAccessException
InvocationTargetException

isInjectorMethod

protected boolean isInjectorMethod(Method method)
Overrides:
isInjectorMethod in class IterativeInjector<T>

getInjectorPrefix

protected String getInjectorPrefix()

getDescriptor

public String getDescriptor()
Description copied from interface: ComponentAdapter
Get a string key descriptor of the component adapter.

Specified by:
getDescriptor in interface ComponentAdapter<T>
Overrides:
getDescriptor in class AbstractInjector<T>
Returns:


Copyright © 2003-2010 Codehaus. All Rights Reserved.