Runnable sounds good. But that would be our own "SerializableRunner"
and then the benefit of using java.lang.Runnable is moot.

Isn't it better to introduce a couple of functional interfaces for this?

@FunctionalInterface
public interface OnAjaxEvent extends Serializable {
    public void onEvent(AjaxRequestTarget target);
}

@FunctionalInterface
public interface OnFallbackAjaxEvent extends Serializable {
    public void onEvent(Optional<AjaxRequestTarget> target);
}

@FunctionalInterface
public interface OnEvent extends Serializable {
    public void onEvent();
}

Martijn


On Wed, Jun 15, 2016 at 12:45 PM, Martin Grigorov <[email protected]> wrote:
> Hi,
>
> I've started refactoring wicket-examples to use more of the Java 8
> functionalities in Wicket and
> I've found a problem with Link#onClick(String, WicketConsumer<Void>) method.
> See
> https://github.com/apache/wicket/commit/5d87f50646d13d858eab69d7892075be8cdb1dbd#diff-0419829765d01bcc9911c318ea9bba4e
> Here I needed to use "(ignoreme)" as an input for the lambda to make it
> compileable.
> The problem is that Java 8 doesn't provide Consumer without an input.
> Here is a discussion about this:
> http://programmers.stackexchange.com/questions/276859/what-is-the-name-of-a-function-that-takes-no-argument-and-returns-nothing
>
> Shall we introduce our own Consumer0/Procedure/Command or use
> java.lang.Runnable in the API ?
>
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

Reply via email to