You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Hendy Irawan (JIRA)" <ji...@apache.org> on 2014/12/28 00:58:13 UTC
[jira] [Updated] (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:all-tabpanel ]
Hendy Irawan updated WICKET-5795:
---------------------------------
Description:
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.
was:
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.
> 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)