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


Reply via email to