History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WAFFLE-11
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Michael Ward
Reporter: Michael Ward
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Waffle

Support Setter Injection from Registrar

Created: 16/Jun/07 11:30 PM   Updated: 14/Dec/07 09:36 AM
Component/s: Core
Affects Version/s: None
Fix Version/s: 1.0-rc-1

Time Tracking:
Not Specified


 Description  « Hide
This was submitted by Peter Kovac in an email to me...

Setter Injection:
==============
we are using this for setter injection (PicoRegistrar.java), abstractRegistrar and the interface should be modified too:

public void registerWithSetterInjection(Object key, Class clazz, Object ... parameters) {
SynchronizedComponentAdapter componentAdapter;

if (parameters.length == 0) { componentAdapter = new SynchronizedComponentAdapter(new CachingComponentAdapter(new SetterInjectionComponentAdapter(key, clazz,null))); } else { componentAdapter = new SynchronizedComponentAdapter(new CachingComponentAdapter(new SetterInjectionComponentAdapter(key, clazz, picoParameters(parameters)))); }

picoContainer.registerComponent(componentAdapter);
}



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Michael Ward - 12/Dec/07 07:43 AM
Working on adding support for SetterInjection. Will implement a fluent interface similar to what pico 2 has done

registrar.register(Foo.class)
.setInjectionType(SETTER)
.register(Bar.class)
.setInjectionType(CONSTRUCTOR)
.register(Baz.class);