You have ruined the magic :).

On 02/12/2015 12:21, Martin Grigorov wrote:
On Wed, Dec 2, 2015 at 1:19 PM, andrea del bene <[email protected]>
wrote:

You can see a fantastic  example :D of instance method reference in
MarkupContainerTest where I filter children components with
Class::isInstance:

private Stream<Component> filterChildrenStreamByClass(MarkupContainer
container, Class<? extends Component> filterClass)
{
     return container.childrenStream().filter(filterClass::isInstance);
}


IMO, we should be careful with this.
This code is shorter but definitely slower than the old code.


Wicket on functional-steroids :)



On 02/12/2015 09:54, Michael Mosmann wrote:

Hi,

.. got it. Was on a wrong track:)

We must use BiConsumer for setter-like methods..

mm:)

Am 02.12.2015 um 09:39 schrieb Sven Meier:

Hi,

It is sad, that there is no way to get some kind of instance method
reference in java8.

instance::getName *is* an instance method reference.

IModel<String> model=Models.of(instanceModel, SomeBean::getName
,SomeBean::setName); // does not compile

org.wicketstuff.lambda.model.LambdaModel works fine, so what does not
compile in your example?

Did I miss something? :P

Sven


On 02.12.2015 08:53, Michael Mosmann wrote:

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