[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [e4-dev] E4 Formal API Part 2: UI Model
|
Hi Wim,
thanks. That feature would be a great and a big saver for boilerplate code. Maybe worth a bug report. Also you may want to consider suggesting a GSoC project for this feature.
Best regards, Lars
2013/3/7 Wim Jongman
<wim.jongman@xxxxxxxxx>
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
_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/e4-dev