org.picocontainer.injectors
Class SetterInjector<T>
java.lang.Object
org.picocontainer.adapters.AbstractAdapter<T>
org.picocontainer.injectors.AbstractInjector<T>
org.picocontainer.injectors.IterativeInjector<T>
org.picocontainer.injectors.SetterInjector<T>
- All Implemented Interfaces:
- Serializable, ComponentAdapter<T>, ComponentMonitorStrategy, Injector<T>
- Direct Known Subclasses:
- AnnotatedMethodInjector, NamedMethodInjector
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
prefix
protected final String prefix
SetterInjector
public SetterInjector(Object componentKey,
Class componentImplementation,
Parameter[] parameters,
ComponentMonitor monitor,
String prefix,
boolean useNames)
throws AbstractInjector.NotConcreteRegistrationException
- Constructs a SetterInjector
- Parameters:
componentKey - the search key for this implementationcomponentImplementation - the concrete implementationparameters - the parameters to use for the initializationmonitor - the component monitor used by this addAdapterprefix - the prefix to use (e.g. 'set')
- Throws:
AbstractInjector.NotConcreteRegistrationException - if the implementation is not a concrete class.
NullPointerException - if one of the parameters is null
memberInvocationReturn
protected Object memberInvocationReturn(Object lastReturn,
AccessibleObject member,
Object instance)
- Specified by:
memberInvocationReturn in class IterativeInjector<T>
injectIntoMember
protected Object 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 for use in toString()
- Specified by:
getDescriptor in interface ComponentAdapter<T>- Overrides:
getDescriptor in class AbstractInjector<T>
- Returns:
- the descriptor
Copyright © 2003-2010 Codehaus. All Rights Reserved.