Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5795

LoadableDetachableModel/AbstractReadOnlyModel .of(Supplier<T>) to support convenient lambda instantiation in Java8

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 6.18.0
    • None
    • wicket
    • None

    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.

      Sample usage:

      add(new Label("slug", 
          LoadableDetachableModel.of( () -> personRepo.slugFor(getModelObject()) )));
      

      Similar approach for other abstract classes can also be useful for implementing typically single methods like onSubmit, onClick, onConfigure, etc.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ceefour Hendy Irawan
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: