What do you think about adding functional interfaces as RPC callbacks to
GWT in the next release and make their use optional? Once Java8 is released
this request will come anyways to make Java code more readable and even
today at least IntelliJ users (not sure about Eclipse) can benefit from
them, because IntelliJ reformats them to lambda style.
Taking GWT-RPC as example we would introduce SuccessCallback<T> and
FailureCallback<Throwable> and you can then choose between
- serverMethod(parameter, new AsyncCallback())
- serverMethod(parameter, new SuccessCallback(), new FailureCallback())
Same for RequestFactory's Receiver and RequestBuilder's RequestCallback.
For example as of today I am using something like the following which reads
quite nice (thanks to IntelliJ's formatting):
service.getPerson(id, createAsyncCallback( //wraps both functional
interfaces into an AsyncCallback because of current API
(result) -> { onPersonLoaded(result); },
(failure) -> { onPersonLoadFailed(failure); }
);
-- J.
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
---
You received this message because you are subscribed to the Google Groups "GWT
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.