oh.. sorry.. got it..
You hat to use BiConsumer for set functions..

mm:)

Am 02.12.2015 um 08:53 schrieb Michael Mosmann:
> Hi,
> 
> 
> 
> Some first thoughts on this..
> 
> If we want to use lambdas for some kind of property model, the straight
> forward way of doing this looks like:
> 
> SomeBean instance=new SomeBean();
> IModel<String> model=Models.of(instance::getName,instance.setName);
> 
> But this will not work, if you have
> 
> IModel<SomeBean> instanceModel=...;
> 
> So then we could use:
> IModel<String> model=Models.of(instanceModel, x-> x.getName() ,(x,v) ->
> x.setName(v));
> 
> It is sad, that there is no way to get some kind of instance method
> reference in java8.
> 
> What i would like to write is something like this:
> 
> IModel<String> model=Models.of(instanceModel, SomeBean::getName
> ,SomeBean::setName); // does not compile
> 
> IMHO the correct way to solve this looks a little strange, but is from
> my point of view more consistent...
> 
> IModel<String> model=Models.of(instanceModel, x -> x::getName, x ->
> x::setName)
> 
> the Method looks like this:
> 
> public <T,V> of(IModel<T> model, Function<T, Supplier<V>> getter,
> Function<T, Consumer<V>> setter);
> 
> (* where Function, Supplier and Consumer must extends Serializable)
> 
> am i wrong? did i miss something? because i am far from happy with this..
> 
> mm:)
> 
> 
> Am 01.12.2015 um 12:45 schrieb andrea del bene:
>>
>>
>> Ok, I'd like to play too :) ...
>>> AFAIK we're still playing with lambdas. I still have a message I need
>>> to send to dev@ regarding lambdas...
>>>
>>> Martijn
>>>
>>>
>>> On Mon, Nov 30, 2015 at 3:57 PM, Michael Mosmann <[email protected]>
>>> wrote:
>>>> Hi,
>>>>
>>>> AFAIK not.. I thought it is something like a playground. Am i wrong?
>>>>
>>>> Michael
>>>>
>>>> Am 30. November 2015 15:47:42 MEZ, schrieb andrea del bene
>>>> <[email protected]>:
>>>>> Hi,
>>>>>
>>>>> are we tracking changes to lambda branch with issues on JIRA?
>>>>>
>>>>> Andrea.
>>>> -- 
>>>> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
>>>> gesendet.
>>>
>>>
>>
> 

Reply via email to