Package 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
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.picocontainer.injectors.AbstractInjector
AbstractInjector.AmbiguousComponentResolutionException, AbstractInjector.CyclicDependencyException, AbstractInjector.NotConcreteRegistrationException, AbstractInjector.UnsatisfiableDependenciesExceptionNested classes/interfaces inherited from interface org.picocontainer.ComponentAdapter
ComponentAdapter.NOTHING -
Field Summary
FieldsFields inherited from class org.picocontainer.injectors.IterativeInjector
bindings, injectionMembers, injectionTypesFields inherited from class org.picocontainer.injectors.AbstractInjector
parameters, verifyingGuard -
Constructor Summary
ConstructorsConstructorDescriptionSetterInjector(Object componentKey, Class componentImplementation, Parameter[] parameters, ComponentMonitor monitor, String prefix, String notThisOneThough, boolean optional, boolean useNames) Constructs a SetterInjector -
Method Summary
Modifier and TypeMethodDescriptionGet a string key descriptor of the component adapter for use in toString()protected Stringprotected ObjectinjectIntoMember(AccessibleObject member, Object componentInstance, Object toInject) protected booleanisInjectorMethod(Method method) protected ObjectmemberInvocationReturn(Object lastReturn, AccessibleObject member, Object instance) protected voidunsatisfiedDependencies(PicoContainer container, Set<Type> unsatisfiableDependencyTypes, List<AccessibleObject> unsatisfiableDependencyMembers) Methods inherited from class org.picocontainer.injectors.IterativeInjector
crudeMethodSignature, decorateComponentInstance, getComponentInstance, getConstructor, getName, initializeInjectionMembersAndTypeLists, makeParameterNameImpl, verifyMethods inherited from class org.picocontainer.injectors.AbstractInjector
accept, box, caughtIllegalAccessException, caughtIllegalAccessException, caughtInstantiationException, caughtInvocationTargetException, createDefaultParameters, getComponentInstance, newInstance, useNamesMethods inherited from class org.picocontainer.adapters.AbstractAdapter
changeMonitor, checkTypeCompatibility, currentMonitor, findAdapterOfType, getComponentImplementation, getComponentKey, getDelegate, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.picocontainer.ComponentAdapter
findAdapterOfType, getComponentImplementation, getComponentKey, getDelegate
-
Field Details
-
prefix
-
-
Constructor Details
-
SetterInjector
public SetterInjector(Object componentKey, Class componentImplementation, Parameter[] parameters, ComponentMonitor monitor, String prefix, String notThisOneThough, boolean optional, 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')notThisOneThough- a setter name that's not for injecting throughoptional- not all setters need to be injecteduseNames- @throws org.picocontainer.injectors.AbstractInjector.NotConcreteRegistrationException if the implementation is not a concrete class.- Throws:
NullPointerException- if one of the parameters isnullAbstractInjector.NotConcreteRegistrationException
-
-
Method Details
-
memberInvocationReturn
protected Object memberInvocationReturn(Object lastReturn, AccessibleObject member, Object instance) - Specified by:
memberInvocationReturnin classIterativeInjector<T>
-
injectIntoMember
protected Object injectIntoMember(AccessibleObject member, Object componentInstance, Object toInject) throws IllegalAccessException, InvocationTargetException - Specified by:
injectIntoMemberin classIterativeInjector<T>- Throws:
IllegalAccessExceptionInvocationTargetException
-
isInjectorMethod
- Overrides:
isInjectorMethodin classIterativeInjector<T>
-
getInjectorPrefix
-
getDescriptor
Description copied from interface:ComponentAdapterGet a string key descriptor of the component adapter for use in toString()- Specified by:
getDescriptorin interfaceComponentAdapter<T>- Overrides:
getDescriptorin classAbstractInjector<T>- Returns:
- the descriptor
-
unsatisfiedDependencies
protected void unsatisfiedDependencies(PicoContainer container, Set<Type> unsatisfiableDependencyTypes, List<AccessibleObject> unsatisfiableDependencyMembers) - Specified by:
unsatisfiedDependenciesin classIterativeInjector<T>
-