You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2016/03/11 22:54:42 UTC

More lambdas

Hi,

At "lambdas" [1] branch there are two more features:

1) IReadOnlyModel by Michael Mossman

At the moment there are AbstractReadOnlyModel and SupplierModel (extends
from AROM).
Initially while MM suggested IROM I thought it will be a parent interface
of IModel but it is the opposite - IROM extends from IModel.
I don't see need of IROM. The classes look enough to me.

2) stream based iteration of container's children by Andrea Del Bene
I have said my opinion before - the visitor approach is faster than the
stream based one.
In addition we have to remove the deprecated
org.apache.wicket.util.iterator.AbstractHierarchyIterator and its related
classes because it fails with StackoverflowError when used in a page with
bigger component tree.
So I don't see a reason for this feature.

Your option on them ?

1. https://github.com/apache/wicket/compare/lambdas

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

Re: More lambdas

Posted by Andrea Del Bene <an...@gmail.com>.
Done. I've removed it.
> On 11/03/16 22:54, Martin Grigorov wrote:
>> Hi,
>>
>> At "lambdas" [1] branch there are two more features:
>>
>> 1) IReadOnlyModel by Michael Mossman
>>
>> At the moment there are AbstractReadOnlyModel and SupplierModel (extends
>> from AROM).
>> Initially while MM suggested IROM I thought it will be a parent 
>> interface
>> of IModel but it is the opposite - IROM extends from IModel.
>> I don't see need of IROM. The classes look enough to me.
>>
>> 2) stream based iteration of container's children by Andrea Del Bene
>> I have said my opinion before - the visitor approach is faster than the
>> stream based one.
>> In addition we have to remove the deprecated
>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its 
>> related
>> classes because it fails with StackoverflowError when used in a page 
>> with
>> bigger component tree.
>> So I don't see a reason for this feature.
>>
>> Your option on them ?
> Honestly this idea looked better when it came to my mind :) . It's ok 
> for me if we want to revert its commit (hash 73ac8c7).
>>
>> 1. https://github.com/apache/wicket/compare/lambdas
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>


Re: More lambdas

Posted by Andrea Del Bene <an...@gmail.com>.
On 11/03/16 22:54, Martin Grigorov wrote:
> Hi,
>
> At "lambdas" [1] branch there are two more features:
>
> 1) IReadOnlyModel by Michael Mossman
>
> At the moment there are AbstractReadOnlyModel and SupplierModel (extends
> from AROM).
> Initially while MM suggested IROM I thought it will be a parent interface
> of IModel but it is the opposite - IROM extends from IModel.
> I don't see need of IROM. The classes look enough to me.
>
> 2) stream based iteration of container's children by Andrea Del Bene
> I have said my opinion before - the visitor approach is faster than the
> stream based one.
> In addition we have to remove the deprecated
> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its related
> classes because it fails with StackoverflowError when used in a page with
> bigger component tree.
> So I don't see a reason for this feature.
>
> Your option on them ?
Honestly this idea looked better when it came to my mind :) . It's ok 
for me if we want to revert its commit (hash 73ac8c7).
>
> 1. https://github.com/apache/wicket/compare/lambdas
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>


Re: More lambdas

Posted by Sebastien <se...@gmail.com>.
I like this one :)

IModel<String> personNameModel = Model.loadableDetachable(person::getName);



On Mon, Mar 14, 2016 at 1:44 PM, Tobias Soloschenko <
tobiassoloschenko@googlemail.com> wrote:

> Hi all,
>
> It would ne very nice if the method names for the lambdas are name
> similar, this way I could add a metric to collect data in a more general
> way for wicket-metrics.
>
> WDYT?
>
> Example:
>
> execution(* org.apache.wicket.*Supplier(..))
>
> - First star is the modifier
> - Second star is the wildcard for the lambda class names
> - .. Any args
>
> kind regards
>
> Tobias
>
> > Am 14.03.2016 um 13:23 schrieb Sven Meier <sv...@meiers.net>:
> >
> > Hi Martin,
> >
> > speaking of someting to nuke - insteaf of:
> >
> >        IModel<String> personNameModel = new
> SupplierCachingModel<>(person::getName);
> >
> > Why not simply?
> >
> >        IModel<String> personNameModel =
> Model.loadableDetachable(person::getName);
> >
> > I didn't like the name "Supplier*Caching*Model" anyway.
> >
> > Regards
> > Sven
> >
> >
> >
> >> On 14.03.2016 12:36, Martin Grigorov wrote:
> >> Yes!
> >>
> >> -               IModel<String> personNameModel = new
> >> SupplierModel<>(person::getName);
> >> +               IModel<String> personNameModel = person::getName;
> >>
> >> Definitely makes sense to make it shorter!
> >>
> >> I'll nuke it now!
> >>
> >>
> >> Martin Grigorov
> >> Wicket Training and Consulting
> >> https://twitter.com/mtgrigorov
> >>
> >>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net> wrote:
> >>>
> >>> Hi,
> >>>
> >>> IModel being a functional interface now, what's the use of
> SupplierModel ?
> >>> IMHO we can get rid of it.
> >>>
> >>> Regards
> >>> Sven
> >>>
> >>>
> >>>
> >>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
> >>>>
> >>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
> >>>>
> >>>> Great work all!
> >>>>
> >>>> kind regards
> >>>>
> >>>> Tobias
> >>>>
> >>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
> >>>>>
> >>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
> >>>>>> like:
> >>>>>>
> >>>>>> new Link<String>("", () -> "abc") {
> >>>>>>   @Override
> >>>>>>   public void onClick()
> >>>>>>   {
> >>>>>>      // ...
> >>>>>>   }
> >>>>>> };
> >>>>>>
> >>>>> Seems we're getting a grip on Wicket+lambdas finally :)
> >>>>>
> >>>>> Thanks
> >>>>> Sven
> >>>>>
> >>>>>
> >>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
> >>>>>>
> >>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
> mgrigorov@apache.org
> >>>>>> wrote:
> >>>>>>
> >>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net>
> wrote:
> >>>>>>> Hi,
> >>>>>>>> 1)
> >>>>>>>> we've been twiddling with read-only models for some time now, and
> >>>>>>>> IIRC it
> >>>>>>>> never quite worked out.
> >>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
> >>>>>>>> perhaps I'm missing the point though.
> >>>>>>>>
> >>>>>>>> How about adding another default to IModel:
> >>>>>>>>
> >>>>>>>>      default void setObject(final T object) {
> >>>>>>>>          throw new UnsupportedOperationException();
> >>>>>>>>      }
> >>>>>>>>
> >>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
> >>>>>>>>
> >>>>>>>> A minor thing that bothers me here is that currently
> AROM#setObject()
> >>>>>>> is
> >>>>>>> final, so subclasses are effectively read only too.
> >>>>>>> By moving this method to IModel we cannot make any guarantees.
> >>>>>>> But I guess it will always be used as an anonymous inner class, as
> >>>>>>> AROM is
> >>>>>>> used now. If someone wants to have children then (s)he will have to
> >>>>>>> create
> >>>>>>> a custom class and there (s)he can make it 'final'.
> >>>>>>> Let's do it!
> >>>>>>>
> >>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
> things
> >>>>>> like:
> >>>>>>
> >>>>>> new Link<String>("", () -> "abc") {
> >>>>>>     @Override
> >>>>>>     public void onClick()
> >>>>>>     {
> >>>>>>        // ...
> >>>>>>     }
> >>>>>> };
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> 2)
> >>>>>>>> I don't see a need for this.
> >>>>>>>>
> >>>>>>>> Have fun
> >>>>>>>> Sven
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> how about adding a
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
> >>>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>> At "lambdas" [1] branch there are two more features:
> >>>>>>>>>
> >>>>>>>>> 1) IReadOnlyModel by Michael Mossman
> >>>>>>>>>
> >>>>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel
> >>>>>>>>> (extends
> >>>>>>>>> from AROM).
> >>>>>>>>> Initially while MM suggested IROM I thought it will be a parent
> >>>>>>>>> interface
> >>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
> >>>>>>>>> I don't see need of IROM. The classes look enough to me.
> >>>>>>>>>
> >>>>>>>>> 2) stream based iteration of container's children by Andrea Del
> Bene
> >>>>>>>>> I have said my opinion before - the visitor approach is faster
> than
> >>>>>>>>> the
> >>>>>>>>> stream based one.
> >>>>>>>>> In addition we have to remove the deprecated
> >>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its
> >>>>>>>>> related
> >>>>>>>>> classes because it fails with StackoverflowError when used in a
> page
> >>>>>>>>> with
> >>>>>>>>> bigger component tree.
> >>>>>>>>> So I don't see a reason for this feature.
> >>>>>>>>>
> >>>>>>>>> Your option on them ?
> >>>>>>>>>
> >>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
> >>>>>>>>>
> >>>>>>>>> Martin Grigorov
> >>>>>>>>> Wicket Training and Consulting
> >>>>>>>>> https://twitter.com/mtgrigorov
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >
>

Re: More lambdas

Posted by Tobias Soloschenko <to...@googlemail.com>.
Hi all,

It would ne very nice if the method names for the lambdas are name similar, this way I could add a metric to collect data in a more general way for wicket-metrics.

WDYT?

Example:

execution(* org.apache.wicket.*Supplier(..))

- First star is the modifier
- Second star is the wildcard for the lambda class names
- .. Any args

kind regards

Tobias

> Am 14.03.2016 um 13:23 schrieb Sven Meier <sv...@meiers.net>:
> 
> Hi Martin,
> 
> speaking of someting to nuke - insteaf of:
> 
>        IModel<String> personNameModel = new SupplierCachingModel<>(person::getName);
> 
> Why not simply?
> 
>        IModel<String> personNameModel = Model.loadableDetachable(person::getName);
> 
> I didn't like the name "Supplier*Caching*Model" anyway.
> 
> Regards
> Sven
> 
> 
> 
>> On 14.03.2016 12:36, Martin Grigorov wrote:
>> Yes!
>> 
>> -               IModel<String> personNameModel = new
>> SupplierModel<>(person::getName);
>> +               IModel<String> personNameModel = person::getName;
>> 
>> Definitely makes sense to make it shorter!
>> 
>> I'll nuke it now!
>> 
>> 
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>> 
>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net> wrote:
>>> 
>>> Hi,
>>> 
>>> IModel being a functional interface now, what's the use of SupplierModel ?
>>> IMHO we can get rid of it.
>>> 
>>> Regards
>>> Sven
>>> 
>>> 
>>> 
>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>> 
>>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>>> 
>>>> Great work all!
>>>> 
>>>> kind regards
>>>> 
>>>> Tobias
>>>> 
>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>> 
>>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>>> like:
>>>>>> 
>>>>>> new Link<String>("", () -> "abc") {
>>>>>>   @Override
>>>>>>   public void onClick()
>>>>>>   {
>>>>>>      // ...
>>>>>>   }
>>>>>> };
>>>>>> 
>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>> 
>>>>> Thanks
>>>>> Sven
>>>>> 
>>>>> 
>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>> 
>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <mgrigorov@apache.org
>>>>>> wrote:
>>>>>> 
>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>>> Hi,
>>>>>>>> 1)
>>>>>>>> we've been twiddling with read-only models for some time now, and
>>>>>>>> IIRC it
>>>>>>>> never quite worked out.
>>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>>>>>>> perhaps I'm missing the point though.
>>>>>>>> 
>>>>>>>> How about adding another default to IModel:
>>>>>>>> 
>>>>>>>>      default void setObject(final T object) {
>>>>>>>>          throw new UnsupportedOperationException();
>>>>>>>>      }
>>>>>>>> 
>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>> 
>>>>>>>> A minor thing that bothers me here is that currently AROM#setObject()
>>>>>>> is
>>>>>>> final, so subclasses are effectively read only too.
>>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>>> But I guess it will always be used as an anonymous inner class, as
>>>>>>> AROM is
>>>>>>> used now. If someone wants to have children then (s)he will have to
>>>>>>> create
>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>> Let's do it!
>>>>>>> 
>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>>> like:
>>>>>> 
>>>>>> new Link<String>("", () -> "abc") {
>>>>>>     @Override
>>>>>>     public void onClick()
>>>>>>     {
>>>>>>        // ...
>>>>>>     }
>>>>>> };
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> 2)
>>>>>>>> I don't see a need for this.
>>>>>>>> 
>>>>>>>> Have fun
>>>>>>>> Sven
>>>>>>>> 
>>>>>>>> 
>>>>>>>> how about adding a
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>> 
>>>>>>>> Hi,
>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>> 
>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>> 
>>>>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel
>>>>>>>>> (extends
>>>>>>>>> from AROM).
>>>>>>>>> Initially while MM suggested IROM I thought it will be a parent
>>>>>>>>> interface
>>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>> 
>>>>>>>>> 2) stream based iteration of container's children by Andrea Del Bene
>>>>>>>>> I have said my opinion before - the visitor approach is faster than
>>>>>>>>> the
>>>>>>>>> stream based one.
>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its
>>>>>>>>> related
>>>>>>>>> classes because it fails with StackoverflowError when used in a page
>>>>>>>>> with
>>>>>>>>> bigger component tree.
>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>> 
>>>>>>>>> Your option on them ?
>>>>>>>>> 
>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>> 
>>>>>>>>> Martin Grigorov
>>>>>>>>> Wicket Training and Consulting
>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
> 

Re: More lambdas

Posted by Sven Meier <sv...@meiers.net>.
BTW many thanks to user "ageery" for his lambda ideas on wicketstuff-lambda.

Have fun
Sven


On 16.03.2016 09:55, Tobias Soloschenko wrote:
> I would add a chapter in the user guide.
>
> kind regards
>
> Tobias
>
>> Am 16.03.2016 um 09:33 schrieb Sebastien <se...@gmail.com>:
>>
>> Looks very nice (and complete)! Thanks Sven!
>> Good recap to be candidate for a how-to-wicket-8 document in confluence?
>>
>>
>> On Tue, Mar 15, 2016 at 11:55 AM, Martin Grigorov <mg...@apache.org>
>> wrote:
>>
>>> Great!
>>> Thanks, Sven!
>>>
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>>
>>>> On Tue, Mar 15, 2016 at 11:52 AM, Sven Meier <sv...@meiers.net> wrote:
>>>>
>>>> Hi again,
>>>>
>>>> I added a factory for a read-only variant too.
>>>>
>>>> To recap all options:
>>>>
>>>>     IModel<String> personNameModel =
>>>>
>>>> // getter lambda
>>>>           () -> person.getName();
>>>> // getter instance function reference
>>>>           person::getName;
>>>> // getter and setter lambda
>>>>           LambdaModel.of(() -> person.getName(), (name) ->
>>>> person.setName(name));
>>>> // getter and setter instance function references
>>>>           LambdaModel.of(person::getName, person::setName);
>>>> // target model with getter class function reference
>>>>           LambdaModel.of(personModel, Person::getName);
>>>> // target model with getter and setter class function references
>>>>           LambdaModel.of(personModel, Person::getName, Person::setName);
>>>>
>>>> Regards
>>>> Sven
>>>>


Re: More lambdas

Posted by Tobias Soloschenko <to...@googlemail.com>.
I would add a chapter in the user guide.

kind regards

Tobias

> Am 16.03.2016 um 09:33 schrieb Sebastien <se...@gmail.com>:
> 
> Looks very nice (and complete)! Thanks Sven!
> Good recap to be candidate for a how-to-wicket-8 document in confluence?
> 
> 
> On Tue, Mar 15, 2016 at 11:55 AM, Martin Grigorov <mg...@apache.org>
> wrote:
> 
>> Great!
>> Thanks, Sven!
>> 
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>> 
>>> On Tue, Mar 15, 2016 at 11:52 AM, Sven Meier <sv...@meiers.net> wrote:
>>> 
>>> Hi again,
>>> 
>>> I added a factory for a read-only variant too.
>>> 
>>> To recap all options:
>>> 
>>>    IModel<String> personNameModel =
>>> 
>>> // getter lambda
>>>          () -> person.getName();
>>> // getter instance function reference
>>>          person::getName;
>>> // getter and setter lambda
>>>          LambdaModel.of(() -> person.getName(), (name) ->
>>> person.setName(name));
>>> // getter and setter instance function references
>>>          LambdaModel.of(person::getName, person::setName);
>>> // target model with getter class function reference
>>>          LambdaModel.of(personModel, Person::getName);
>>> // target model with getter and setter class function references
>>>          LambdaModel.of(personModel, Person::getName, Person::setName);
>>> 
>>> Regards
>>> Sven
>>> 
>> 

Re: More lambdas

Posted by Sebastien <se...@gmail.com>.
Looks very nice (and complete)! Thanks Sven!
Good recap to be candidate for a how-to-wicket-8 document in confluence?


On Tue, Mar 15, 2016 at 11:55 AM, Martin Grigorov <mg...@apache.org>
wrote:

> Great!
> Thanks, Sven!
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, Mar 15, 2016 at 11:52 AM, Sven Meier <sv...@meiers.net> wrote:
>
> > Hi again,
> >
> > I added a factory for a read-only variant too.
> >
> > To recap all options:
> >
> >     IModel<String> personNameModel =
> >
> > // getter lambda
> >           () -> person.getName();
> > // getter instance function reference
> >           person::getName;
> > // getter and setter lambda
> >           LambdaModel.of(() -> person.getName(), (name) ->
> > person.setName(name));
> > // getter and setter instance function references
> >           LambdaModel.of(person::getName, person::setName);
> > // target model with getter class function reference
> >           LambdaModel.of(personModel, Person::getName);
> > // target model with getter and setter class function references
> >           LambdaModel.of(personModel, Person::getName, Person::setName);
> >
> > Regards
> > Sven
> >
>

Re: More lambdas

Posted by Martin Grigorov <mg...@apache.org>.
Great!
Thanks, Sven!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Mar 15, 2016 at 11:52 AM, Sven Meier <sv...@meiers.net> wrote:

> Hi again,
>
> I added a factory for a read-only variant too.
>
> To recap all options:
>
>     IModel<String> personNameModel =
>
> // getter lambda
>           () -> person.getName();
> // getter instance function reference
>           person::getName;
> // getter and setter lambda
>           LambdaModel.of(() -> person.getName(), (name) ->
> person.setName(name));
> // getter and setter instance function references
>           LambdaModel.of(person::getName, person::setName);
> // target model with getter class function reference
>           LambdaModel.of(personModel, Person::getName);
> // target model with getter and setter class function references
>           LambdaModel.of(personModel, Person::getName, Person::setName);
>
> Regards
> Sven
>
>
>
> On 15.03.2016 11:03, Sven Meier wrote:
>
>> Hi Sebastien,
>>
>> for a read-only model you can just use this shortcut:
>>
>>     IModel<String> personNameModel = person::getName;
>>
>> Or do you mean a read-only for when 'person' is actually a model?
>>
>> Regards
>> Sven
>>
>>
>> On 15.03.2016 10:57, Sebastien wrote:
>>
>>> Could a read-only model just be like that?
>>> IModel<String> personNameModel = LambdaModel.of(person::getName);
>>>
>>> On Tue, Mar 15, 2016 at 10:43 AM, Sven Meier <sv...@meiers.net> wrote:
>>>
>>> Hi,
>>>>
>>>> I found a nice additional usage for LambdaModel. With static factory
>>>> methods you can use it in two ways now:
>>>>
>>>>          IModel<String> personNameModel =
>>>> LambdaModel.of(person::getName,
>>>> person::setName);
>>>>
>>>> ... or if you have a model ...
>>>>
>>>>          IModel<String> personNameModel = LambdaModel.of(personModel,
>>>> Person::getName, Person::setName);
>>>>
>>>> Let me know if you'd rather have a separate class for this.
>>>>
>>>> Have fun
>>>> Sven
>>>>
>>>>
>>>>
>>>> On 14.03.2016 22:53, Martin Grigorov wrote:
>>>>
>>>> I've checked all other IModel implementations but I didn't see more
>>>>> candidates for lambd-ification.
>>>>>
>>>>> Martin Grigorov
>>>>> Wicket Training and Consulting
>>>>> https://twitter.com/mtgrigorov
>>>>>
>>>>> On Mon, Mar 14, 2016 at 4:15 PM, Martin Grigorov <mgrigorov@apache.org
>>>>> >
>>>>> wrote:
>>>>>
>>>>> I've merged that branch.
>>>>>
>>>>>> Now the Lambdas class with the factory methods for components and
>>>>>> behaviors is also in master.
>>>>>> Any ideas for improvements are welcome!
>>>>>>
>>>>>> Martin Grigorov
>>>>>> Wicket Training and Consulting
>>>>>> https://twitter.com/mtgrigorov
>>>>>>
>>>>>> On Mon, Mar 14, 2016 at 4:01 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>>
>>>>>> I didn't want to put every idea directly in master.
>>>>>>
>>>>>>> Thanks to this procedure we've progressed a lot with lambdas :).
>>>>>>>
>>>>>>> Thanks
>>>>>>> Sven
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 14.03.2016 15:49, Martin Grigorov wrote:
>>>>>>>
>>>>>>> I didn't want to put every idea directly in master.
>>>>>>>
>>>>>>>> First wanted to here opinions.
>>>>>>>> But I see how this makes it hard to follow.
>>>>>>>> I'll merge this branch to master and then we can just rework
>>>>>>>> whatever
>>>>>>>> we
>>>>>>>> find not optimal directly there.
>>>>>>>>
>>>>>>>> Martin Grigorov
>>>>>>>> Wicket Training and Consulting
>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>
>>>>>>>> On Mon, Mar 14, 2016 at 3:16 PM, Sven Meier <sv...@meiers.net>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hm, I starting to lose track of what is on which branch :/.
>>>>>>>>
>>>>>>>> Sven
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 14.03.2016 14:09, Martin Grigorov wrote:
>>>>>>>>>
>>>>>>>>> Hi Sven
>>>>>>>>>
>>>>>>>>> On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi Martin,
>>>>>>>>>>
>>>>>>>>>> speaking of someting to nuke - insteaf of:
>>>>>>>>>>
>>>>>>>>>>> IModel<String> personNameModel = new
>>>>>>>>>>> SupplierCachingModel<>(person::getName);
>>>>>>>>>>>
>>>>>>>>>>> Why not simply?
>>>>>>>>>>>
>>>>>>>>>>>             IModel<String> personNameModel =
>>>>>>>>>>> Model.loadableDetachable(person::getName);
>>>>>>>>>>>
>>>>>>>>>>> I didn't like the name "Supplier*Caching*Model" anyway.
>>>>>>>>>>>
>>>>>>>>>>> It is there already
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208
>>>>>>>>>>
>>>>>>>>>> But I agree there is no need of SupplierCachingModel as a separate
>>>>>>>>>> class.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>>
>>>>>>>>>> Sven
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 14.03.2016 12:36, Martin Grigorov wrote:
>>>>>>>>>>>
>>>>>>>>>>> Yes!
>>>>>>>>>>>
>>>>>>>>>>> -               IModel<String> personNameModel = new
>>>>>>>>>>>
>>>>>>>>>>>> SupplierModel<>(person::getName);
>>>>>>>>>>>> +               IModel<String> personNameModel =
>>>>>>>>>>>> person::getName;
>>>>>>>>>>>>
>>>>>>>>>>>> Definitely makes sense to make it shorter!
>>>>>>>>>>>>
>>>>>>>>>>>> I'll nuke it now!
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>>
>>>>>>>>>>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> IModel being a functional interface now, what's the use of
>>>>>>>>>>>>
>>>>>>>>>>>> SupplierModel
>>>>>>>>>>>>> ?
>>>>>>>>>>>>> IMHO we can get rid of it.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Regards
>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Yep - I am very happy about it, too - cool features for wicket
>>>>>>>>>>>>> 8
>>>>>>>>>>>>> :-)
>>>>>>>>>>>>>
>>>>>>>>>>>>> Great work all!
>>>>>>>>>>>>>
>>>>>>>>>>>>> kind regards
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Tobias
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>>>>>>> things
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> like:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>        @Override
>>>>>>>>>>>>>>>>        public void onClick()
>>>>>>>>>>>>>>>>        {
>>>>>>>>>>>>>>>>           // ...
>>>>>>>>>>>>>>>>        }
>>>>>>>>>>>>>>>> };
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> mgrigorov@apache.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <
>>>>>>>>>>>>>>>> sven@meiers.net>
>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> 1)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> we've been twiddling with read-only models for some time
>>>>>>>>>>>>>>>>> now,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> and
>>>>>>>>>>>>>>>>>> IIRC it
>>>>>>>>>>>>>>>>>> never quite worked out.
>>>>>>>>>>>>>>>>>> I don't see much benefit in IReadOnlyModel as it is
>>>>>>>>>>>>>>>>>> proposed
>>>>>>>>>>>>>>>>>> now -
>>>>>>>>>>>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> How about adding another default to IModel:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>           default void setObject(final T object) {
>>>>>>>>>>>>>>>>>>               throw new UnsupportedOperationException();
>>>>>>>>>>>>>>>>>>           }
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>>>>>>>>>>>> AROM#setObject()
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> is
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> final, so subclasses are effectively read only too.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> By moving this method to IModel we cannot make any
>>>>>>>>>>>>>>>>> guarantees.
>>>>>>>>>>>>>>>>> But I guess it will always be used as an anonymous inner
>>>>>>>>>>>>>>>>> class,
>>>>>>>>>>>>>>>>> as
>>>>>>>>>>>>>>>>> AROM is
>>>>>>>>>>>>>>>>> used now. If someone wants to have children then (s)he will
>>>>>>>>>>>>>>>>> have to
>>>>>>>>>>>>>>>>> create
>>>>>>>>>>>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>>>>>>>>>>>> Let's do it!
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one
>>>>>>>>>>>>>>>>> can do
>>>>>>>>>>>>>>>>> things
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> like:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>          @Override
>>>>>>>>>>>>>>>>          public void onClick()
>>>>>>>>>>>>>>>>          {
>>>>>>>>>>>>>>>>             // ...
>>>>>>>>>>>>>>>>          }
>>>>>>>>>>>>>>>> };
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> 2)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I don't see a need for this.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Have fun
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> how about adding a
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> At the moment there are AbstractReadOnlyModel and
>>>>>>>>>>>>>>>>>>> SupplierModel
>>>>>>>>>>>>>>>>>>> (extends
>>>>>>>>>>>>>>>>>>> from AROM).
>>>>>>>>>>>>>>>>>>> Initially while MM suggested IROM I thought it will be a
>>>>>>>>>>>>>>>>>>> parent
>>>>>>>>>>>>>>>>>>> interface
>>>>>>>>>>>>>>>>>>> of IModel but it is the opposite - IROM extends from
>>>>>>>>>>>>>>>>>>> IModel.
>>>>>>>>>>>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> 2) stream based iteration of container's children by
>>>>>>>>>>>>>>>>>>> Andrea
>>>>>>>>>>>>>>>>>>> Del
>>>>>>>>>>>>>>>>>>> Bene
>>>>>>>>>>>>>>>>>>> I have said my opinion before - the visitor approach is
>>>>>>>>>>>>>>>>>>> faster
>>>>>>>>>>>>>>>>>>> than
>>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>>> stream based one.
>>>>>>>>>>>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>>>>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> and
>>>>>>>>>>>>>>>>>>> its
>>>>>>>>>>>>>>>>>>> related
>>>>>>>>>>>>>>>>>>> classes because it fails with StackoverflowError when
>>>>>>>>>>>>>>>>>>> used
>>>>>>>>>>>>>>>>>>> in
>>>>>>>>>>>>>>>>>>> a
>>>>>>>>>>>>>>>>>>> page
>>>>>>>>>>>>>>>>>>> with
>>>>>>>>>>>>>>>>>>> bigger component tree.
>>>>>>>>>>>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Your option on them ?
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>
>

Re: More lambdas

Posted by Sven Meier <sv...@meiers.net>.
Hi again,

I added a factory for a read-only variant too.

To recap all options:

     IModel<String> personNameModel =

// getter lambda
           () -> person.getName();
// getter instance function reference
           person::getName;
// getter and setter lambda
           LambdaModel.of(() -> person.getName(), (name) -> 
person.setName(name));
// getter and setter instance function references
           LambdaModel.of(person::getName, person::setName);
// target model with getter class function reference
           LambdaModel.of(personModel, Person::getName);
// target model with getter and setter class function references
           LambdaModel.of(personModel, Person::getName, Person::setName);

Regards
Sven


On 15.03.2016 11:03, Sven Meier wrote:
> Hi Sebastien,
>
> for a read-only model you can just use this shortcut:
>
>     IModel<String> personNameModel = person::getName;
>
> Or do you mean a read-only for when 'person' is actually a model?
>
> Regards
> Sven
>
>
> On 15.03.2016 10:57, Sebastien wrote:
>> Could a read-only model just be like that?
>> IModel<String> personNameModel = LambdaModel.of(person::getName);
>>
>> On Tue, Mar 15, 2016 at 10:43 AM, Sven Meier <sv...@meiers.net> wrote:
>>
>>> Hi,
>>>
>>> I found a nice additional usage for LambdaModel. With static factory
>>> methods you can use it in two ways now:
>>>
>>>          IModel<String> personNameModel = 
>>> LambdaModel.of(person::getName,
>>> person::setName);
>>>
>>> ... or if you have a model ...
>>>
>>>          IModel<String> personNameModel = LambdaModel.of(personModel,
>>> Person::getName, Person::setName);
>>>
>>> Let me know if you'd rather have a separate class for this.
>>>
>>> Have fun
>>> Sven
>>>
>>>
>>>
>>> On 14.03.2016 22:53, Martin Grigorov wrote:
>>>
>>>> I've checked all other IModel implementations but I didn't see more
>>>> candidates for lambd-ification.
>>>>
>>>> Martin Grigorov
>>>> Wicket Training and Consulting
>>>> https://twitter.com/mtgrigorov
>>>>
>>>> On Mon, Mar 14, 2016 at 4:15 PM, Martin Grigorov 
>>>> <mg...@apache.org>
>>>> wrote:
>>>>
>>>> I've merged that branch.
>>>>> Now the Lambdas class with the factory methods for components and
>>>>> behaviors is also in master.
>>>>> Any ideas for improvements are welcome!
>>>>>
>>>>> Martin Grigorov
>>>>> Wicket Training and Consulting
>>>>> https://twitter.com/mtgrigorov
>>>>>
>>>>> On Mon, Mar 14, 2016 at 4:01 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>
>>>>> I didn't want to put every idea directly in master.
>>>>>> Thanks to this procedure we've progressed a lot with lambdas :).
>>>>>>
>>>>>> Thanks
>>>>>> Sven
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 14.03.2016 15:49, Martin Grigorov wrote:
>>>>>>
>>>>>> I didn't want to put every idea directly in master.
>>>>>>> First wanted to here opinions.
>>>>>>> But I see how this makes it hard to follow.
>>>>>>> I'll merge this branch to master and then we can just rework 
>>>>>>> whatever
>>>>>>> we
>>>>>>> find not optimal directly there.
>>>>>>>
>>>>>>> Martin Grigorov
>>>>>>> Wicket Training and Consulting
>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>
>>>>>>> On Mon, Mar 14, 2016 at 3:16 PM, Sven Meier <sv...@meiers.net> 
>>>>>>> wrote:
>>>>>>>
>>>>>>> Hm, I starting to lose track of what is on which branch :/.
>>>>>>>
>>>>>>>> Sven
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 14.03.2016 14:09, Martin Grigorov wrote:
>>>>>>>>
>>>>>>>> Hi Sven
>>>>>>>>
>>>>>>>>> On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net> 
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hi Martin,
>>>>>>>>>
>>>>>>>>> speaking of someting to nuke - insteaf of:
>>>>>>>>>> IModel<String> personNameModel = new
>>>>>>>>>> SupplierCachingModel<>(person::getName);
>>>>>>>>>>
>>>>>>>>>> Why not simply?
>>>>>>>>>>
>>>>>>>>>>             IModel<String> personNameModel =
>>>>>>>>>> Model.loadableDetachable(person::getName);
>>>>>>>>>>
>>>>>>>>>> I didn't like the name "Supplier*Caching*Model" anyway.
>>>>>>>>>>
>>>>>>>>>> It is there already
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208 
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> But I agree there is no need of SupplierCachingModel as a 
>>>>>>>>> separate
>>>>>>>>> class.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>>
>>>>>>>>> Sven
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 14.03.2016 12:36, Martin Grigorov wrote:
>>>>>>>>>>
>>>>>>>>>> Yes!
>>>>>>>>>>
>>>>>>>>>> -               IModel<String> personNameModel = new
>>>>>>>>>>> SupplierModel<>(person::getName);
>>>>>>>>>>> +               IModel<String> personNameModel = 
>>>>>>>>>>> person::getName;
>>>>>>>>>>>
>>>>>>>>>>> Definitely makes sense to make it shorter!
>>>>>>>>>>>
>>>>>>>>>>> I'll nuke it now!
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> IModel being a functional interface now, what's the use of
>>>>>>>>>>>
>>>>>>>>>>>> SupplierModel
>>>>>>>>>>>> ?
>>>>>>>>>>>> IMHO we can get rid of it.
>>>>>>>>>>>>
>>>>>>>>>>>> Regards
>>>>>>>>>>>> Sven
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Yep - I am very happy about it, too - cool features for 
>>>>>>>>>>>> wicket 8
>>>>>>>>>>>> :-)
>>>>>>>>>>>>
>>>>>>>>>>>> Great work all!
>>>>>>>>>>>>
>>>>>>>>>>>>> kind regards
>>>>>>>>>>>>>
>>>>>>>>>>>>> Tobias
>>>>>>>>>>>>>
>>>>>>>>>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>>>>>>>>>>
>>>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one 
>>>>>>>>>>>>> can do
>>>>>>>>>>>>> things
>>>>>>>>>>>>>
>>>>>>>>>>>>> like:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>>>>>        @Override
>>>>>>>>>>>>>>>        public void onClick()
>>>>>>>>>>>>>>>        {
>>>>>>>>>>>>>>>           // ...
>>>>>>>>>>>>>>>        }
>>>>>>>>>>>>>>> };
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> mgrigorov@apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier 
>>>>>>>>>>>>>>> <sv...@meiers.net>
>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 1)
>>>>>>>>>>>>>>>> we've been twiddling with read-only models for some 
>>>>>>>>>>>>>>>> time now,
>>>>>>>>>>>>>>>>> and
>>>>>>>>>>>>>>>>> IIRC it
>>>>>>>>>>>>>>>>> never quite worked out.
>>>>>>>>>>>>>>>>> I don't see much benefit in IReadOnlyModel as it is 
>>>>>>>>>>>>>>>>> proposed
>>>>>>>>>>>>>>>>> now -
>>>>>>>>>>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> How about adding another default to IModel:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>           default void setObject(final T object) {
>>>>>>>>>>>>>>>>>               throw new UnsupportedOperationException();
>>>>>>>>>>>>>>>>>           }
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>>>>>>>>>>> AROM#setObject()
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> is
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> final, so subclasses are effectively read only too.
>>>>>>>>>>>>>>>> By moving this method to IModel we cannot make any 
>>>>>>>>>>>>>>>> guarantees.
>>>>>>>>>>>>>>>> But I guess it will always be used as an anonymous inner
>>>>>>>>>>>>>>>> class,
>>>>>>>>>>>>>>>> as
>>>>>>>>>>>>>>>> AROM is
>>>>>>>>>>>>>>>> used now. If someone wants to have children then (s)he 
>>>>>>>>>>>>>>>> will
>>>>>>>>>>>>>>>> have to
>>>>>>>>>>>>>>>> create
>>>>>>>>>>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>>>>>>>>>>> Let's do it!
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one 
>>>>>>>>>>>>>>>> can do
>>>>>>>>>>>>>>>> things
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> like:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>>>>>          @Override
>>>>>>>>>>>>>>>          public void onClick()
>>>>>>>>>>>>>>>          {
>>>>>>>>>>>>>>>             // ...
>>>>>>>>>>>>>>>          }
>>>>>>>>>>>>>>> };
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 2)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I don't see a need for this.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Have fun
>>>>>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> how about adding a
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>>>>>>>>>> At the moment there are AbstractReadOnlyModel and
>>>>>>>>>>>>>>>>>> SupplierModel
>>>>>>>>>>>>>>>>>> (extends
>>>>>>>>>>>>>>>>>> from AROM).
>>>>>>>>>>>>>>>>>> Initially while MM suggested IROM I thought it will be a
>>>>>>>>>>>>>>>>>> parent
>>>>>>>>>>>>>>>>>> interface
>>>>>>>>>>>>>>>>>> of IModel but it is the opposite - IROM extends from 
>>>>>>>>>>>>>>>>>> IModel.
>>>>>>>>>>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> 2) stream based iteration of container's children by 
>>>>>>>>>>>>>>>>>> Andrea
>>>>>>>>>>>>>>>>>> Del
>>>>>>>>>>>>>>>>>> Bene
>>>>>>>>>>>>>>>>>> I have said my opinion before - the visitor approach is
>>>>>>>>>>>>>>>>>> faster
>>>>>>>>>>>>>>>>>> than
>>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>>> stream based one.
>>>>>>>>>>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>>>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator 
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> and
>>>>>>>>>>>>>>>>>> its
>>>>>>>>>>>>>>>>>> related
>>>>>>>>>>>>>>>>>> classes because it fails with StackoverflowError when 
>>>>>>>>>>>>>>>>>> used
>>>>>>>>>>>>>>>>>> in
>>>>>>>>>>>>>>>>>> a
>>>>>>>>>>>>>>>>>> page
>>>>>>>>>>>>>>>>>> with
>>>>>>>>>>>>>>>>>> bigger component tree.
>>>>>>>>>>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Your option on them ?
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>


Re: More lambdas

Posted by Sven Meier <sv...@meiers.net>.
Hi Sebastien,

for a read-only model you can just use this shortcut:

     IModel<String> personNameModel = person::getName;

Or do you mean a read-only for when 'person' is actually a model?

Regards
Sven


On 15.03.2016 10:57, Sebastien wrote:
> Could a read-only model just be like that?
> IModel<String> personNameModel = LambdaModel.of(person::getName);
>
> On Tue, Mar 15, 2016 at 10:43 AM, Sven Meier <sv...@meiers.net> wrote:
>
>> Hi,
>>
>> I found a nice additional usage for LambdaModel. With static factory
>> methods you can use it in two ways now:
>>
>>          IModel<String> personNameModel = LambdaModel.of(person::getName,
>> person::setName);
>>
>> ... or if you have a model ...
>>
>>          IModel<String> personNameModel = LambdaModel.of(personModel,
>> Person::getName, Person::setName);
>>
>> Let me know if you'd rather have a separate class for this.
>>
>> Have fun
>> Sven
>>
>>
>>
>> On 14.03.2016 22:53, Martin Grigorov wrote:
>>
>>> I've checked all other IModel implementations but I didn't see more
>>> candidates for lambd-ification.
>>>
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>>
>>> On Mon, Mar 14, 2016 at 4:15 PM, Martin Grigorov <mg...@apache.org>
>>> wrote:
>>>
>>> I've merged that branch.
>>>> Now the Lambdas class with the factory methods for components and
>>>> behaviors is also in master.
>>>> Any ideas for improvements are welcome!
>>>>
>>>> Martin Grigorov
>>>> Wicket Training and Consulting
>>>> https://twitter.com/mtgrigorov
>>>>
>>>> On Mon, Mar 14, 2016 at 4:01 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>
>>>> I didn't want to put every idea directly in master.
>>>>> Thanks to this procedure we've progressed a lot with lambdas :).
>>>>>
>>>>> Thanks
>>>>> Sven
>>>>>
>>>>>
>>>>>
>>>>> On 14.03.2016 15:49, Martin Grigorov wrote:
>>>>>
>>>>> I didn't want to put every idea directly in master.
>>>>>> First wanted to here opinions.
>>>>>> But I see how this makes it hard to follow.
>>>>>> I'll merge this branch to master and then we can just rework whatever
>>>>>> we
>>>>>> find not optimal directly there.
>>>>>>
>>>>>> Martin Grigorov
>>>>>> Wicket Training and Consulting
>>>>>> https://twitter.com/mtgrigorov
>>>>>>
>>>>>> On Mon, Mar 14, 2016 at 3:16 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>>
>>>>>> Hm, I starting to lose track of what is on which branch :/.
>>>>>>
>>>>>>> Sven
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 14.03.2016 14:09, Martin Grigorov wrote:
>>>>>>>
>>>>>>> Hi Sven
>>>>>>>
>>>>>>>> On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>>>>
>>>>>>>> Hi Martin,
>>>>>>>>
>>>>>>>> speaking of someting to nuke - insteaf of:
>>>>>>>>>             IModel<String> personNameModel = new
>>>>>>>>> SupplierCachingModel<>(person::getName);
>>>>>>>>>
>>>>>>>>> Why not simply?
>>>>>>>>>
>>>>>>>>>             IModel<String> personNameModel =
>>>>>>>>> Model.loadableDetachable(person::getName);
>>>>>>>>>
>>>>>>>>> I didn't like the name "Supplier*Caching*Model" anyway.
>>>>>>>>>
>>>>>>>>> It is there already
>>>>>>>>>
>>>>>>>>>
>>>>>>>> https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208
>>>>>>>>
>>>>>>>> But I agree there is no need of SupplierCachingModel as a separate
>>>>>>>> class.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>> Sven
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 14.03.2016 12:36, Martin Grigorov wrote:
>>>>>>>>>
>>>>>>>>> Yes!
>>>>>>>>>
>>>>>>>>> -               IModel<String> personNameModel = new
>>>>>>>>>> SupplierModel<>(person::getName);
>>>>>>>>>> +               IModel<String> personNameModel = person::getName;
>>>>>>>>>>
>>>>>>>>>> Definitely makes sense to make it shorter!
>>>>>>>>>>
>>>>>>>>>> I'll nuke it now!
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Martin Grigorov
>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>
>>>>>>>>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> IModel being a functional interface now, what's the use of
>>>>>>>>>>
>>>>>>>>>>> SupplierModel
>>>>>>>>>>> ?
>>>>>>>>>>> IMHO we can get rid of it.
>>>>>>>>>>>
>>>>>>>>>>> Regards
>>>>>>>>>>> Sven
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>>>>>>>>>
>>>>>>>>>>> Yep - I am very happy about it, too - cool features for wicket 8
>>>>>>>>>>> :-)
>>>>>>>>>>>
>>>>>>>>>>> Great work all!
>>>>>>>>>>>
>>>>>>>>>>>> kind regards
>>>>>>>>>>>>
>>>>>>>>>>>> Tobias
>>>>>>>>>>>>
>>>>>>>>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>>>>>>>>>
>>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>>>>> things
>>>>>>>>>>>>
>>>>>>>>>>>> like:
>>>>>>>>>>>>
>>>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>>>>        @Override
>>>>>>>>>>>>>>        public void onClick()
>>>>>>>>>>>>>>        {
>>>>>>>>>>>>>>           // ...
>>>>>>>>>>>>>>        }
>>>>>>>>>>>>>> };
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>>
>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>>>>>>>>>
>>>>>>>>>>>>> mgrigorov@apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net>
>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 1)
>>>>>>>>>>>>>>> we've been twiddling with read-only models for some time now,
>>>>>>>>>>>>>>>> and
>>>>>>>>>>>>>>>> IIRC it
>>>>>>>>>>>>>>>> never quite worked out.
>>>>>>>>>>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed
>>>>>>>>>>>>>>>> now -
>>>>>>>>>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> How about adding another default to IModel:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>           default void setObject(final T object) {
>>>>>>>>>>>>>>>>               throw new UnsupportedOperationException();
>>>>>>>>>>>>>>>>           }
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>>>>>>>>>> AROM#setObject()
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> is
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> final, so subclasses are effectively read only too.
>>>>>>>>>>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>>>>>>>>>>> But I guess it will always be used as an anonymous inner
>>>>>>>>>>>>>>> class,
>>>>>>>>>>>>>>> as
>>>>>>>>>>>>>>> AROM is
>>>>>>>>>>>>>>> used now. If someone wants to have children then (s)he will
>>>>>>>>>>>>>>> have to
>>>>>>>>>>>>>>> create
>>>>>>>>>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>>>>>>>>>> Let's do it!
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>>>>>>>> things
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> like:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>>>>          @Override
>>>>>>>>>>>>>>          public void onClick()
>>>>>>>>>>>>>>          {
>>>>>>>>>>>>>>             // ...
>>>>>>>>>>>>>>          }
>>>>>>>>>>>>>> };
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 2)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I don't see a need for this.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Have fun
>>>>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> how about adding a
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>>>>>>>>> At the moment there are AbstractReadOnlyModel and
>>>>>>>>>>>>>>>>> SupplierModel
>>>>>>>>>>>>>>>>> (extends
>>>>>>>>>>>>>>>>> from AROM).
>>>>>>>>>>>>>>>>> Initially while MM suggested IROM I thought it will be a
>>>>>>>>>>>>>>>>> parent
>>>>>>>>>>>>>>>>> interface
>>>>>>>>>>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>>>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> 2) stream based iteration of container's children by Andrea
>>>>>>>>>>>>>>>>> Del
>>>>>>>>>>>>>>>>> Bene
>>>>>>>>>>>>>>>>> I have said my opinion before - the visitor approach is
>>>>>>>>>>>>>>>>> faster
>>>>>>>>>>>>>>>>> than
>>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>>> stream based one.
>>>>>>>>>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator
>>>>>>>>>>>>>>>>> and
>>>>>>>>>>>>>>>>> its
>>>>>>>>>>>>>>>>> related
>>>>>>>>>>>>>>>>> classes because it fails with StackoverflowError when used
>>>>>>>>>>>>>>>>> in
>>>>>>>>>>>>>>>>> a
>>>>>>>>>>>>>>>>> page
>>>>>>>>>>>>>>>>> with
>>>>>>>>>>>>>>>>> bigger component tree.
>>>>>>>>>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Your option on them ?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>


Re: More lambdas

Posted by Sebastien <se...@gmail.com>.
Could a read-only model just be like that?
IModel<String> personNameModel = LambdaModel.of(person::getName);

On Tue, Mar 15, 2016 at 10:43 AM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> I found a nice additional usage for LambdaModel. With static factory
> methods you can use it in two ways now:
>
>         IModel<String> personNameModel = LambdaModel.of(person::getName,
> person::setName);
>
> ... or if you have a model ...
>
>         IModel<String> personNameModel = LambdaModel.of(personModel,
> Person::getName, Person::setName);
>
> Let me know if you'd rather have a separate class for this.
>
> Have fun
> Sven
>
>
>
> On 14.03.2016 22:53, Martin Grigorov wrote:
>
>> I've checked all other IModel implementations but I didn't see more
>> candidates for lambd-ification.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Mon, Mar 14, 2016 at 4:15 PM, Martin Grigorov <mg...@apache.org>
>> wrote:
>>
>> I've merged that branch.
>>> Now the Lambdas class with the factory methods for components and
>>> behaviors is also in master.
>>> Any ideas for improvements are welcome!
>>>
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>>
>>> On Mon, Mar 14, 2016 at 4:01 PM, Sven Meier <sv...@meiers.net> wrote:
>>>
>>> I didn't want to put every idea directly in master.
>>>>>
>>>> Thanks to this procedure we've progressed a lot with lambdas :).
>>>>
>>>> Thanks
>>>> Sven
>>>>
>>>>
>>>>
>>>> On 14.03.2016 15:49, Martin Grigorov wrote:
>>>>
>>>> I didn't want to put every idea directly in master.
>>>>> First wanted to here opinions.
>>>>> But I see how this makes it hard to follow.
>>>>> I'll merge this branch to master and then we can just rework whatever
>>>>> we
>>>>> find not optimal directly there.
>>>>>
>>>>> Martin Grigorov
>>>>> Wicket Training and Consulting
>>>>> https://twitter.com/mtgrigorov
>>>>>
>>>>> On Mon, Mar 14, 2016 at 3:16 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>
>>>>> Hm, I starting to lose track of what is on which branch :/.
>>>>>
>>>>>> Sven
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 14.03.2016 14:09, Martin Grigorov wrote:
>>>>>>
>>>>>> Hi Sven
>>>>>>
>>>>>>>
>>>>>>> On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>>>
>>>>>>> Hi Martin,
>>>>>>>
>>>>>>> speaking of someting to nuke - insteaf of:
>>>>>>>>
>>>>>>>>            IModel<String> personNameModel = new
>>>>>>>> SupplierCachingModel<>(person::getName);
>>>>>>>>
>>>>>>>> Why not simply?
>>>>>>>>
>>>>>>>>            IModel<String> personNameModel =
>>>>>>>> Model.loadableDetachable(person::getName);
>>>>>>>>
>>>>>>>> I didn't like the name "Supplier*Caching*Model" anyway.
>>>>>>>>
>>>>>>>> It is there already
>>>>>>>>
>>>>>>>>
>>>>>>> https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208
>>>>>>>
>>>>>>> But I agree there is no need of SupplierCachingModel as a separate
>>>>>>> class.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Sven
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 14.03.2016 12:36, Martin Grigorov wrote:
>>>>>>>>
>>>>>>>> Yes!
>>>>>>>>
>>>>>>>> -               IModel<String> personNameModel = new
>>>>>>>>> SupplierModel<>(person::getName);
>>>>>>>>> +               IModel<String> personNameModel = person::getName;
>>>>>>>>>
>>>>>>>>> Definitely makes sense to make it shorter!
>>>>>>>>>
>>>>>>>>> I'll nuke it now!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Martin Grigorov
>>>>>>>>> Wicket Training and Consulting
>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>
>>>>>>>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> IModel being a functional interface now, what's the use of
>>>>>>>>>
>>>>>>>>>> SupplierModel
>>>>>>>>>> ?
>>>>>>>>>> IMHO we can get rid of it.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> Sven
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>>>>>>>>
>>>>>>>>>> Yep - I am very happy about it, too - cool features for wicket 8
>>>>>>>>>> :-)
>>>>>>>>>>
>>>>>>>>>> Great work all!
>>>>>>>>>>
>>>>>>>>>>> kind regards
>>>>>>>>>>>
>>>>>>>>>>> Tobias
>>>>>>>>>>>
>>>>>>>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>>>>>>>>
>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>>>> things
>>>>>>>>>>>
>>>>>>>>>>> like:
>>>>>>>>>>>
>>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>>>       @Override
>>>>>>>>>>>>>       public void onClick()
>>>>>>>>>>>>>       {
>>>>>>>>>>>>>          // ...
>>>>>>>>>>>>>       }
>>>>>>>>>>>>> };
>>>>>>>>>>>>>
>>>>>>>>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>
>>>>>>>>>>>> Sven
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>>>>>>>>
>>>>>>>>>>>> mgrigorov@apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>
>>>>>>>>>>>>> 1)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> we've been twiddling with read-only models for some time now,
>>>>>>>>>>>>>>> and
>>>>>>>>>>>>>>> IIRC it
>>>>>>>>>>>>>>> never quite worked out.
>>>>>>>>>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed
>>>>>>>>>>>>>>> now -
>>>>>>>>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> How about adding another default to IModel:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>          default void setObject(final T object) {
>>>>>>>>>>>>>>>              throw new UnsupportedOperationException();
>>>>>>>>>>>>>>>          }
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>>>>>>>>> AROM#setObject()
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> is
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> final, so subclasses are effectively read only too.
>>>>>>>>>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>>>>>>>>>> But I guess it will always be used as an anonymous inner
>>>>>>>>>>>>>> class,
>>>>>>>>>>>>>> as
>>>>>>>>>>>>>> AROM is
>>>>>>>>>>>>>> used now. If someone wants to have children then (s)he will
>>>>>>>>>>>>>> have to
>>>>>>>>>>>>>> create
>>>>>>>>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>>>>>>>>> Let's do it!
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>>>>>>> things
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> like:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>>>         @Override
>>>>>>>>>>>>>         public void onClick()
>>>>>>>>>>>>>         {
>>>>>>>>>>>>>            // ...
>>>>>>>>>>>>>         }
>>>>>>>>>>>>> };
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> 2)
>>>>>>>>>>>>>
>>>>>>>>>>>>> I don't see a need for this.
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Have fun
>>>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> how about adding a
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> At the moment there are AbstractReadOnlyModel and
>>>>>>>>>>>>>>>> SupplierModel
>>>>>>>>>>>>>>>> (extends
>>>>>>>>>>>>>>>> from AROM).
>>>>>>>>>>>>>>>> Initially while MM suggested IROM I thought it will be a
>>>>>>>>>>>>>>>> parent
>>>>>>>>>>>>>>>> interface
>>>>>>>>>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> 2) stream based iteration of container's children by Andrea
>>>>>>>>>>>>>>>> Del
>>>>>>>>>>>>>>>> Bene
>>>>>>>>>>>>>>>> I have said my opinion before - the visitor approach is
>>>>>>>>>>>>>>>> faster
>>>>>>>>>>>>>>>> than
>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>> stream based one.
>>>>>>>>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator
>>>>>>>>>>>>>>>> and
>>>>>>>>>>>>>>>> its
>>>>>>>>>>>>>>>> related
>>>>>>>>>>>>>>>> classes because it fails with StackoverflowError when used
>>>>>>>>>>>>>>>> in
>>>>>>>>>>>>>>>> a
>>>>>>>>>>>>>>>> page
>>>>>>>>>>>>>>>> with
>>>>>>>>>>>>>>>> bigger component tree.
>>>>>>>>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Your option on them ?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>

Re: More lambdas

Posted by Sven Meier <sv...@meiers.net>.
Hi,

I found a nice additional usage for LambdaModel. With static factory 
methods you can use it in two ways now:

         IModel<String> personNameModel = 
LambdaModel.of(person::getName, person::setName);

... or if you have a model ...

         IModel<String> personNameModel = LambdaModel.of(personModel, 
Person::getName, Person::setName);

Let me know if you'd rather have a separate class for this.

Have fun
Sven


On 14.03.2016 22:53, Martin Grigorov wrote:
> I've checked all other IModel implementations but I didn't see more
> candidates for lambd-ification.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Mar 14, 2016 at 4:15 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
>> I've merged that branch.
>> Now the Lambdas class with the factory methods for components and
>> behaviors is also in master.
>> Any ideas for improvements are welcome!
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Mon, Mar 14, 2016 at 4:01 PM, Sven Meier <sv...@meiers.net> wrote:
>>
>>>> I didn't want to put every idea directly in master.
>>> Thanks to this procedure we've progressed a lot with lambdas :).
>>>
>>> Thanks
>>> Sven
>>>
>>>
>>>
>>> On 14.03.2016 15:49, Martin Grigorov wrote:
>>>
>>>> I didn't want to put every idea directly in master.
>>>> First wanted to here opinions.
>>>> But I see how this makes it hard to follow.
>>>> I'll merge this branch to master and then we can just rework whatever we
>>>> find not optimal directly there.
>>>>
>>>> Martin Grigorov
>>>> Wicket Training and Consulting
>>>> https://twitter.com/mtgrigorov
>>>>
>>>> On Mon, Mar 14, 2016 at 3:16 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>
>>>> Hm, I starting to lose track of what is on which branch :/.
>>>>> Sven
>>>>>
>>>>>
>>>>>
>>>>> On 14.03.2016 14:09, Martin Grigorov wrote:
>>>>>
>>>>> Hi Sven
>>>>>>
>>>>>> On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>>
>>>>>> Hi Martin,
>>>>>>
>>>>>>> speaking of someting to nuke - insteaf of:
>>>>>>>
>>>>>>>            IModel<String> personNameModel = new
>>>>>>> SupplierCachingModel<>(person::getName);
>>>>>>>
>>>>>>> Why not simply?
>>>>>>>
>>>>>>>            IModel<String> personNameModel =
>>>>>>> Model.loadableDetachable(person::getName);
>>>>>>>
>>>>>>> I didn't like the name "Supplier*Caching*Model" anyway.
>>>>>>>
>>>>>>> It is there already
>>>>>>>
>>>>>> https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208
>>>>>>
>>>>>> But I agree there is no need of SupplierCachingModel as a separate
>>>>>> class.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>>> Sven
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 14.03.2016 12:36, Martin Grigorov wrote:
>>>>>>>
>>>>>>> Yes!
>>>>>>>
>>>>>>>> -               IModel<String> personNameModel = new
>>>>>>>> SupplierModel<>(person::getName);
>>>>>>>> +               IModel<String> personNameModel = person::getName;
>>>>>>>>
>>>>>>>> Definitely makes sense to make it shorter!
>>>>>>>>
>>>>>>>> I'll nuke it now!
>>>>>>>>
>>>>>>>>
>>>>>>>> Martin Grigorov
>>>>>>>> Wicket Training and Consulting
>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>
>>>>>>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> IModel being a functional interface now, what's the use of
>>>>>>>>> SupplierModel
>>>>>>>>> ?
>>>>>>>>> IMHO we can get rid of it.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> Sven
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>>>>>>>
>>>>>>>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>>>>>>>>
>>>>>>>>> Great work all!
>>>>>>>>>> kind regards
>>>>>>>>>>
>>>>>>>>>> Tobias
>>>>>>>>>>
>>>>>>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>>>>>>>
>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>>> things
>>>>>>>>>>
>>>>>>>>>> like:
>>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>>       @Override
>>>>>>>>>>>>       public void onClick()
>>>>>>>>>>>>       {
>>>>>>>>>>>>          // ...
>>>>>>>>>>>>       }
>>>>>>>>>>>> };
>>>>>>>>>>>>
>>>>>>>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks
>>>>>>>>>>> Sven
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>>>>>>>
>>>>>>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>>>>>>>
>>>>>>>>>>> mgrigorov@apache.org
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>>> 1)
>>>>>>>>>>>>>
>>>>>>>>>>>>>> we've been twiddling with read-only models for some time now,
>>>>>>>>>>>>>> and
>>>>>>>>>>>>>> IIRC it
>>>>>>>>>>>>>> never quite worked out.
>>>>>>>>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed
>>>>>>>>>>>>>> now -
>>>>>>>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> How about adding another default to IModel:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>          default void setObject(final T object) {
>>>>>>>>>>>>>>              throw new UnsupportedOperationException();
>>>>>>>>>>>>>>          }
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>>>>>>>> AROM#setObject()
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> is
>>>>>>>>>>>>>>
>>>>>>>>>>>>> final, so subclasses are effectively read only too.
>>>>>>>>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>>>>>>>>> But I guess it will always be used as an anonymous inner class,
>>>>>>>>>>>>> as
>>>>>>>>>>>>> AROM is
>>>>>>>>>>>>> used now. If someone wants to have children then (s)he will
>>>>>>>>>>>>> have to
>>>>>>>>>>>>> create
>>>>>>>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>>>>>>>> Let's do it!
>>>>>>>>>>>>>
>>>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>>>>>> things
>>>>>>>>>>>>>
>>>>>>>>>>>>> like:
>>>>>>>>>>>>>
>>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>>         @Override
>>>>>>>>>>>>         public void onClick()
>>>>>>>>>>>>         {
>>>>>>>>>>>>            // ...
>>>>>>>>>>>>         }
>>>>>>>>>>>> };
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> 2)
>>>>>>>>>>>>
>>>>>>>>>>>> I don't see a need for this.
>>>>>>>>>>>>>> Have fun
>>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> how about adding a
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> At the moment there are AbstractReadOnlyModel and
>>>>>>>>>>>>>>> SupplierModel
>>>>>>>>>>>>>>> (extends
>>>>>>>>>>>>>>> from AROM).
>>>>>>>>>>>>>>> Initially while MM suggested IROM I thought it will be a
>>>>>>>>>>>>>>> parent
>>>>>>>>>>>>>>> interface
>>>>>>>>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 2) stream based iteration of container's children by Andrea
>>>>>>>>>>>>>>> Del
>>>>>>>>>>>>>>> Bene
>>>>>>>>>>>>>>> I have said my opinion before - the visitor approach is faster
>>>>>>>>>>>>>>> than
>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>> stream based one.
>>>>>>>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and
>>>>>>>>>>>>>>> its
>>>>>>>>>>>>>>> related
>>>>>>>>>>>>>>> classes because it fails with StackoverflowError when used in
>>>>>>>>>>>>>>> a
>>>>>>>>>>>>>>> page
>>>>>>>>>>>>>>> with
>>>>>>>>>>>>>>> bigger component tree.
>>>>>>>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Your option on them ?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>


Re: More lambdas

Posted by Martin Grigorov <mg...@apache.org>.
I've checked all other IModel implementations but I didn't see more
candidates for lambd-ification.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Mar 14, 2016 at 4:15 PM, Martin Grigorov <mg...@apache.org>
wrote:

> I've merged that branch.
> Now the Lambdas class with the factory methods for components and
> behaviors is also in master.
> Any ideas for improvements are welcome!
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Mar 14, 2016 at 4:01 PM, Sven Meier <sv...@meiers.net> wrote:
>
>> > I didn't want to put every idea directly in master.
>>
>> Thanks to this procedure we've progressed a lot with lambdas :).
>>
>> Thanks
>> Sven
>>
>>
>>
>> On 14.03.2016 15:49, Martin Grigorov wrote:
>>
>>> I didn't want to put every idea directly in master.
>>> First wanted to here opinions.
>>> But I see how this makes it hard to follow.
>>> I'll merge this branch to master and then we can just rework whatever we
>>> find not optimal directly there.
>>>
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>>
>>> On Mon, Mar 14, 2016 at 3:16 PM, Sven Meier <sv...@meiers.net> wrote:
>>>
>>> Hm, I starting to lose track of what is on which branch :/.
>>>>
>>>> Sven
>>>>
>>>>
>>>>
>>>> On 14.03.2016 14:09, Martin Grigorov wrote:
>>>>
>>>> Hi Sven
>>>>>
>>>>>
>>>>> On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>
>>>>> Hi Martin,
>>>>>
>>>>>> speaking of someting to nuke - insteaf of:
>>>>>>
>>>>>>           IModel<String> personNameModel = new
>>>>>> SupplierCachingModel<>(person::getName);
>>>>>>
>>>>>> Why not simply?
>>>>>>
>>>>>>           IModel<String> personNameModel =
>>>>>> Model.loadableDetachable(person::getName);
>>>>>>
>>>>>> I didn't like the name "Supplier*Caching*Model" anyway.
>>>>>>
>>>>>> It is there already
>>>>>>
>>>>>
>>>>> https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208
>>>>>
>>>>> But I agree there is no need of SupplierCachingModel as a separate
>>>>> class.
>>>>>
>>>>>
>>>>>
>>>>> Regards
>>>>>
>>>>>> Sven
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 14.03.2016 12:36, Martin Grigorov wrote:
>>>>>>
>>>>>> Yes!
>>>>>>
>>>>>>> -               IModel<String> personNameModel = new
>>>>>>> SupplierModel<>(person::getName);
>>>>>>> +               IModel<String> personNameModel = person::getName;
>>>>>>>
>>>>>>> Definitely makes sense to make it shorter!
>>>>>>>
>>>>>>> I'll nuke it now!
>>>>>>>
>>>>>>>
>>>>>>> Martin Grigorov
>>>>>>> Wicket Training and Consulting
>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>
>>>>>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net>
>>>>>>> wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> IModel being a functional interface now, what's the use of
>>>>>>>> SupplierModel
>>>>>>>> ?
>>>>>>>> IMHO we can get rid of it.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Sven
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>>>>>>
>>>>>>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>>>>>>>
>>>>>>>> Great work all!
>>>>>>>>>
>>>>>>>>> kind regards
>>>>>>>>>
>>>>>>>>> Tobias
>>>>>>>>>
>>>>>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>>>>>>
>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>> things
>>>>>>>>>
>>>>>>>>> like:
>>>>>>>>>>
>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>      @Override
>>>>>>>>>>>      public void onClick()
>>>>>>>>>>>      {
>>>>>>>>>>>         // ...
>>>>>>>>>>>      }
>>>>>>>>>>> };
>>>>>>>>>>>
>>>>>>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>>>>>>>
>>>>>>>>>>> Thanks
>>>>>>>>>> Sven
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>>>>>>
>>>>>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>>>>>>
>>>>>>>>>> mgrigorov@apache.org
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>>> 1)
>>>>>>>>>>>>
>>>>>>>>>>>>> we've been twiddling with read-only models for some time now,
>>>>>>>>>>>>> and
>>>>>>>>>>>>> IIRC it
>>>>>>>>>>>>> never quite worked out.
>>>>>>>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed
>>>>>>>>>>>>> now -
>>>>>>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>>>>>>
>>>>>>>>>>>>> How about adding another default to IModel:
>>>>>>>>>>>>>
>>>>>>>>>>>>>         default void setObject(final T object) {
>>>>>>>>>>>>>             throw new UnsupportedOperationException();
>>>>>>>>>>>>>         }
>>>>>>>>>>>>>
>>>>>>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>>>>>>
>>>>>>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>>>>>>> AROM#setObject()
>>>>>>>>>>>>>
>>>>>>>>>>>>> is
>>>>>>>>>>>>>
>>>>>>>>>>>> final, so subclasses are effectively read only too.
>>>>>>>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>>>>>>>> But I guess it will always be used as an anonymous inner class,
>>>>>>>>>>>> as
>>>>>>>>>>>> AROM is
>>>>>>>>>>>> used now. If someone wants to have children then (s)he will
>>>>>>>>>>>> have to
>>>>>>>>>>>> create
>>>>>>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>>>>>>> Let's do it!
>>>>>>>>>>>>
>>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>>>>> things
>>>>>>>>>>>>
>>>>>>>>>>>> like:
>>>>>>>>>>>>
>>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>>        @Override
>>>>>>>>>>>        public void onClick()
>>>>>>>>>>>        {
>>>>>>>>>>>           // ...
>>>>>>>>>>>        }
>>>>>>>>>>> };
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> 2)
>>>>>>>>>>>
>>>>>>>>>>> I don't see a need for this.
>>>>>>>>>>>>
>>>>>>>>>>>>> Have fun
>>>>>>>>>>>>> Sven
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> how about adding a
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>
>>>>>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> At the moment there are AbstractReadOnlyModel and
>>>>>>>>>>>>>> SupplierModel
>>>>>>>>>>>>>> (extends
>>>>>>>>>>>>>> from AROM).
>>>>>>>>>>>>>> Initially while MM suggested IROM I thought it will be a
>>>>>>>>>>>>>> parent
>>>>>>>>>>>>>> interface
>>>>>>>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 2) stream based iteration of container's children by Andrea
>>>>>>>>>>>>>> Del
>>>>>>>>>>>>>> Bene
>>>>>>>>>>>>>> I have said my opinion before - the visitor approach is faster
>>>>>>>>>>>>>> than
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>> stream based one.
>>>>>>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and
>>>>>>>>>>>>>> its
>>>>>>>>>>>>>> related
>>>>>>>>>>>>>> classes because it fails with StackoverflowError when used in
>>>>>>>>>>>>>> a
>>>>>>>>>>>>>> page
>>>>>>>>>>>>>> with
>>>>>>>>>>>>>> bigger component tree.
>>>>>>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Your option on them ?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>
>

Re: More lambdas

Posted by Martin Grigorov <mg...@apache.org>.
I've merged that branch.
Now the Lambdas class with the factory methods for components and behaviors
is also in master.
Any ideas for improvements are welcome!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Mar 14, 2016 at 4:01 PM, Sven Meier <sv...@meiers.net> wrote:

> > I didn't want to put every idea directly in master.
>
> Thanks to this procedure we've progressed a lot with lambdas :).
>
> Thanks
> Sven
>
>
>
> On 14.03.2016 15:49, Martin Grigorov wrote:
>
>> I didn't want to put every idea directly in master.
>> First wanted to here opinions.
>> But I see how this makes it hard to follow.
>> I'll merge this branch to master and then we can just rework whatever we
>> find not optimal directly there.
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Mon, Mar 14, 2016 at 3:16 PM, Sven Meier <sv...@meiers.net> wrote:
>>
>> Hm, I starting to lose track of what is on which branch :/.
>>>
>>> Sven
>>>
>>>
>>>
>>> On 14.03.2016 14:09, Martin Grigorov wrote:
>>>
>>> Hi Sven
>>>>
>>>>
>>>> On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>
>>>> Hi Martin,
>>>>
>>>>> speaking of someting to nuke - insteaf of:
>>>>>
>>>>>           IModel<String> personNameModel = new
>>>>> SupplierCachingModel<>(person::getName);
>>>>>
>>>>> Why not simply?
>>>>>
>>>>>           IModel<String> personNameModel =
>>>>> Model.loadableDetachable(person::getName);
>>>>>
>>>>> I didn't like the name "Supplier*Caching*Model" anyway.
>>>>>
>>>>> It is there already
>>>>>
>>>>
>>>> https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208
>>>>
>>>> But I agree there is no need of SupplierCachingModel as a separate
>>>> class.
>>>>
>>>>
>>>>
>>>> Regards
>>>>
>>>>> Sven
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 14.03.2016 12:36, Martin Grigorov wrote:
>>>>>
>>>>> Yes!
>>>>>
>>>>>> -               IModel<String> personNameModel = new
>>>>>> SupplierModel<>(person::getName);
>>>>>> +               IModel<String> personNameModel = person::getName;
>>>>>>
>>>>>> Definitely makes sense to make it shorter!
>>>>>>
>>>>>> I'll nuke it now!
>>>>>>
>>>>>>
>>>>>> Martin Grigorov
>>>>>> Wicket Training and Consulting
>>>>>> https://twitter.com/mtgrigorov
>>>>>>
>>>>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> IModel being a functional interface now, what's the use of
>>>>>>> SupplierModel
>>>>>>> ?
>>>>>>> IMHO we can get rid of it.
>>>>>>>
>>>>>>> Regards
>>>>>>> Sven
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>>>>>
>>>>>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>>>>>>
>>>>>>> Great work all!
>>>>>>>>
>>>>>>>> kind regards
>>>>>>>>
>>>>>>>> Tobias
>>>>>>>>
>>>>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>>>>>
>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>> things
>>>>>>>>
>>>>>>>> like:
>>>>>>>>>
>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>      @Override
>>>>>>>>>>      public void onClick()
>>>>>>>>>>      {
>>>>>>>>>>         // ...
>>>>>>>>>>      }
>>>>>>>>>> };
>>>>>>>>>>
>>>>>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>>>>>>
>>>>>>>>>> Thanks
>>>>>>>>> Sven
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>>>>>
>>>>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>>>>>
>>>>>>>>> mgrigorov@apache.org
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>>> 1)
>>>>>>>>>>>
>>>>>>>>>>>> we've been twiddling with read-only models for some time now,
>>>>>>>>>>>> and
>>>>>>>>>>>> IIRC it
>>>>>>>>>>>> never quite worked out.
>>>>>>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed
>>>>>>>>>>>> now -
>>>>>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>>>>>
>>>>>>>>>>>> How about adding another default to IModel:
>>>>>>>>>>>>
>>>>>>>>>>>>         default void setObject(final T object) {
>>>>>>>>>>>>             throw new UnsupportedOperationException();
>>>>>>>>>>>>         }
>>>>>>>>>>>>
>>>>>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>>>>>
>>>>>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>>>>>> AROM#setObject()
>>>>>>>>>>>>
>>>>>>>>>>>> is
>>>>>>>>>>>>
>>>>>>>>>>> final, so subclasses are effectively read only too.
>>>>>>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>>>>>>> But I guess it will always be used as an anonymous inner class,
>>>>>>>>>>> as
>>>>>>>>>>> AROM is
>>>>>>>>>>> used now. If someone wants to have children then (s)he will have
>>>>>>>>>>> to
>>>>>>>>>>> create
>>>>>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>>>>>> Let's do it!
>>>>>>>>>>>
>>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>>>> things
>>>>>>>>>>>
>>>>>>>>>>> like:
>>>>>>>>>>>
>>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>>        @Override
>>>>>>>>>>        public void onClick()
>>>>>>>>>>        {
>>>>>>>>>>           // ...
>>>>>>>>>>        }
>>>>>>>>>> };
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 2)
>>>>>>>>>>
>>>>>>>>>> I don't see a need for this.
>>>>>>>>>>>
>>>>>>>>>>>> Have fun
>>>>>>>>>>>> Sven
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> how about adding a
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>>>>
>>>>>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>>>>>
>>>>>>>>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel
>>>>>>>>>>>>> (extends
>>>>>>>>>>>>> from AROM).
>>>>>>>>>>>>> Initially while MM suggested IROM I thought it will be a parent
>>>>>>>>>>>>> interface
>>>>>>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>>>>>
>>>>>>>>>>>>> 2) stream based iteration of container's children by Andrea Del
>>>>>>>>>>>>> Bene
>>>>>>>>>>>>> I have said my opinion before - the visitor approach is faster
>>>>>>>>>>>>> than
>>>>>>>>>>>>> the
>>>>>>>>>>>>> stream based one.
>>>>>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and
>>>>>>>>>>>>> its
>>>>>>>>>>>>> related
>>>>>>>>>>>>> classes because it fails with StackoverflowError when used in a
>>>>>>>>>>>>> page
>>>>>>>>>>>>> with
>>>>>>>>>>>>> bigger component tree.
>>>>>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Your option on them ?
>>>>>>>>>>>>>
>>>>>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>>>>>
>>>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>

Re: More lambdas

Posted by Sven Meier <sv...@meiers.net>.
 > I didn't want to put every idea directly in master.

Thanks to this procedure we've progressed a lot with lambdas :).

Thanks
Sven


On 14.03.2016 15:49, Martin Grigorov wrote:
> I didn't want to put every idea directly in master.
> First wanted to here opinions.
> But I see how this makes it hard to follow.
> I'll merge this branch to master and then we can just rework whatever we
> find not optimal directly there.
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Mar 14, 2016 at 3:16 PM, Sven Meier <sv...@meiers.net> wrote:
>
>> Hm, I starting to lose track of what is on which branch :/.
>>
>> Sven
>>
>>
>>
>> On 14.03.2016 14:09, Martin Grigorov wrote:
>>
>>> Hi Sven
>>>
>>>
>>> On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net> wrote:
>>>
>>> Hi Martin,
>>>> speaking of someting to nuke - insteaf of:
>>>>
>>>>           IModel<String> personNameModel = new
>>>> SupplierCachingModel<>(person::getName);
>>>>
>>>> Why not simply?
>>>>
>>>>           IModel<String> personNameModel =
>>>> Model.loadableDetachable(person::getName);
>>>>
>>>> I didn't like the name "Supplier*Caching*Model" anyway.
>>>>
>>>> It is there already
>>> https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208
>>>
>>> But I agree there is no need of SupplierCachingModel as a separate class.
>>>
>>>
>>>
>>> Regards
>>>> Sven
>>>>
>>>>
>>>>
>>>>
>>>> On 14.03.2016 12:36, Martin Grigorov wrote:
>>>>
>>>> Yes!
>>>>> -               IModel<String> personNameModel = new
>>>>> SupplierModel<>(person::getName);
>>>>> +               IModel<String> personNameModel = person::getName;
>>>>>
>>>>> Definitely makes sense to make it shorter!
>>>>>
>>>>> I'll nuke it now!
>>>>>
>>>>>
>>>>> Martin Grigorov
>>>>> Wicket Training and Consulting
>>>>> https://twitter.com/mtgrigorov
>>>>>
>>>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>> IModel being a functional interface now, what's the use of
>>>>>> SupplierModel
>>>>>> ?
>>>>>> IMHO we can get rid of it.
>>>>>>
>>>>>> Regards
>>>>>> Sven
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>>>>
>>>>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>>>>>
>>>>>>> Great work all!
>>>>>>>
>>>>>>> kind regards
>>>>>>>
>>>>>>> Tobias
>>>>>>>
>>>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>>>>
>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>>>>
>>>>>>>> like:
>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>      @Override
>>>>>>>>>      public void onClick()
>>>>>>>>>      {
>>>>>>>>>         // ...
>>>>>>>>>      }
>>>>>>>>> };
>>>>>>>>>
>>>>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> Sven
>>>>>>>>
>>>>>>>>
>>>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>>>>
>>>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>>>>
>>>>>>>>> mgrigorov@apache.org
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>> 1)
>>>>>>>>>>> we've been twiddling with read-only models for some time now, and
>>>>>>>>>>> IIRC it
>>>>>>>>>>> never quite worked out.
>>>>>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>>>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>>>>
>>>>>>>>>>> How about adding another default to IModel:
>>>>>>>>>>>
>>>>>>>>>>>         default void setObject(final T object) {
>>>>>>>>>>>             throw new UnsupportedOperationException();
>>>>>>>>>>>         }
>>>>>>>>>>>
>>>>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>>>>
>>>>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>>>>> AROM#setObject()
>>>>>>>>>>>
>>>>>>>>>>> is
>>>>>>>>>> final, so subclasses are effectively read only too.
>>>>>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>>>>>> But I guess it will always be used as an anonymous inner class, as
>>>>>>>>>> AROM is
>>>>>>>>>> used now. If someone wants to have children then (s)he will have to
>>>>>>>>>> create
>>>>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>>>>> Let's do it!
>>>>>>>>>>
>>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>>> things
>>>>>>>>>>
>>>>>>>>>> like:
>>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>>        @Override
>>>>>>>>>        public void onClick()
>>>>>>>>>        {
>>>>>>>>>           // ...
>>>>>>>>>        }
>>>>>>>>> };
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 2)
>>>>>>>>>
>>>>>>>>>> I don't see a need for this.
>>>>>>>>>>> Have fun
>>>>>>>>>>> Sven
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> how about adding a
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>>>>
>>>>>>>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel
>>>>>>>>>>>> (extends
>>>>>>>>>>>> from AROM).
>>>>>>>>>>>> Initially while MM suggested IROM I thought it will be a parent
>>>>>>>>>>>> interface
>>>>>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>>>>
>>>>>>>>>>>> 2) stream based iteration of container's children by Andrea Del
>>>>>>>>>>>> Bene
>>>>>>>>>>>> I have said my opinion before - the visitor approach is faster
>>>>>>>>>>>> than
>>>>>>>>>>>> the
>>>>>>>>>>>> stream based one.
>>>>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its
>>>>>>>>>>>> related
>>>>>>>>>>>> classes because it fails with StackoverflowError when used in a
>>>>>>>>>>>> page
>>>>>>>>>>>> with
>>>>>>>>>>>> bigger component tree.
>>>>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>>>>
>>>>>>>>>>>> Your option on them ?
>>>>>>>>>>>>
>>>>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>>>>
>>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>


Re: More lambdas

Posted by Martin Grigorov <mg...@apache.org>.
I didn't want to put every idea directly in master.
First wanted to here opinions.
But I see how this makes it hard to follow.
I'll merge this branch to master and then we can just rework whatever we
find not optimal directly there.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Mar 14, 2016 at 3:16 PM, Sven Meier <sv...@meiers.net> wrote:

> Hm, I starting to lose track of what is on which branch :/.
>
> Sven
>
>
>
> On 14.03.2016 14:09, Martin Grigorov wrote:
>
>> Hi Sven
>>
>>
>> On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net> wrote:
>>
>> Hi Martin,
>>>
>>> speaking of someting to nuke - insteaf of:
>>>
>>>          IModel<String> personNameModel = new
>>> SupplierCachingModel<>(person::getName);
>>>
>>> Why not simply?
>>>
>>>          IModel<String> personNameModel =
>>> Model.loadableDetachable(person::getName);
>>>
>>> I didn't like the name "Supplier*Caching*Model" anyway.
>>>
>>> It is there already
>>
>> https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208
>>
>> But I agree there is no need of SupplierCachingModel as a separate class.
>>
>>
>>
>> Regards
>>> Sven
>>>
>>>
>>>
>>>
>>> On 14.03.2016 12:36, Martin Grigorov wrote:
>>>
>>> Yes!
>>>>
>>>> -               IModel<String> personNameModel = new
>>>> SupplierModel<>(person::getName);
>>>> +               IModel<String> personNameModel = person::getName;
>>>>
>>>> Definitely makes sense to make it shorter!
>>>>
>>>> I'll nuke it now!
>>>>
>>>>
>>>> Martin Grigorov
>>>> Wicket Training and Consulting
>>>> https://twitter.com/mtgrigorov
>>>>
>>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net> wrote:
>>>>
>>>> Hi,
>>>>
>>>>> IModel being a functional interface now, what's the use of
>>>>> SupplierModel
>>>>> ?
>>>>> IMHO we can get rid of it.
>>>>>
>>>>> Regards
>>>>> Sven
>>>>>
>>>>>
>>>>>
>>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>>>
>>>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>>>>
>>>>>> Great work all!
>>>>>>
>>>>>> kind regards
>>>>>>
>>>>>> Tobias
>>>>>>
>>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>>>
>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>>>
>>>>>>> like:
>>>>>>>>
>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>     @Override
>>>>>>>>     public void onClick()
>>>>>>>>     {
>>>>>>>>        // ...
>>>>>>>>     }
>>>>>>>> };
>>>>>>>>
>>>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>>>>
>>>>>>> Thanks
>>>>>>> Sven
>>>>>>>
>>>>>>>
>>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>>>
>>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>>>
>>>>>>>> mgrigorov@apache.org
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> 1)
>>>>>>>>>> we've been twiddling with read-only models for some time now, and
>>>>>>>>>> IIRC it
>>>>>>>>>> never quite worked out.
>>>>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>>>
>>>>>>>>>> How about adding another default to IModel:
>>>>>>>>>>
>>>>>>>>>>        default void setObject(final T object) {
>>>>>>>>>>            throw new UnsupportedOperationException();
>>>>>>>>>>        }
>>>>>>>>>>
>>>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>>>
>>>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>>>> AROM#setObject()
>>>>>>>>>>
>>>>>>>>>> is
>>>>>>>>> final, so subclasses are effectively read only too.
>>>>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>>>>> But I guess it will always be used as an anonymous inner class, as
>>>>>>>>> AROM is
>>>>>>>>> used now. If someone wants to have children then (s)he will have to
>>>>>>>>> create
>>>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>>>> Let's do it!
>>>>>>>>>
>>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do
>>>>>>>>> things
>>>>>>>>>
>>>>>>>>> like:
>>>>>>>>
>>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>>       @Override
>>>>>>>>       public void onClick()
>>>>>>>>       {
>>>>>>>>          // ...
>>>>>>>>       }
>>>>>>>> };
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> 2)
>>>>>>>>
>>>>>>>>> I don't see a need for this.
>>>>>>>>>>
>>>>>>>>>> Have fun
>>>>>>>>>> Sven
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> how about adding a
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>>>
>>>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>>>
>>>>>>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel
>>>>>>>>>>> (extends
>>>>>>>>>>> from AROM).
>>>>>>>>>>> Initially while MM suggested IROM I thought it will be a parent
>>>>>>>>>>> interface
>>>>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>>>
>>>>>>>>>>> 2) stream based iteration of container's children by Andrea Del
>>>>>>>>>>> Bene
>>>>>>>>>>> I have said my opinion before - the visitor approach is faster
>>>>>>>>>>> than
>>>>>>>>>>> the
>>>>>>>>>>> stream based one.
>>>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its
>>>>>>>>>>> related
>>>>>>>>>>> classes because it fails with StackoverflowError when used in a
>>>>>>>>>>> page
>>>>>>>>>>> with
>>>>>>>>>>> bigger component tree.
>>>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>>>
>>>>>>>>>>> Your option on them ?
>>>>>>>>>>>
>>>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>>>
>>>>>>>>>>> Martin Grigorov
>>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>

Re: More lambdas

Posted by Sven Meier <sv...@meiers.net>.
Hm, I starting to lose track of what is on which branch :/.

Sven


On 14.03.2016 14:09, Martin Grigorov wrote:
> Hi Sven
>
>
> On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net> wrote:
>
>> Hi Martin,
>>
>> speaking of someting to nuke - insteaf of:
>>
>>          IModel<String> personNameModel = new
>> SupplierCachingModel<>(person::getName);
>>
>> Why not simply?
>>
>>          IModel<String> personNameModel =
>> Model.loadableDetachable(person::getName);
>>
>> I didn't like the name "Supplier*Caching*Model" anyway.
>>
> It is there already
> https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208
>
> But I agree there is no need of SupplierCachingModel as a separate class.
>
>
>
>> Regards
>> Sven
>>
>>
>>
>>
>> On 14.03.2016 12:36, Martin Grigorov wrote:
>>
>>> Yes!
>>>
>>> -               IModel<String> personNameModel = new
>>> SupplierModel<>(person::getName);
>>> +               IModel<String> personNameModel = person::getName;
>>>
>>> Definitely makes sense to make it shorter!
>>>
>>> I'll nuke it now!
>>>
>>>
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>>
>>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net> wrote:
>>>
>>> Hi,
>>>> IModel being a functional interface now, what's the use of SupplierModel
>>>> ?
>>>> IMHO we can get rid of it.
>>>>
>>>> Regards
>>>> Sven
>>>>
>>>>
>>>>
>>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>>
>>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>>>> Great work all!
>>>>>
>>>>> kind regards
>>>>>
>>>>> Tobias
>>>>>
>>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>>
>>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>>>> like:
>>>>>>>
>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>     @Override
>>>>>>>     public void onClick()
>>>>>>>     {
>>>>>>>        // ...
>>>>>>>     }
>>>>>>> };
>>>>>>>
>>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>> Thanks
>>>>>> Sven
>>>>>>
>>>>>>
>>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>>
>>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>>> mgrigorov@apache.org
>>>>>>> wrote:
>>>>>>>
>>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>>> 1)
>>>>>>>>> we've been twiddling with read-only models for some time now, and
>>>>>>>>> IIRC it
>>>>>>>>> never quite worked out.
>>>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>>
>>>>>>>>> How about adding another default to IModel:
>>>>>>>>>
>>>>>>>>>        default void setObject(final T object) {
>>>>>>>>>            throw new UnsupportedOperationException();
>>>>>>>>>        }
>>>>>>>>>
>>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>>
>>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>>> AROM#setObject()
>>>>>>>>>
>>>>>>>> is
>>>>>>>> final, so subclasses are effectively read only too.
>>>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>>>> But I guess it will always be used as an anonymous inner class, as
>>>>>>>> AROM is
>>>>>>>> used now. If someone wants to have children then (s)he will have to
>>>>>>>> create
>>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>>> Let's do it!
>>>>>>>>
>>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>>>>>
>>>>>>> like:
>>>>>>>
>>>>>>> new Link<String>("", () -> "abc") {
>>>>>>>       @Override
>>>>>>>       public void onClick()
>>>>>>>       {
>>>>>>>          // ...
>>>>>>>       }
>>>>>>> };
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2)
>>>>>>>>> I don't see a need for this.
>>>>>>>>>
>>>>>>>>> Have fun
>>>>>>>>> Sven
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> how about adding a
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>>
>>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>>
>>>>>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel
>>>>>>>>>> (extends
>>>>>>>>>> from AROM).
>>>>>>>>>> Initially while MM suggested IROM I thought it will be a parent
>>>>>>>>>> interface
>>>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>>
>>>>>>>>>> 2) stream based iteration of container's children by Andrea Del
>>>>>>>>>> Bene
>>>>>>>>>> I have said my opinion before - the visitor approach is faster than
>>>>>>>>>> the
>>>>>>>>>> stream based one.
>>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its
>>>>>>>>>> related
>>>>>>>>>> classes because it fails with StackoverflowError when used in a
>>>>>>>>>> page
>>>>>>>>>> with
>>>>>>>>>> bigger component tree.
>>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>>
>>>>>>>>>> Your option on them ?
>>>>>>>>>>
>>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>>
>>>>>>>>>> Martin Grigorov
>>>>>>>>>> Wicket Training and Consulting
>>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>


Re: More lambdas

Posted by Martin Grigorov <mg...@apache.org>.
Hi Sven


On Mon, Mar 14, 2016 at 1:23 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi Martin,
>
> speaking of someting to nuke - insteaf of:
>
>         IModel<String> personNameModel = new
> SupplierCachingModel<>(person::getName);
>
> Why not simply?
>
>         IModel<String> personNameModel =
> Model.loadableDetachable(person::getName);
>
> I didn't like the name "Supplier*Caching*Model" anyway.
>

It is there already
https://github.com/apache/wicket/blob/static-factories-for-lambdas/wicket-core/src/main/java/org/apache/wicket/model/Model.java#L208

But I agree there is no need of SupplierCachingModel as a separate class.



>
> Regards
> Sven
>
>
>
>
> On 14.03.2016 12:36, Martin Grigorov wrote:
>
>> Yes!
>>
>> -               IModel<String> personNameModel = new
>> SupplierModel<>(person::getName);
>> +               IModel<String> personNameModel = person::getName;
>>
>> Definitely makes sense to make it shorter!
>>
>> I'll nuke it now!
>>
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net> wrote:
>>
>> Hi,
>>>
>>> IModel being a functional interface now, what's the use of SupplierModel
>>> ?
>>> IMHO we can get rid of it.
>>>
>>> Regards
>>> Sven
>>>
>>>
>>>
>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>>
>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>>>
>>>> Great work all!
>>>>
>>>> kind regards
>>>>
>>>> Tobias
>>>>
>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>>
>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>>
>>>>>> like:
>>>>>>
>>>>>> new Link<String>("", () -> "abc") {
>>>>>>    @Override
>>>>>>    public void onClick()
>>>>>>    {
>>>>>>       // ...
>>>>>>    }
>>>>>> };
>>>>>>
>>>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>>
>>>>> Thanks
>>>>> Sven
>>>>>
>>>>>
>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>>
>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <
>>>>>> mgrigorov@apache.org
>>>>>> wrote:
>>>>>>
>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>>> 1)
>>>>>>>> we've been twiddling with read-only models for some time now, and
>>>>>>>> IIRC it
>>>>>>>> never quite worked out.
>>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>>>>>>> perhaps I'm missing the point though.
>>>>>>>>
>>>>>>>> How about adding another default to IModel:
>>>>>>>>
>>>>>>>>       default void setObject(final T object) {
>>>>>>>>           throw new UnsupportedOperationException();
>>>>>>>>       }
>>>>>>>>
>>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>>
>>>>>>>> A minor thing that bothers me here is that currently
>>>>>>>> AROM#setObject()
>>>>>>>>
>>>>>>> is
>>>>>>> final, so subclasses are effectively read only too.
>>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>>> But I guess it will always be used as an anonymous inner class, as
>>>>>>> AROM is
>>>>>>> used now. If someone wants to have children then (s)he will have to
>>>>>>> create
>>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>>> Let's do it!
>>>>>>>
>>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>>>>
>>>>>> like:
>>>>>>
>>>>>> new Link<String>("", () -> "abc") {
>>>>>>      @Override
>>>>>>      public void onClick()
>>>>>>      {
>>>>>>         // ...
>>>>>>      }
>>>>>> };
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2)
>>>>>>>
>>>>>>>> I don't see a need for this.
>>>>>>>>
>>>>>>>> Have fun
>>>>>>>> Sven
>>>>>>>>
>>>>>>>>
>>>>>>>> how about adding a
>>>>>>>>
>>>>>>>>
>>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>>
>>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>>
>>>>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel
>>>>>>>>> (extends
>>>>>>>>> from AROM).
>>>>>>>>> Initially while MM suggested IROM I thought it will be a parent
>>>>>>>>> interface
>>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>>
>>>>>>>>> 2) stream based iteration of container's children by Andrea Del
>>>>>>>>> Bene
>>>>>>>>> I have said my opinion before - the visitor approach is faster than
>>>>>>>>> the
>>>>>>>>> stream based one.
>>>>>>>>> In addition we have to remove the deprecated
>>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its
>>>>>>>>> related
>>>>>>>>> classes because it fails with StackoverflowError when used in a
>>>>>>>>> page
>>>>>>>>> with
>>>>>>>>> bigger component tree.
>>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>>
>>>>>>>>> Your option on them ?
>>>>>>>>>
>>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>>
>>>>>>>>> Martin Grigorov
>>>>>>>>> Wicket Training and Consulting
>>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>

Re: More lambdas

Posted by Sven Meier <sv...@meiers.net>.
Hi Martin,

speaking of someting to nuke - insteaf of:

         IModel<String> personNameModel = new 
SupplierCachingModel<>(person::getName);

Why not simply?

         IModel<String> personNameModel = 
Model.loadableDetachable(person::getName);

I didn't like the name "Supplier*Caching*Model" anyway.

Regards
Sven



On 14.03.2016 12:36, Martin Grigorov wrote:
> Yes!
>
> -               IModel<String> personNameModel = new
> SupplierModel<>(person::getName);
> +               IModel<String> personNameModel = person::getName;
>
> Definitely makes sense to make it shorter!
>
> I'll nuke it now!
>
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net> wrote:
>
>> Hi,
>>
>> IModel being a functional interface now, what's the use of SupplierModel ?
>> IMHO we can get rid of it.
>>
>> Regards
>> Sven
>>
>>
>>
>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>
>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>>
>>> Great work all!
>>>
>>> kind regards
>>>
>>> Tobias
>>>
>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>
>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>> like:
>>>>>
>>>>> new Link<String>("", () -> "abc") {
>>>>>    @Override
>>>>>    public void onClick()
>>>>>    {
>>>>>       // ...
>>>>>    }
>>>>> };
>>>>>
>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>>
>>>> Thanks
>>>> Sven
>>>>
>>>>
>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>
>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <mgrigorov@apache.org
>>>>> wrote:
>>>>>
>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>> Hi,
>>>>>>> 1)
>>>>>>> we've been twiddling with read-only models for some time now, and
>>>>>>> IIRC it
>>>>>>> never quite worked out.
>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>>>>>> perhaps I'm missing the point though.
>>>>>>>
>>>>>>> How about adding another default to IModel:
>>>>>>>
>>>>>>>       default void setObject(final T object) {
>>>>>>>           throw new UnsupportedOperationException();
>>>>>>>       }
>>>>>>>
>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>>
>>>>>>> A minor thing that bothers me here is that currently AROM#setObject()
>>>>>> is
>>>>>> final, so subclasses are effectively read only too.
>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>> But I guess it will always be used as an anonymous inner class, as
>>>>>> AROM is
>>>>>> used now. If someone wants to have children then (s)he will have to
>>>>>> create
>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>> Let's do it!
>>>>>>
>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>> like:
>>>>>
>>>>> new Link<String>("", () -> "abc") {
>>>>>      @Override
>>>>>      public void onClick()
>>>>>      {
>>>>>         // ...
>>>>>      }
>>>>> };
>>>>>
>>>>>
>>>>>
>>>>>> 2)
>>>>>>> I don't see a need for this.
>>>>>>>
>>>>>>> Have fun
>>>>>>> Sven
>>>>>>>
>>>>>>>
>>>>>>> how about adding a
>>>>>>>
>>>>>>>
>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>>
>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>>
>>>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel
>>>>>>>> (extends
>>>>>>>> from AROM).
>>>>>>>> Initially while MM suggested IROM I thought it will be a parent
>>>>>>>> interface
>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>>
>>>>>>>> 2) stream based iteration of container's children by Andrea Del Bene
>>>>>>>> I have said my opinion before - the visitor approach is faster than
>>>>>>>> the
>>>>>>>> stream based one.
>>>>>>>> In addition we have to remove the deprecated
>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its
>>>>>>>> related
>>>>>>>> classes because it fails with StackoverflowError when used in a page
>>>>>>>> with
>>>>>>>> bigger component tree.
>>>>>>>> So I don't see a reason for this feature.
>>>>>>>>
>>>>>>>> Your option on them ?
>>>>>>>>
>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>>
>>>>>>>> Martin Grigorov
>>>>>>>> Wicket Training and Consulting
>>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>>
>>>>>>>>
>>>>>>>>


Re: More lambdas

Posted by Tobias Soloschenko <to...@googlemail.com>.
Looking forward to write my applications with a single character. ;-D

Looks really great @ model.

kind regards

Tobias

> Am 14.03.2016 um 12:36 schrieb Martin Grigorov <mg...@apache.org>:
> 
> Yes!
> 
> -               IModel<String> personNameModel = new
> SupplierModel<>(person::getName);
> +               IModel<String> personNameModel = person::getName;
> 
> Definitely makes sense to make it shorter!
> 
> I'll nuke it now!
> 
> 
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
> 
>> On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net> wrote:
>> 
>> Hi,
>> 
>> IModel being a functional interface now, what's the use of SupplierModel ?
>> IMHO we can get rid of it.
>> 
>> Regards
>> Sven
>> 
>> 
>> 
>>> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>>> 
>>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>> 
>>> Great work all!
>>> 
>>> kind regards
>>> 
>>> Tobias
>>> 
>>>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>>> 
>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>> like:
>>>>> 
>>>>> new Link<String>("", () -> "abc") {
>>>>>  @Override
>>>>>  public void onClick()
>>>>>  {
>>>>>     // ...
>>>>>  }
>>>>> };
>>>> 
>>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>> 
>>>> Thanks
>>>> Sven
>>>> 
>>>> 
>>>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>>> 
>>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <mgrigorov@apache.org
>>>>> wrote:
>>>>> 
>>>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>> 
>>>>>> Hi,
>>>>>>> 
>>>>>>> 1)
>>>>>>> we've been twiddling with read-only models for some time now, and
>>>>>>> IIRC it
>>>>>>> never quite worked out.
>>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>>>>>> perhaps I'm missing the point though.
>>>>>>> 
>>>>>>> How about adding another default to IModel:
>>>>>>> 
>>>>>>>     default void setObject(final T object) {
>>>>>>>         throw new UnsupportedOperationException();
>>>>>>>     }
>>>>>>> 
>>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>> 
>>>>>>> A minor thing that bothers me here is that currently AROM#setObject()
>>>>>> is
>>>>>> final, so subclasses are effectively read only too.
>>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>>> But I guess it will always be used as an anonymous inner class, as
>>>>>> AROM is
>>>>>> used now. If someone wants to have children then (s)he will have to
>>>>>> create
>>>>>> a custom class and there (s)he can make it 'final'.
>>>>>> Let's do it!
>>>>>> 
>>>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>>> like:
>>>>> 
>>>>> new Link<String>("", () -> "abc") {
>>>>>    @Override
>>>>>    public void onClick()
>>>>>    {
>>>>>       // ...
>>>>>    }
>>>>> };
>>>>> 
>>>>> 
>>>>> 
>>>>>> 2)
>>>>>>> I don't see a need for this.
>>>>>>> 
>>>>>>> Have fun
>>>>>>> Sven
>>>>>>> 
>>>>>>> 
>>>>>>> how about adding a
>>>>>>> 
>>>>>>> 
>>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>> 
>>>>>>> Hi,
>>>>>>>> 
>>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>> 
>>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>> 
>>>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel
>>>>>>>> (extends
>>>>>>>> from AROM).
>>>>>>>> Initially while MM suggested IROM I thought it will be a parent
>>>>>>>> interface
>>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>> 
>>>>>>>> 2) stream based iteration of container's children by Andrea Del Bene
>>>>>>>> I have said my opinion before - the visitor approach is faster than
>>>>>>>> the
>>>>>>>> stream based one.
>>>>>>>> In addition we have to remove the deprecated
>>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its
>>>>>>>> related
>>>>>>>> classes because it fails with StackoverflowError when used in a page
>>>>>>>> with
>>>>>>>> bigger component tree.
>>>>>>>> So I don't see a reason for this feature.
>>>>>>>> 
>>>>>>>> Your option on them ?
>>>>>>>> 
>>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>> 
>>>>>>>> Martin Grigorov
>>>>>>>> Wicket Training and Consulting
>>>>>>>> https://twitter.com/mtgrigorov
>> 

Re: More lambdas

Posted by Martin Grigorov <mg...@apache.org>.
Yes!

-               IModel<String> personNameModel = new
SupplierModel<>(person::getName);
+               IModel<String> personNameModel = person::getName;

Definitely makes sense to make it shorter!

I'll nuke it now!


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Mar 14, 2016 at 10:55 AM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> IModel being a functional interface now, what's the use of SupplierModel ?
> IMHO we can get rid of it.
>
> Regards
> Sven
>
>
>
> On 12.03.2016 23:39, Tobias Soloschenko wrote:
>
>> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>>
>> Great work all!
>>
>> kind regards
>>
>> Tobias
>>
>> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>
>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>> like:
>>>>
>>>> new Link<String>("", () -> "abc") {
>>>>   @Override
>>>>   public void onClick()
>>>>   {
>>>>      // ...
>>>>   }
>>>> };
>>>>
>>>
>>> Seems we're getting a grip on Wicket+lambdas finally :)
>>>
>>> Thanks
>>> Sven
>>>
>>>
>>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>>
>>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <mgrigorov@apache.org
>>>> >
>>>> wrote:
>>>>
>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>>
>>>>> Hi,
>>>>>>
>>>>>> 1)
>>>>>> we've been twiddling with read-only models for some time now, and
>>>>>> IIRC it
>>>>>> never quite worked out.
>>>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>>>>> perhaps I'm missing the point though.
>>>>>>
>>>>>> How about adding another default to IModel:
>>>>>>
>>>>>>      default void setObject(final T object) {
>>>>>>          throw new UnsupportedOperationException();
>>>>>>      }
>>>>>>
>>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>>
>>>>>> A minor thing that bothers me here is that currently AROM#setObject()
>>>>> is
>>>>> final, so subclasses are effectively read only too.
>>>>> By moving this method to IModel we cannot make any guarantees.
>>>>> But I guess it will always be used as an anonymous inner class, as
>>>>> AROM is
>>>>> used now. If someone wants to have children then (s)he will have to
>>>>> create
>>>>> a custom class and there (s)he can make it 'final'.
>>>>> Let's do it!
>>>>>
>>>>> As a bonus IModel is a @FunctionalInterface now and one can do things
>>>> like:
>>>>
>>>> new Link<String>("", () -> "abc") {
>>>>     @Override
>>>>     public void onClick()
>>>>     {
>>>>        // ...
>>>>     }
>>>> };
>>>>
>>>>
>>>>
>>>>> 2)
>>>>>> I don't see a need for this.
>>>>>>
>>>>>> Have fun
>>>>>> Sven
>>>>>>
>>>>>>
>>>>>> how about adding a
>>>>>>
>>>>>>
>>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>>
>>>>>> Hi,
>>>>>>>
>>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>>
>>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>>
>>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel
>>>>>>> (extends
>>>>>>> from AROM).
>>>>>>> Initially while MM suggested IROM I thought it will be a parent
>>>>>>> interface
>>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>>
>>>>>>> 2) stream based iteration of container's children by Andrea Del Bene
>>>>>>> I have said my opinion before - the visitor approach is faster than
>>>>>>> the
>>>>>>> stream based one.
>>>>>>> In addition we have to remove the deprecated
>>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its
>>>>>>> related
>>>>>>> classes because it fails with StackoverflowError when used in a page
>>>>>>> with
>>>>>>> bigger component tree.
>>>>>>> So I don't see a reason for this feature.
>>>>>>>
>>>>>>> Your option on them ?
>>>>>>>
>>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>>
>>>>>>> Martin Grigorov
>>>>>>> Wicket Training and Consulting
>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>
>>>>>>>
>>>>>>>
>>>
>>
>

Re: More lambdas

Posted by Sven Meier <sv...@meiers.net>.
Hi,

IModel being a functional interface now, what's the use of SupplierModel ?
IMHO we can get rid of it.

Regards
Sven


On 12.03.2016 23:39, Tobias Soloschenko wrote:
> Yep - I am very happy about it, too - cool features for wicket 8 :-)
>
> Great work all!
>
> kind regards
>
> Tobias
>
> Am 12.03.16 um 23:38 schrieb Sven Meier:
>>> As a bonus IModel is a @FunctionalInterface now and one can do 
>>> things like:
>>>
>>> new Link<String>("", () -> "abc") {
>>>   @Override
>>>   public void onClick()
>>>   {
>>>      // ...
>>>   }
>>> };
>>
>> Seems we're getting a grip on Wicket+lambdas finally :)
>>
>> Thanks
>> Sven
>>
>>
>> On 12.03.2016 23:13, Martin Grigorov wrote:
>>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov 
>>> <mg...@apache.org>
>>> wrote:
>>>
>>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> 1)
>>>>> we've been twiddling with read-only models for some time now, and 
>>>>> IIRC it
>>>>> never quite worked out.
>>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>>>> perhaps I'm missing the point though.
>>>>>
>>>>> How about adding another default to IModel:
>>>>>
>>>>>      default void setObject(final T object) {
>>>>>          throw new UnsupportedOperationException();
>>>>>      }
>>>>>
>>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>>
>>>> A minor thing that bothers me here is that currently 
>>>> AROM#setObject() is
>>>> final, so subclasses are effectively read only too.
>>>> By moving this method to IModel we cannot make any guarantees.
>>>> But I guess it will always be used as an anonymous inner class, as 
>>>> AROM is
>>>> used now. If someone wants to have children then (s)he will have to 
>>>> create
>>>> a custom class and there (s)he can make it 'final'.
>>>> Let's do it!
>>>>
>>> As a bonus IModel is a @FunctionalInterface now and one can do 
>>> things like:
>>>
>>> new Link<String>("", () -> "abc") {
>>>     @Override
>>>     public void onClick()
>>>     {
>>>        // ...
>>>     }
>>> };
>>>
>>>
>>>>
>>>>> 2)
>>>>> I don't see a need for this.
>>>>>
>>>>> Have fun
>>>>> Sven
>>>>>
>>>>>
>>>>> how about adding a
>>>>>
>>>>>
>>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> At "lambdas" [1] branch there are two more features:
>>>>>>
>>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>>
>>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel 
>>>>>> (extends
>>>>>> from AROM).
>>>>>> Initially while MM suggested IROM I thought it will be a parent 
>>>>>> interface
>>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>>
>>>>>> 2) stream based iteration of container's children by Andrea Del Bene
>>>>>> I have said my opinion before - the visitor approach is faster 
>>>>>> than the
>>>>>> stream based one.
>>>>>> In addition we have to remove the deprecated
>>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its 
>>>>>> related
>>>>>> classes because it fails with StackoverflowError when used in a 
>>>>>> page with
>>>>>> bigger component tree.
>>>>>> So I don't see a reason for this feature.
>>>>>>
>>>>>> Your option on them ?
>>>>>>
>>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>>
>>>>>> Martin Grigorov
>>>>>> Wicket Training and Consulting
>>>>>> https://twitter.com/mtgrigorov
>>>>>>
>>>>>>
>>
>


Re: More lambdas

Posted by Tobias Soloschenko <to...@googlemail.com>.
Yep - I am very happy about it, too - cool features for wicket 8 :-)

Great work all!

kind regards

Tobias

Am 12.03.16 um 23:38 schrieb Sven Meier:
>> As a bonus IModel is a @FunctionalInterface now and one can do things 
>> like:
>>
>> new Link<String>("", () -> "abc") {
>>   @Override
>>   public void onClick()
>>   {
>>      // ...
>>   }
>> };
>
> Seems we're getting a grip on Wicket+lambdas finally :)
>
> Thanks
> Sven
>
>
> On 12.03.2016 23:13, Martin Grigorov wrote:
>> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <mg...@apache.org>
>> wrote:
>>
>>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:
>>>
>>>> Hi,
>>>>
>>>> 1)
>>>> we've been twiddling with read-only models for some time now, and 
>>>> IIRC it
>>>> never quite worked out.
>>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>>> perhaps I'm missing the point though.
>>>>
>>>> How about adding another default to IModel:
>>>>
>>>>      default void setObject(final T object) {
>>>>          throw new UnsupportedOperationException();
>>>>      }
>>>>
>>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>>
>>> A minor thing that bothers me here is that currently 
>>> AROM#setObject() is
>>> final, so subclasses are effectively read only too.
>>> By moving this method to IModel we cannot make any guarantees.
>>> But I guess it will always be used as an anonymous inner class, as 
>>> AROM is
>>> used now. If someone wants to have children then (s)he will have to 
>>> create
>>> a custom class and there (s)he can make it 'final'.
>>> Let's do it!
>>>
>> As a bonus IModel is a @FunctionalInterface now and one can do things 
>> like:
>>
>> new Link<String>("", () -> "abc") {
>>     @Override
>>     public void onClick()
>>     {
>>        // ...
>>     }
>> };
>>
>>
>>>
>>>> 2)
>>>> I don't see a need for this.
>>>>
>>>> Have fun
>>>> Sven
>>>>
>>>>
>>>> how about adding a
>>>>
>>>>
>>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> At "lambdas" [1] branch there are two more features:
>>>>>
>>>>> 1) IReadOnlyModel by Michael Mossman
>>>>>
>>>>> At the moment there are AbstractReadOnlyModel and SupplierModel 
>>>>> (extends
>>>>> from AROM).
>>>>> Initially while MM suggested IROM I thought it will be a parent 
>>>>> interface
>>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>>> I don't see need of IROM. The classes look enough to me.
>>>>>
>>>>> 2) stream based iteration of container's children by Andrea Del Bene
>>>>> I have said my opinion before - the visitor approach is faster 
>>>>> than the
>>>>> stream based one.
>>>>> In addition we have to remove the deprecated
>>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its 
>>>>> related
>>>>> classes because it fails with StackoverflowError when used in a 
>>>>> page with
>>>>> bigger component tree.
>>>>> So I don't see a reason for this feature.
>>>>>
>>>>> Your option on them ?
>>>>>
>>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>>
>>>>> Martin Grigorov
>>>>> Wicket Training and Consulting
>>>>> https://twitter.com/mtgrigorov
>>>>>
>>>>>
>


Re: More lambdas

Posted by Sven Meier <sv...@meiers.net>.
>As a bonus IModel is a @FunctionalInterface now and one can do things like:
>
>new Link<String>("", () -> "abc") {
>   @Override
>   public void onClick()
>   {
>      // ...
>   }
>};

Seems we're getting a grip on Wicket+lambdas finally :)

Thanks
Sven


On 12.03.2016 23:13, Martin Grigorov wrote:
> On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
>> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:
>>
>>> Hi,
>>>
>>> 1)
>>> we've been twiddling with read-only models for some time now, and IIRC it
>>> never quite worked out.
>>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>>> perhaps I'm missing the point though.
>>>
>>> How about adding another default to IModel:
>>>
>>>      default void setObject(final T object) {
>>>          throw new UnsupportedOperationException();
>>>      }
>>>
>>> This way we can get rid of AbstractReadOnlyModel too :P
>>>
>> A minor thing that bothers me here is that currently AROM#setObject() is
>> final, so subclasses are effectively read only too.
>> By moving this method to IModel we cannot make any guarantees.
>> But I guess it will always be used as an anonymous inner class, as AROM is
>> used now. If someone wants to have children then (s)he will have to create
>> a custom class and there (s)he can make it 'final'.
>> Let's do it!
>>
> As a bonus IModel is a @FunctionalInterface now and one can do things like:
>
> new Link<String>("", () -> "abc") {
>     @Override
>     public void onClick()
>     {
>        // ...
>     }
> };
>
>
>>
>>> 2)
>>> I don't see a need for this.
>>>
>>> Have fun
>>> Sven
>>>
>>>
>>> how about adding a
>>>
>>>
>>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>>
>>>> Hi,
>>>>
>>>> At "lambdas" [1] branch there are two more features:
>>>>
>>>> 1) IReadOnlyModel by Michael Mossman
>>>>
>>>> At the moment there are AbstractReadOnlyModel and SupplierModel (extends
>>>> from AROM).
>>>> Initially while MM suggested IROM I thought it will be a parent interface
>>>> of IModel but it is the opposite - IROM extends from IModel.
>>>> I don't see need of IROM. The classes look enough to me.
>>>>
>>>> 2) stream based iteration of container's children by Andrea Del Bene
>>>> I have said my opinion before - the visitor approach is faster than the
>>>> stream based one.
>>>> In addition we have to remove the deprecated
>>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its related
>>>> classes because it fails with StackoverflowError when used in a page with
>>>> bigger component tree.
>>>> So I don't see a reason for this feature.
>>>>
>>>> Your option on them ?
>>>>
>>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>>
>>>> Martin Grigorov
>>>> Wicket Training and Consulting
>>>> https://twitter.com/mtgrigorov
>>>>
>>>>


Re: More lambdas

Posted by Martin Grigorov <mg...@apache.org>.
On Sat, Mar 12, 2016 at 11:01 PM, Martin Grigorov <mg...@apache.org>
wrote:

>
> On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:
>
>> Hi,
>>
>> 1)
>> we've been twiddling with read-only models for some time now, and IIRC it
>> never quite worked out.
>> I don't see much benefit in IReadOnlyModel as it is proposed now -
>> perhaps I'm missing the point though.
>>
>> How about adding another default to IModel:
>>
>>     default void setObject(final T object) {
>>         throw new UnsupportedOperationException();
>>     }
>>
>> This way we can get rid of AbstractReadOnlyModel too :P
>>
>
> A minor thing that bothers me here is that currently AROM#setObject() is
> final, so subclasses are effectively read only too.
> By moving this method to IModel we cannot make any guarantees.
> But I guess it will always be used as an anonymous inner class, as AROM is
> used now. If someone wants to have children then (s)he will have to create
> a custom class and there (s)he can make it 'final'.
> Let's do it!
>

As a bonus IModel is a @FunctionalInterface now and one can do things like:

new Link<String>("", () -> "abc") {
   @Override
   public void onClick()
   {
      // ...
   }
};


>
>
>>
>> 2)
>> I don't see a need for this.
>>
>> Have fun
>> Sven
>>
>>
>> how about adding a
>>
>>
>> On 11.03.2016 22:54, Martin Grigorov wrote:
>>
>>> Hi,
>>>
>>> At "lambdas" [1] branch there are two more features:
>>>
>>> 1) IReadOnlyModel by Michael Mossman
>>>
>>> At the moment there are AbstractReadOnlyModel and SupplierModel (extends
>>> from AROM).
>>> Initially while MM suggested IROM I thought it will be a parent interface
>>> of IModel but it is the opposite - IROM extends from IModel.
>>> I don't see need of IROM. The classes look enough to me.
>>>
>>> 2) stream based iteration of container's children by Andrea Del Bene
>>> I have said my opinion before - the visitor approach is faster than the
>>> stream based one.
>>> In addition we have to remove the deprecated
>>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its related
>>> classes because it fails with StackoverflowError when used in a page with
>>> bigger component tree.
>>> So I don't see a reason for this feature.
>>>
>>> Your option on them ?
>>>
>>> 1. https://github.com/apache/wicket/compare/lambdas
>>>
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>>
>>>
>>
>

Re: More lambdas

Posted by Martin Grigorov <mg...@apache.org>.
On Sat, Mar 12, 2016 at 7:48 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> 1)
> we've been twiddling with read-only models for some time now, and IIRC it
> never quite worked out.
> I don't see much benefit in IReadOnlyModel as it is proposed now - perhaps
> I'm missing the point though.
>
> How about adding another default to IModel:
>
>     default void setObject(final T object) {
>         throw new UnsupportedOperationException();
>     }
>
> This way we can get rid of AbstractReadOnlyModel too :P
>

A minor thing that bothers me here is that currently AROM#setObject() is
final, so subclasses are effectively read only too.
By moving this method to IModel we cannot make any guarantees.
But I guess it will always be used as an anonymous inner class, as AROM is
used now. If someone wants to have children then (s)he will have to create
a custom class and there (s)he can make it 'final'.
Let's do it!


>
> 2)
> I don't see a need for this.
>
> Have fun
> Sven
>
>
> how about adding a
>
>
> On 11.03.2016 22:54, Martin Grigorov wrote:
>
>> Hi,
>>
>> At "lambdas" [1] branch there are two more features:
>>
>> 1) IReadOnlyModel by Michael Mossman
>>
>> At the moment there are AbstractReadOnlyModel and SupplierModel (extends
>> from AROM).
>> Initially while MM suggested IROM I thought it will be a parent interface
>> of IModel but it is the opposite - IROM extends from IModel.
>> I don't see need of IROM. The classes look enough to me.
>>
>> 2) stream based iteration of container's children by Andrea Del Bene
>> I have said my opinion before - the visitor approach is faster than the
>> stream based one.
>> In addition we have to remove the deprecated
>> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its related
>> classes because it fails with StackoverflowError when used in a page with
>> bigger component tree.
>> So I don't see a reason for this feature.
>>
>> Your option on them ?
>>
>> 1. https://github.com/apache/wicket/compare/lambdas
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>>
>

Re: More lambdas

Posted by Sven Meier <sv...@meiers.net>.
Hi,

1)
we've been twiddling with read-only models for some time now, and IIRC 
it never quite worked out.
I don't see much benefit in IReadOnlyModel as it is proposed now - 
perhaps I'm missing the point though.

How about adding another default to IModel:

     default void setObject(final T object) {
         throw new UnsupportedOperationException();
     }

This way we can get rid of AbstractReadOnlyModel too :P

2)
I don't see a need for this.

Have fun
Sven


how about adding a

On 11.03.2016 22:54, Martin Grigorov wrote:
> Hi,
>
> At "lambdas" [1] branch there are two more features:
>
> 1) IReadOnlyModel by Michael Mossman
>
> At the moment there are AbstractReadOnlyModel and SupplierModel (extends
> from AROM).
> Initially while MM suggested IROM I thought it will be a parent interface
> of IModel but it is the opposite - IROM extends from IModel.
> I don't see need of IROM. The classes look enough to me.
>
> 2) stream based iteration of container's children by Andrea Del Bene
> I have said my opinion before - the visitor approach is faster than the
> stream based one.
> In addition we have to remove the deprecated
> org.apache.wicket.util.iterator.AbstractHierarchyIterator and its related
> classes because it fails with StackoverflowError when used in a page with
> bigger component tree.
> So I don't see a reason for this feature.
>
> Your option on them ?
>
> 1. https://github.com/apache/wicket/compare/lambdas
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>