Hi Pedro,
I think we had a similar discussion some time ago:
http://wicket-dev.markmail.org/message/vzdggjv5csmpzfrl?q=change+IModel+to+readonly+by+default
We simply agreed to use IModel as a default read-only model. IMHO this
is a good solution.
Cheers.
Andrea.
On 07/04/2017 17:45, Pedro Santos wrote:
Hi devs,
IModel isn't an interface designed to provide a function, it's rather an
interface designed to provide and manipulate (setObject and detach methods)
internal state.
IMO a better alternative to benefit from Java 8 features would be to move
the FunctionalInterface annotation to an interface that actually is
designed to provide one function.
I propose that we add a new interface extending IModel to provide this
functional interface, instead of to misplace it in an interface made for
objects with internal state.
e.g.
@FunctionalInterface
interface IReadyOnlyModel / IModelFunction / IFunction extends from IModel{
default void setObject(final T object)
{
throw new UnsupportedOperationException("unsuported");
}
default void detach()
{
throw new UnsupportedOperationException("unsuported");
}
}
Cheers
Pedro Santos