Brian,
I have found some documentation about the adapter mechanism [1]. It would be nice if the injection framework could automatically adapt (if requested).
A frequent pattern obviously is adapting an object received from the active selection. Currently you can ask the specific object you are interested in like so:
@Inject
public void someMethod(@Optional @Named(IServiceConstants.Active_Selection) Person person)
This has the convenience of only receiving Person objects. If the adapter framework is active in this scenario then it would save even more boilerplate code.
@Inject
public void someMethod(@Optional @Adapt @Named(IServiceConstants.Active_Selection) Person person)
<do something>
instead of:
@Inject
public void someMethod(
@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object someObject, Adapter adapter) {
Person person = adapter.adapt(someObject, Person.class);
if(person != null)
<do someting>
I think it is save to say that adaption is ALWAYS required because why would there be an adapter otherwise?
Wim Jongman