To make things shorter is ok - to hide information is not ok - later on it is 
hard to track what is going on.

Only my thoughts about the second code snippet

kind regards

Tobias

> Am 10.11.2016 um 13:18 schrieb Martijn Dashorst <[email protected]>:
> 
> That would transform the code from:
> 
> condition = new AbstractReadOnlyModel<Boolean>() {
>    public Boolean getObject() { return visibility.get(); }
> };
> 
> via:
> condition = LambdaModel.of(visibility);
> 
> to:
> condition = visibility::get;
> 
> Not sure if I like the latter, as it hides the model, making the code
> more obscure.
> 
> Martijn
> 
> 
> 
> On Thu, Nov 10, 2016 at 1:05 PM, Emond Papegaaij
> <[email protected]> wrote:
>> Didn't we make IModel a functional interface with default methods for
>> setObject and detach? In that case, you can simply use a method reference as
>> your model.
>> 
>> Emond
>> 
>>> On donderdag 10 november 2016 12:56:50 CET Martijn Dashorst wrote:
>>> I'm working on replacing my AROM's and often they just call a getter.
>>> In that case I'd rather use a method reference than doing the IModel
>>> replacement.
>>> 
>>> Is there a reason why the LambdaModel doesn't have a path for only a getter?
>>> 
>>> This way I can do:
>>> 
>>> public A(String p, final SerializableSupplier<Boolean> visibility)
>>> {
>>>    this(p);
>>>    condition = LambdaModel.of(visibility);
>>> }
>>> 
>>> instead of:
>>> 
>>> public A(String p, final SerializableSupplier<Boolean> visibility)
>>> {
>>>    this(p);
>>>    condition = new IModel<Boolean>() {
>>>        private static final long serialVersionUID = 1L;
>>> 
>>>        @Override
>>>        public Boolean getObject() {
>>>            return visibility.get();
>>>        }
>>>    };
>>> }
>>> 
>>> I have the code ready to push, shall I?
>>> 
>>> Martijn
>> 
>> 
> 
> 
> 
> -- 
> Become a Wicket expert, learn from the best: http://wicketinaction.com

Reply via email to