You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ricky <ri...@gmail.com> on 2008/10/20 15:37:55 UTC
setObject( ), getObject( )
Hi,
Is there any reason getObject and setObject were not made final in Model
class? the reason why i am asking is that there might be the case when
people misuse this; for example (and i have seen this at my current
workplace);
Model xModel = new Model(new Long(1)) {
@Override
public Object getObject() {
// return super.getObject(); <-- not calling this, instead i
return null
return null;
}
};
// some lines afterwards ... i need this model ... i use it
(expecting to get back object i set)
// instead i get null. Original intent was to set object passed in
and get the same thing ...
System.out.println(xModel.getObject());
Here i get null as the result.
Any suggestions?
Regards
Vyas, Anirudh
Re: setObject( ), getObject( )
Posted by James Carman <ja...@carmanconsulting.com>.
On Mon, Oct 20, 2008 at 11:02 AM, Igor Vaynberg <ig...@gmail.com> wrote:
> whenever there is something nonfinal people will always find a way to misuse it.
>
> model methods are not final because it gives you a simple base class
> to subclass instead of starting from scratch with an imodel.
Right. I've done this before myself. So, -1 (non-binding of course)
from me for making Model final (or making the methods final).
Besides, it breaks binary compatibility.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: setObject( ), getObject( )
Posted by Scott Swank <sc...@gmail.com>.
However setObject() doesn't work as well on AbstractReadOnlyModel as
it does on Model, which is particularly important for immutable
backing objects such as Strings.
On Tue, Oct 21, 2008 at 2:35 AM, Johan Compagner <jc...@gmail.com> wrote:
> we have also AbstractReadOnlyModel for that
> so igor are you sure you dont want to have Model final? :)
>
>
> On Mon, Oct 20, 2008 at 5:02 PM, Igor Vaynberg <ig...@gmail.com>wrote:
>
>> whenever there is something nonfinal people will always find a way to
>> misuse it.
>>
>> model methods are not final because it gives you a simple base class
>> to subclass instead of starting from scratch with an imodel.
>>
>> -igor
>>
>> On Mon, Oct 20, 2008 at 6:37 AM, Ricky <ri...@gmail.com> wrote:
>> > Hi,
>> >
>> > Is there any reason getObject and setObject were not made final in Model
>> > class? the reason why i am asking is that there might be the case when
>> > people misuse this; for example (and i have seen this at my current
>> > workplace);
>> >
>> > Model xModel = new Model(new Long(1)) {
>> >
>> > @Override
>> > public Object getObject() {
>> > // return super.getObject(); <-- not calling this, instead
>> i
>> > return null
>> > return null;
>> > }
>> > };
>> >
>> > // some lines afterwards ... i need this model ... i use it
>> > (expecting to get back object i set)
>> > // instead i get null. Original intent was to set object passed in
>> > and get the same thing ...
>> > System.out.println(xModel.getObject());
>> >
>> > Here i get null as the result.
>> >
>> > Any suggestions?
>> >
>> > Regards
>> > Vyas, Anirudh
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: setObject( ), getObject( )
Posted by Johan Compagner <jc...@gmail.com>.
we have also AbstractReadOnlyModel for that
so igor are you sure you dont want to have Model final? :)
On Mon, Oct 20, 2008 at 5:02 PM, Igor Vaynberg <ig...@gmail.com>wrote:
> whenever there is something nonfinal people will always find a way to
> misuse it.
>
> model methods are not final because it gives you a simple base class
> to subclass instead of starting from scratch with an imodel.
>
> -igor
>
> On Mon, Oct 20, 2008 at 6:37 AM, Ricky <ri...@gmail.com> wrote:
> > Hi,
> >
> > Is there any reason getObject and setObject were not made final in Model
> > class? the reason why i am asking is that there might be the case when
> > people misuse this; for example (and i have seen this at my current
> > workplace);
> >
> > Model xModel = new Model(new Long(1)) {
> >
> > @Override
> > public Object getObject() {
> > // return super.getObject(); <-- not calling this, instead
> i
> > return null
> > return null;
> > }
> > };
> >
> > // some lines afterwards ... i need this model ... i use it
> > (expecting to get back object i set)
> > // instead i get null. Original intent was to set object passed in
> > and get the same thing ...
> > System.out.println(xModel.getObject());
> >
> > Here i get null as the result.
> >
> > Any suggestions?
> >
> > Regards
> > Vyas, Anirudh
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: setObject( ), getObject( )
Posted by Igor Vaynberg <ig...@gmail.com>.
whenever there is something nonfinal people will always find a way to misuse it.
model methods are not final because it gives you a simple base class
to subclass instead of starting from scratch with an imodel.
-igor
On Mon, Oct 20, 2008 at 6:37 AM, Ricky <ri...@gmail.com> wrote:
> Hi,
>
> Is there any reason getObject and setObject were not made final in Model
> class? the reason why i am asking is that there might be the case when
> people misuse this; for example (and i have seen this at my current
> workplace);
>
> Model xModel = new Model(new Long(1)) {
>
> @Override
> public Object getObject() {
> // return super.getObject(); <-- not calling this, instead i
> return null
> return null;
> }
> };
>
> // some lines afterwards ... i need this model ... i use it
> (expecting to get back object i set)
> // instead i get null. Original intent was to set object passed in
> and get the same thing ...
> System.out.println(xModel.getObject());
>
> Here i get null as the result.
>
> Any suggestions?
>
> Regards
> Vyas, Anirudh
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org