You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2014/12/29 20:13:14 UTC

[jira] [Commented] (WICKET-5795) LoadableDetachableModel/AbstractReadOnlyModel .of(Supplier) to support convenient lambda instantiation in Java8

    [ https://issues.apache.org/jira/browse/WICKET-5795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14260334#comment-14260334 ] 

Sven Meier commented on WICKET-5795:
------------------------------------

Any differences/advantages to:

https://github.com/todvora/wicket-lambdamodel

??

> LoadableDetachableModel/AbstractReadOnlyModel .of(Supplier<T>) to support convenient lambda instantiation in Java8
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-5795
>                 URL: https://issues.apache.org/jira/browse/WICKET-5795
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 6.18.0
>            Reporter: Hendy Irawan
>
> I propose adding static method {{LoadableDetachableModel/AbstractReadOnlyModel .of(Supplier<T>)}} so this can be used to quickly create ad-hoc models in Java8 using lambda syntax. (but does not require Java8 in any way). [{{Supplier}} is from Guava library|http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Supplier.html].
> Sample usage:
> {code}
> add(new Label("slug", 
>     LoadableDetachableModel.of( () -> personRepo.slugFor(getModelObject()) )));
> {code}
> Similar approach for other abstract classes can also be useful for implementing typically single methods like {{onSubmit}}, {{onClick}}, {{onConfigure}}, etc.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)