You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martijn Dashorst <ma...@gmail.com> on 2015/10/05 22:42:44 UTC

[wicket8] Use default method for IModel#detach()?

Should we use an empty default implementation for IModel#detach?


public class IModel<T> extends IDetachable
{
    ...

    @Override
    default void detach()
    {
    }
}

This won't break existing applications, but might make it a bit easier
on the eyes to implement IModel directly.

I'm not in favor of applying the default method to IDetachable,
because that would defeat the interface's purpose IMO.

WDYT?

Martijn

Re: [wicket8] Use default method for IModel#detach()?

Posted by Martin Grigorov <mg...@apache.org>.
+1

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> Should we use an empty default implementation for IModel#detach?
>
>
> public class IModel<T> extends IDetachable
> {
>     ...
>
>     @Override
>     default void detach()
>     {
>     }
> }
>
> This won't break existing applications, but might make it a bit easier
> on the eyes to implement IModel directly.
>
> I'm not in favor of applying the default method to IDetachable,
> because that would defeat the interface's purpose IMO.
>
> WDYT?
>
> Martijn
>

Re: [wicket8] Use default method for IModel#detach()?

Posted by Pedro Santos <pe...@gmail.com>.
Hi Sven,

yes, I want to work on the proposals:

- to not force IDetachable to IModel
- IModel without the functional interface annotation
- named LambdaModel subclasses and a better name for this class

>IIRC Michael Mosmann tried to work on something similar but it never quite
worked out.

Indeed it looks a big change and I wouldn't propose it to Wicket 8, but
yes, I would like to give it a try in the future.


Pedro Santos

On Mon, Mar 27, 2017 at 1:50 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi Pedro,
>
> >Why don't we make AbstractReadyOnlyModel the superinterface of IModel
>
> IIRC Michael Mosmann tried to work on something similar but it never quite
> worked out.
>
> Do you want to work on a proposal?
>
> Before you invest too much time into this: I'm pretty sure most devs won't
> be in favor of doing another round of IModel refactoring in Wicket 8
> because of semantics.
>
> Regards
> Sven
>
>
>
> On 27.03.2017 01:39, Pedro Santos wrote:
>
>> -0
>>
>> I see no good reason for IModel to extend from IDetachable. Users should
>> be
>> able to add this interface at their will.
>>
>> If IModel were a @FunctionalInterface, then you wouldn't need something
>>> like
>>>
>> a SupplierModel; you could just use a lambda directly:
>>
>> IModel, as it's now, isn't a functional interface.
>>
>> Then maybe just make IModel#setObject() default too ..
>>>
>> There's no default implementation for IModel#setObject(). The one that was
>> added is as much semantically wrong as to say IModel is a functional
>> interface.
>>
>> Proposal:
>>
>> Why don't we make AbstractReadyOnlyModel the superinterface of IModel
>> instead of to keep it as an abstract adaptor for IModel? So we would have
>> a
>> semantically correct functional interface.
>>
>>
>>
>> Pedro Santos
>>
>> On Tue, Oct 6, 2015 at 6:42 PM, Martin Grigorov <mg...@apache.org>
>> wrote:
>>
>> Ugh, right!
>>>
>>> Then maybe just make IModel#setObject() default too ...
>>> We will experiment! :)
>>>
>>> Martin Grigorov
>>> Wicket Training and Consulting
>>> https://twitter.com/mtgrigorov
>>>
>>> On Tue, Oct 6, 2015 at 11:27 PM, Michael Mosmann <mi...@mosmann.de>
>>> wrote:
>>>
>>> .. @IReadOnlyModel: i hope, it will be easier to change then the last
>>>>
>>> time
>>>
>>>> i tried it. Watch out for component default model stuff...
>>>>
>>>> :)
>>>>
>>>> Am 6. Oktober 2015 22:54:37 MESZ, schrieb Martin Grigorov <
>>>> mgrigorov@apache.org>:
>>>>
>>>>> On Tue, Oct 6, 2015 at 10:43 PM, Andrew Geery <an...@gmail.com>
>>>>> wrote:
>>>>>
>>>>> If IModel were a @FunctionalInterface, then you wouldn't need
>>>>>>
>>>>> something
>>>>>
>>>>>> like a SupplierModel; you could just use a lambda directly:
>>>>>>
>>>>>> new Label("label", () -> "The current time is " + LocalDate.now());
>>>>>>
>>>>>> This looks good indeed.
>>>>> It seems we will add IReadOnlyModel soon!
>>>>>
>>>>>
>>>>> And since IModel is Serializable, the lambda will be too, without
>>>>>>
>>>>> having to
>>>>>
>>>>>> have an artificial interface that is both Serializable & a Supplier.
>>>>>>
>>>>>> Thanks
>>>>>> Andrew
>>>>>>
>>>>>> On Tue, Oct 6, 2015 at 4:21 PM, Martin Grigorov
>>>>>>
>>>>> <mg...@apache.org>
>>>>>
>>>>>> wrote:
>>>>>>
>>>>>> Same for IRequestHandler#detach()
>>>>>>>
>>>>>>> Martin Grigorov
>>>>>>> Wicket Training and Consulting
>>>>>>> https://twitter.com/mtgrigorov
>>>>>>>
>>>>>>> On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
>>>>>>> martijn.dashorst@gmail.com> wrote:
>>>>>>>
>>>>>>> Should we use an empty default implementation for IModel#detach?
>>>>>>>>
>>>>>>>>
>>>>>>>> public class IModel<T> extends IDetachable
>>>>>>>> {
>>>>>>>>      ...
>>>>>>>>
>>>>>>>>      @Override
>>>>>>>>      default void detach()
>>>>>>>>      {
>>>>>>>>      }
>>>>>>>> }
>>>>>>>>
>>>>>>>> This won't break existing applications, but might make it a bit
>>>>>>>>
>>>>>>> easier
>>>>>
>>>>>> on the eyes to implement IModel directly.
>>>>>>>>
>>>>>>>> I'm not in favor of applying the default method to IDetachable,
>>>>>>>> because that would defeat the interface's purpose IMO.
>>>>>>>>
>>>>>>>> WDYT?
>>>>>>>>
>>>>>>>> Martijn
>>>>>>>>
>>>>>>>> --
>>>> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
>>>> gesendet.
>>>>
>>>
>

Re: [wicket8] Use default method for IModel#detach()?

Posted by Sven Meier <sv...@meiers.net>.
Hi Pedro,

 >Why don't we make AbstractReadyOnlyModel the superinterface of IModel

IIRC Michael Mosmann tried to work on something similar but it never 
quite worked out.

Do you want to work on a proposal?

Before you invest too much time into this: I'm pretty sure most devs 
won't be in favor of doing another round of IModel refactoring in Wicket 
8 because of semantics.

Regards
Sven


On 27.03.2017 01:39, Pedro Santos wrote:
> -0
>
> I see no good reason for IModel to extend from IDetachable. Users should be
> able to add this interface at their will.
>
>> If IModel were a @FunctionalInterface, then you wouldn't need something like
> a SupplierModel; you could just use a lambda directly:
>
> IModel, as it's now, isn't a functional interface.
>
>> Then maybe just make IModel#setObject() default too ..
> There's no default implementation for IModel#setObject(). The one that was
> added is as much semantically wrong as to say IModel is a functional
> interface.
>
> Proposal:
>
> Why don't we make AbstractReadyOnlyModel the superinterface of IModel
> instead of to keep it as an abstract adaptor for IModel? So we would have a
> semantically correct functional interface.
>
>
>
> Pedro Santos
>
> On Tue, Oct 6, 2015 at 6:42 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
>> Ugh, right!
>>
>> Then maybe just make IModel#setObject() default too ...
>> We will experiment! :)
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Tue, Oct 6, 2015 at 11:27 PM, Michael Mosmann <mi...@mosmann.de>
>> wrote:
>>
>>> .. @IReadOnlyModel: i hope, it will be easier to change then the last
>> time
>>> i tried it. Watch out for component default model stuff...
>>>
>>> :)
>>>
>>> Am 6. Oktober 2015 22:54:37 MESZ, schrieb Martin Grigorov <
>>> mgrigorov@apache.org>:
>>>> On Tue, Oct 6, 2015 at 10:43 PM, Andrew Geery <an...@gmail.com>
>>>> wrote:
>>>>
>>>>> If IModel were a @FunctionalInterface, then you wouldn't need
>>>> something
>>>>> like a SupplierModel; you could just use a lambda directly:
>>>>>
>>>>> new Label("label", () -> "The current time is " + LocalDate.now());
>>>>>
>>>> This looks good indeed.
>>>> It seems we will add IReadOnlyModel soon!
>>>>
>>>>
>>>>> And since IModel is Serializable, the lambda will be too, without
>>>> having to
>>>>> have an artificial interface that is both Serializable & a Supplier.
>>>>>
>>>>> Thanks
>>>>> Andrew
>>>>>
>>>>> On Tue, Oct 6, 2015 at 4:21 PM, Martin Grigorov
>>>> <mg...@apache.org>
>>>>> wrote:
>>>>>
>>>>>> Same for IRequestHandler#detach()
>>>>>>
>>>>>> Martin Grigorov
>>>>>> Wicket Training and Consulting
>>>>>> https://twitter.com/mtgrigorov
>>>>>>
>>>>>> On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
>>>>>> martijn.dashorst@gmail.com> wrote:
>>>>>>
>>>>>>> Should we use an empty default implementation for IModel#detach?
>>>>>>>
>>>>>>>
>>>>>>> public class IModel<T> extends IDetachable
>>>>>>> {
>>>>>>>      ...
>>>>>>>
>>>>>>>      @Override
>>>>>>>      default void detach()
>>>>>>>      {
>>>>>>>      }
>>>>>>> }
>>>>>>>
>>>>>>> This won't break existing applications, but might make it a bit
>>>> easier
>>>>>>> on the eyes to implement IModel directly.
>>>>>>>
>>>>>>> I'm not in favor of applying the default method to IDetachable,
>>>>>>> because that would defeat the interface's purpose IMO.
>>>>>>>
>>>>>>> WDYT?
>>>>>>>
>>>>>>> Martijn
>>>>>>>
>>> --
>>> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
>>> gesendet.


Re: [wicket8] Use default method for IModel#detach()?

Posted by Pedro Santos <pe...@gmail.com>.
Neither I am sure I understand you. By dating the email thread and the
IModel interface hierarchy you mean that by them being old we can't discuss
their merit?

I meant that IModel isn't a functional interface, not that it isn't
annotated as one. Same for the setObject method not having a default
implementation.

IModel is the interface of objects with two behaviours, they can set and
get model objects. A functional interface is a contract promising only one
behavior.

How to throw an exception is the default functionality of setObject method?
Nothing is being set there, so it doesn't fit as a default implementation.

On Mar 27, 2017 3:22 AM, "Martin Grigorov" <mg...@apache.org> wrote:

Hi Pedro,

I am not sure I understand you!
This discussion was 1.5 years ago ...

On Mon, Mar 27, 2017 at 1:39 AM, Pedro Santos <pe...@gmail.com> wrote:

> -0
>
> I see no good reason for IModel to extend from IDetachable. Users should
be
> able to add this interface at their will.
>

IModel extends IDetachable since forever
https://github.com/apache/wicket/blob/wicket-1.3.x/jdk-
1.4/wicket/src/main/java/org/apache/wicket/model/IModel.java#L56


>
> >If IModel were a @FunctionalInterface, then you wouldn't need something
> like
> a SupplierModel; you could just use a lambda directly:
>
> IModel, as it's now, isn't a functional interface.
>

Yes, it is!
https://github.com/apache/wicket/blob/8a4e1b3c24f4ce1fc3e44ca1b5a923
0158d9b584/wicket-core/src/main/java/org/apache/wicket/model/IModel.java#L63


>
> >Then maybe just make IModel#setObject() default too ..
>
> There's no default implementation for IModel#setObject(). The one that was
>

Yes, there is!
https://github.com/apache/wicket/blob/8a4e1b3c24f4ce1fc3e44ca1b5a923
0158d9b584/wicket-core/src/main/java/org/apache/wicket/model/IModel.java#L81


> added is as much semantically wrong as to say IModel is a functional
> interface.



> Proposal:
>
> Why don't we make AbstractReadyOnlyModel the superinterface of IModel
> instead of to keep it as an abstract adaptor for IModel? So we would have
a
> semantically correct functional interface.
>

IMO the current design looks and works quite good! No need to change
anything!


>
>
>
> Pedro Santos
>
> On Tue, Oct 6, 2015 at 6:42 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Ugh, right!
> >
> > Then maybe just make IModel#setObject() default too ...
> > We will experiment! :)
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Tue, Oct 6, 2015 at 11:27 PM, Michael Mosmann <mi...@mosmann.de>
> > wrote:
> >
> > > .. @IReadOnlyModel: i hope, it will be easier to change then the last
> > time
> > > i tried it. Watch out for component default model stuff...
> > >
> > > :)
> > >
> > > Am 6. Oktober 2015 22:54:37 MESZ, schrieb Martin Grigorov <
> > > mgrigorov@apache.org>:
> > > >On Tue, Oct 6, 2015 at 10:43 PM, Andrew Geery <andrew.geery@gmail.com
> >
> > > >wrote:
> > > >
> > > >> If IModel were a @FunctionalInterface, then you wouldn't need
> > > >something
> > > >> like a SupplierModel; you could just use a lambda directly:
> > > >>
> > > >> new Label("label", () -> "The current time is " + LocalDate.now());
> > > >>
> > > >
> > > >This looks good indeed.
> > > >It seems we will add IReadOnlyModel soon!
> > > >
> > > >
> > > >>
> > > >> And since IModel is Serializable, the lambda will be too, without
> > > >having to
> > > >> have an artificial interface that is both Serializable & a
Supplier.
> > > >>
> > > >> Thanks
> > > >> Andrew
> > > >>
> > > >> On Tue, Oct 6, 2015 at 4:21 PM, Martin Grigorov
> > > ><mg...@apache.org>
> > > >> wrote:
> > > >>
> > > >> > Same for IRequestHandler#detach()
> > > >> >
> > > >> > Martin Grigorov
> > > >> > Wicket Training and Consulting
> > > >> > https://twitter.com/mtgrigorov
> > > >> >
> > > >> > On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
> > > >> > martijn.dashorst@gmail.com> wrote:
> > > >> >
> > > >> > > Should we use an empty default implementation for
IModel#detach?
> > > >> > >
> > > >> > >
> > > >> > > public class IModel<T> extends IDetachable
> > > >> > > {
> > > >> > >     ...
> > > >> > >
> > > >> > >     @Override
> > > >> > >     default void detach()
> > > >> > >     {
> > > >> > >     }
> > > >> > > }
> > > >> > >
> > > >> > > This won't break existing applications, but might make it a bit
> > > >easier
> > > >> > > on the eyes to implement IModel directly.
> > > >> > >
> > > >> > > I'm not in favor of applying the default method to IDetachable,
> > > >> > > because that would defeat the interface's purpose IMO.
> > > >> > >
> > > >> > > WDYT?
> > > >> > >
> > > >> > > Martijn
> > > >> > >
> > > >> >
> > > >>
> > >
> > > --
> > > Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
> > > gesendet.
> >
>

Re: [wicket8] Use default method for IModel#detach()?

Posted by Martin Grigorov <mg...@apache.org>.
Hi Pedro,

I am not sure I understand you!
This discussion was 1.5 years ago ...

On Mon, Mar 27, 2017 at 1:39 AM, Pedro Santos <pe...@gmail.com> wrote:

> -0
>
> I see no good reason for IModel to extend from IDetachable. Users should be
> able to add this interface at their will.
>

IModel extends IDetachable since forever
https://github.com/apache/wicket/blob/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/model/IModel.java#L56


>
> >If IModel were a @FunctionalInterface, then you wouldn't need something
> like
> a SupplierModel; you could just use a lambda directly:
>
> IModel, as it's now, isn't a functional interface.
>

Yes, it is!
https://github.com/apache/wicket/blob/8a4e1b3c24f4ce1fc3e44ca1b5a9230158d9b584/wicket-core/src/main/java/org/apache/wicket/model/IModel.java#L63


>
> >Then maybe just make IModel#setObject() default too ..
>
> There's no default implementation for IModel#setObject(). The one that was
>

Yes, there is!
https://github.com/apache/wicket/blob/8a4e1b3c24f4ce1fc3e44ca1b5a9230158d9b584/wicket-core/src/main/java/org/apache/wicket/model/IModel.java#L81


> added is as much semantically wrong as to say IModel is a functional
> interface.



> Proposal:
>
> Why don't we make AbstractReadyOnlyModel the superinterface of IModel
> instead of to keep it as an abstract adaptor for IModel? So we would have a
> semantically correct functional interface.
>

IMO the current design looks and works quite good! No need to change
anything!


>
>
>
> Pedro Santos
>
> On Tue, Oct 6, 2015 at 6:42 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Ugh, right!
> >
> > Then maybe just make IModel#setObject() default too ...
> > We will experiment! :)
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Tue, Oct 6, 2015 at 11:27 PM, Michael Mosmann <mi...@mosmann.de>
> > wrote:
> >
> > > .. @IReadOnlyModel: i hope, it will be easier to change then the last
> > time
> > > i tried it. Watch out for component default model stuff...
> > >
> > > :)
> > >
> > > Am 6. Oktober 2015 22:54:37 MESZ, schrieb Martin Grigorov <
> > > mgrigorov@apache.org>:
> > > >On Tue, Oct 6, 2015 at 10:43 PM, Andrew Geery <andrew.geery@gmail.com
> >
> > > >wrote:
> > > >
> > > >> If IModel were a @FunctionalInterface, then you wouldn't need
> > > >something
> > > >> like a SupplierModel; you could just use a lambda directly:
> > > >>
> > > >> new Label("label", () -> "The current time is " + LocalDate.now());
> > > >>
> > > >
> > > >This looks good indeed.
> > > >It seems we will add IReadOnlyModel soon!
> > > >
> > > >
> > > >>
> > > >> And since IModel is Serializable, the lambda will be too, without
> > > >having to
> > > >> have an artificial interface that is both Serializable & a Supplier.
> > > >>
> > > >> Thanks
> > > >> Andrew
> > > >>
> > > >> On Tue, Oct 6, 2015 at 4:21 PM, Martin Grigorov
> > > ><mg...@apache.org>
> > > >> wrote:
> > > >>
> > > >> > Same for IRequestHandler#detach()
> > > >> >
> > > >> > Martin Grigorov
> > > >> > Wicket Training and Consulting
> > > >> > https://twitter.com/mtgrigorov
> > > >> >
> > > >> > On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
> > > >> > martijn.dashorst@gmail.com> wrote:
> > > >> >
> > > >> > > Should we use an empty default implementation for IModel#detach?
> > > >> > >
> > > >> > >
> > > >> > > public class IModel<T> extends IDetachable
> > > >> > > {
> > > >> > >     ...
> > > >> > >
> > > >> > >     @Override
> > > >> > >     default void detach()
> > > >> > >     {
> > > >> > >     }
> > > >> > > }
> > > >> > >
> > > >> > > This won't break existing applications, but might make it a bit
> > > >easier
> > > >> > > on the eyes to implement IModel directly.
> > > >> > >
> > > >> > > I'm not in favor of applying the default method to IDetachable,
> > > >> > > because that would defeat the interface's purpose IMO.
> > > >> > >
> > > >> > > WDYT?
> > > >> > >
> > > >> > > Martijn
> > > >> > >
> > > >> >
> > > >>
> > >
> > > --
> > > Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
> > > gesendet.
> >
>

Re: [wicket8] Use default method for IModel#detach()?

Posted by Pedro Santos <pe...@gmail.com>.
-0

I see no good reason for IModel to extend from IDetachable. Users should be
able to add this interface at their will.

>If IModel were a @FunctionalInterface, then you wouldn't need something like
a SupplierModel; you could just use a lambda directly:

IModel, as it's now, isn't a functional interface.

>Then maybe just make IModel#setObject() default too ..

There's no default implementation for IModel#setObject(). The one that was
added is as much semantically wrong as to say IModel is a functional
interface.

Proposal:

Why don't we make AbstractReadyOnlyModel the superinterface of IModel
instead of to keep it as an abstract adaptor for IModel? So we would have a
semantically correct functional interface.



Pedro Santos

On Tue, Oct 6, 2015 at 6:42 PM, Martin Grigorov <mg...@apache.org>
wrote:

> Ugh, right!
>
> Then maybe just make IModel#setObject() default too ...
> We will experiment! :)
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Tue, Oct 6, 2015 at 11:27 PM, Michael Mosmann <mi...@mosmann.de>
> wrote:
>
> > .. @IReadOnlyModel: i hope, it will be easier to change then the last
> time
> > i tried it. Watch out for component default model stuff...
> >
> > :)
> >
> > Am 6. Oktober 2015 22:54:37 MESZ, schrieb Martin Grigorov <
> > mgrigorov@apache.org>:
> > >On Tue, Oct 6, 2015 at 10:43 PM, Andrew Geery <an...@gmail.com>
> > >wrote:
> > >
> > >> If IModel were a @FunctionalInterface, then you wouldn't need
> > >something
> > >> like a SupplierModel; you could just use a lambda directly:
> > >>
> > >> new Label("label", () -> "The current time is " + LocalDate.now());
> > >>
> > >
> > >This looks good indeed.
> > >It seems we will add IReadOnlyModel soon!
> > >
> > >
> > >>
> > >> And since IModel is Serializable, the lambda will be too, without
> > >having to
> > >> have an artificial interface that is both Serializable & a Supplier.
> > >>
> > >> Thanks
> > >> Andrew
> > >>
> > >> On Tue, Oct 6, 2015 at 4:21 PM, Martin Grigorov
> > ><mg...@apache.org>
> > >> wrote:
> > >>
> > >> > Same for IRequestHandler#detach()
> > >> >
> > >> > Martin Grigorov
> > >> > Wicket Training and Consulting
> > >> > https://twitter.com/mtgrigorov
> > >> >
> > >> > On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
> > >> > martijn.dashorst@gmail.com> wrote:
> > >> >
> > >> > > Should we use an empty default implementation for IModel#detach?
> > >> > >
> > >> > >
> > >> > > public class IModel<T> extends IDetachable
> > >> > > {
> > >> > >     ...
> > >> > >
> > >> > >     @Override
> > >> > >     default void detach()
> > >> > >     {
> > >> > >     }
> > >> > > }
> > >> > >
> > >> > > This won't break existing applications, but might make it a bit
> > >easier
> > >> > > on the eyes to implement IModel directly.
> > >> > >
> > >> > > I'm not in favor of applying the default method to IDetachable,
> > >> > > because that would defeat the interface's purpose IMO.
> > >> > >
> > >> > > WDYT?
> > >> > >
> > >> > > Martijn
> > >> > >
> > >> >
> > >>
> >
> > --
> > Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
> > gesendet.
>

Re: [wicket8] Use default method for IModel#detach()?

Posted by Martin Grigorov <mg...@apache.org>.
Ugh, right!

Then maybe just make IModel#setObject() default too ...
We will experiment! :)

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Oct 6, 2015 at 11:27 PM, Michael Mosmann <mi...@mosmann.de> wrote:

> .. @IReadOnlyModel: i hope, it will be easier to change then the last time
> i tried it. Watch out for component default model stuff...
>
> :)
>
> Am 6. Oktober 2015 22:54:37 MESZ, schrieb Martin Grigorov <
> mgrigorov@apache.org>:
> >On Tue, Oct 6, 2015 at 10:43 PM, Andrew Geery <an...@gmail.com>
> >wrote:
> >
> >> If IModel were a @FunctionalInterface, then you wouldn't need
> >something
> >> like a SupplierModel; you could just use a lambda directly:
> >>
> >> new Label("label", () -> "The current time is " + LocalDate.now());
> >>
> >
> >This looks good indeed.
> >It seems we will add IReadOnlyModel soon!
> >
> >
> >>
> >> And since IModel is Serializable, the lambda will be too, without
> >having to
> >> have an artificial interface that is both Serializable & a Supplier.
> >>
> >> Thanks
> >> Andrew
> >>
> >> On Tue, Oct 6, 2015 at 4:21 PM, Martin Grigorov
> ><mg...@apache.org>
> >> wrote:
> >>
> >> > Same for IRequestHandler#detach()
> >> >
> >> > Martin Grigorov
> >> > Wicket Training and Consulting
> >> > https://twitter.com/mtgrigorov
> >> >
> >> > On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
> >> > martijn.dashorst@gmail.com> wrote:
> >> >
> >> > > Should we use an empty default implementation for IModel#detach?
> >> > >
> >> > >
> >> > > public class IModel<T> extends IDetachable
> >> > > {
> >> > >     ...
> >> > >
> >> > >     @Override
> >> > >     default void detach()
> >> > >     {
> >> > >     }
> >> > > }
> >> > >
> >> > > This won't break existing applications, but might make it a bit
> >easier
> >> > > on the eyes to implement IModel directly.
> >> > >
> >> > > I'm not in favor of applying the default method to IDetachable,
> >> > > because that would defeat the interface's purpose IMO.
> >> > >
> >> > > WDYT?
> >> > >
> >> > > Martijn
> >> > >
> >> >
> >>
>
> --
> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
> gesendet.

Re: [wicket8] Use default method for IModel#detach()?

Posted by Michael Mosmann <mi...@mosmann.de>.
.. @IReadOnlyModel: i hope, it will be easier to change then the last time i tried it. Watch out for component default model stuff...

:)

Am 6. Oktober 2015 22:54:37 MESZ, schrieb Martin Grigorov <mg...@apache.org>:
>On Tue, Oct 6, 2015 at 10:43 PM, Andrew Geery <an...@gmail.com>
>wrote:
>
>> If IModel were a @FunctionalInterface, then you wouldn't need
>something
>> like a SupplierModel; you could just use a lambda directly:
>>
>> new Label("label", () -> "The current time is " + LocalDate.now());
>>
>
>This looks good indeed.
>It seems we will add IReadOnlyModel soon!
>
>
>>
>> And since IModel is Serializable, the lambda will be too, without
>having to
>> have an artificial interface that is both Serializable & a Supplier.
>>
>> Thanks
>> Andrew
>>
>> On Tue, Oct 6, 2015 at 4:21 PM, Martin Grigorov
><mg...@apache.org>
>> wrote:
>>
>> > Same for IRequestHandler#detach()
>> >
>> > Martin Grigorov
>> > Wicket Training and Consulting
>> > https://twitter.com/mtgrigorov
>> >
>> > On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
>> > martijn.dashorst@gmail.com> wrote:
>> >
>> > > Should we use an empty default implementation for IModel#detach?
>> > >
>> > >
>> > > public class IModel<T> extends IDetachable
>> > > {
>> > >     ...
>> > >
>> > >     @Override
>> > >     default void detach()
>> > >     {
>> > >     }
>> > > }
>> > >
>> > > This won't break existing applications, but might make it a bit
>easier
>> > > on the eyes to implement IModel directly.
>> > >
>> > > I'm not in favor of applying the default method to IDetachable,
>> > > because that would defeat the interface's purpose IMO.
>> > >
>> > > WDYT?
>> > >
>> > > Martijn
>> > >
>> >
>>

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

Re: [wicket8] Use default method for IModel#detach()?

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Oct 6, 2015 at 10:43 PM, Andrew Geery <an...@gmail.com>
wrote:

> If IModel were a @FunctionalInterface, then you wouldn't need something
> like a SupplierModel; you could just use a lambda directly:
>
> new Label("label", () -> "The current time is " + LocalDate.now());
>

This looks good indeed.
It seems we will add IReadOnlyModel soon!


>
> And since IModel is Serializable, the lambda will be too, without having to
> have an artificial interface that is both Serializable & a Supplier.
>
> Thanks
> Andrew
>
> On Tue, Oct 6, 2015 at 4:21 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Same for IRequestHandler#detach()
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
> > martijn.dashorst@gmail.com> wrote:
> >
> > > Should we use an empty default implementation for IModel#detach?
> > >
> > >
> > > public class IModel<T> extends IDetachable
> > > {
> > >     ...
> > >
> > >     @Override
> > >     default void detach()
> > >     {
> > >     }
> > > }
> > >
> > > This won't break existing applications, but might make it a bit easier
> > > on the eyes to implement IModel directly.
> > >
> > > I'm not in favor of applying the default method to IDetachable,
> > > because that would defeat the interface's purpose IMO.
> > >
> > > WDYT?
> > >
> > > Martijn
> > >
> >
>

Re: [wicket8] Use default method for IModel#detach()?

Posted by Andrew Geery <an...@gmail.com>.
If IModel were a @FunctionalInterface, then you wouldn't need something
like a SupplierModel; you could just use a lambda directly:

new Label("label", () -> "The current time is " + LocalDate.now());

And since IModel is Serializable, the lambda will be too, without having to
have an artificial interface that is both Serializable & a Supplier.

Thanks
Andrew

On Tue, Oct 6, 2015 at 4:21 PM, Martin Grigorov <mg...@apache.org>
wrote:

> Same for IRequestHandler#detach()
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
> martijn.dashorst@gmail.com> wrote:
>
> > Should we use an empty default implementation for IModel#detach?
> >
> >
> > public class IModel<T> extends IDetachable
> > {
> >     ...
> >
> >     @Override
> >     default void detach()
> >     {
> >     }
> > }
> >
> > This won't break existing applications, but might make it a bit easier
> > on the eyes to implement IModel directly.
> >
> > I'm not in favor of applying the default method to IDetachable,
> > because that would defeat the interface's purpose IMO.
> >
> > WDYT?
> >
> > Martijn
> >
>

Re: [wicket8] Use default method for IModel#detach()?

Posted by Martin Grigorov <mg...@apache.org>.
Same for IRequestHandler#detach()

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Oct 5, 2015 at 10:42 PM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> Should we use an empty default implementation for IModel#detach?
>
>
> public class IModel<T> extends IDetachable
> {
>     ...
>
>     @Override
>     default void detach()
>     {
>     }
> }
>
> This won't break existing applications, but might make it a bit easier
> on the eyes to implement IModel directly.
>
> I'm not in favor of applying the default method to IDetachable,
> because that would defeat the interface's purpose IMO.
>
> WDYT?
>
> Martijn
>

Re: [wicket8] Use default method for IModel#detach()?

Posted by Sven Meier <sv...@meiers.net>.
+1

Sven

On 05.10.2015 22:42, Martijn Dashorst wrote:
> Should we use an empty default implementation for IModel#detach?
>
>
> public class IModel<T> extends IDetachable
> {
>      ...
>
>      @Override
>      default void detach()
>      {
>      }
> }
>
> This won't break existing applications, but might make it a bit easier
> on the eyes to implement IModel directly.
>
> I'm not in favor of applying the default method to IDetachable,
> because that would defeat the interface's purpose IMO.
>
> WDYT?
>
> Martijn


Re: [wicket8] Use default method for IModel#detach()?

Posted by Andrew Geery <an...@gmail.com>.
Since most models are read-only anyway, how about doing this as well to get
to a Java 8 SAM (modeled after
https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html#remove--):

default void setObject(T T) {
  throw new UnsupportedOperationException();
}

Andrew

On Mon, Oct 5, 2015 at 5:31 PM, Tobias Soloschenko <
tobiassoloschenko@googlemail.com> wrote:

> +1
>
> kind regards
>
> Tobias
>
> Am 05.10.15 um 22:42 schrieb Martijn Dashorst:
>
> Should we use an empty default implementation for IModel#detach?
>>
>>
>> public class IModel<T> extends IDetachable
>> {
>>      ...
>>
>>      @Override
>>      default void detach()
>>      {
>>      }
>> }
>>
>> This won't break existing applications, but might make it a bit easier
>> on the eyes to implement IModel directly.
>>
>> I'm not in favor of applying the default method to IDetachable,
>> because that would defeat the interface's purpose IMO.
>>
>> WDYT?
>>
>> Martijn
>>
>
>

Re: [wicket8] Use default method for IModel#detach()?

Posted by Tobias Soloschenko <to...@googlemail.com>.
+1

kind regards

Tobias

Am 05.10.15 um 22:42 schrieb Martijn Dashorst:
> Should we use an empty default implementation for IModel#detach?
>
>
> public class IModel<T> extends IDetachable
> {
>      ...
>
>      @Override
>      default void detach()
>      {
>      }
> }
>
> This won't break existing applications, but might make it a bit easier
> on the eyes to implement IModel directly.
>
> I'm not in favor of applying the default method to IDetachable,
> because that would defeat the interface's purpose IMO.
>
> WDYT?
>
> Martijn