Hi Tobias,

On Fri, Mar 11, 2016 at 10:06 PM, Tobias Soloschenko <
[email protected]> wrote:

> Hi Martin,
>
> I think option 2 sounds good to me and if this is going to be the
> preferred way we can set old components to deprecated with a javadoc
> linking to the new.
>

For short logic using lambdas is OK, but for something longer I like
#onXyz() better.
Something like the following is also fine for my taste:

class MyPanel extends Panel {

   public MyPanel(String id) {
     super(id);

     add(new LambdaAjaxLink("doAjaxLink", this::onDoAjax));
   }

   private void onDoAjax(AjaxRequestTarget target) { ... }

}



>
> I would prefer not to use a shortcuts like I for Interface ...  -
> LambdaAjaxEventBehavior is good. :-)
>

Yes, I've considered this too, but the idea of the lambdas is to be less
verbose :-)
That's why I've asked for suggestions.


>
> kind regards
>
> Tobias
>
> > Am 11.03.2016 um 21:45 schrieb Martin Grigorov <[email protected]>:
> >
> > Hi,
> >
> > I'd like to ask you for your opinion on the following options:
> >
> > 1) introduce java.util.function.Consumer in the existing components and
> > behaviors
> > Example:
> >
> https://github.com/apache/wicket/blob/lambdas-ajax/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java
> >
> > Pros:
> > - reuse the same components/behaviors as before
> >
> > Cons:
> > - the components/behaviors are no more abstract and the developer may
> > forget to add implementation, i.e. provide consumer or override #onXyz()
> > method
> >
> > 2) introduce new components and behaviors
> > Example:
> >
> https://github.com/apache/wicket/blob/lambdas-ajax-L/wicket-core/src/main/java/org/apache/wicket/ajax/LAjaxEventBehavior.java
> >
> > Pros:
> > - more cleaner API
> >
> > Cons:
> > - yet another class for the same functionality
> > - a bit uglier name. Whatever name I imagine doesn't sound better than
> the
> > name of the original class
> >
> > 3) 2) but in separate module (e.g. wicket-java8)
> >
> > 4) 2) but in WicketStuff project
> >
> > 5) Other ideas ?
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
>

Reply via email to