Re: setter on model object not called

2010-05-14 Thread Douglas Ferguson
Yeah as I mentioned previously I am using a Property Model.

I just think it is counter intuitive that the property model would bypass the 
setter and inject the value onto the field
just because there was not getter!

Seems like preferred behavior would be to do one of the following

1) use the setter if there is one, irregardless of whether there is a getter or 
not..
2) throw an error if you try to use a property model and you only have the 
setter but no getter...

D/

On May 13, 2010, at 3:35 AM, Cemal Bayramoglu wrote:

> It sounds like you are using a PropertyModel. If so, that is the
> "expected" behaviour, provided by the property resolver it employs.
> If there is no accessor (getter), the field, even if private is
> accessed (fields[i].setAccessible(true);).
> This is by design, not a bug, but whether it's a good idea or not is
> can be argued. The pragmatic argument for this design decision could
> probably be along the lines of - the model object may not have
> accessors and you may not have control of the code for it (so how do
> you know the private variable exists? And encapsulation?).You could
> end up with an app that runs in development and fails in production if
> Java security management is configured differently.
> So, use with care - in Java "getters" and "setters" are an unfortunate
> fact of life, so prefer having accessors and mutators if you have the
> choice.
> 
> Regards - Cemal
> jWeekend
> OO & Java Technologies, Wicket
> Consulting, Development, Training
> http://jWeekend.com
> 
> 
> On 13 May 2010 08:57, Douglas Ferguson  wrote:
>> I figured it out.
>> 
>> If the object doesn't have a getter, the setter won't be called, and instead 
>> it just injects the value into the field.
>> 
>> That seems like a bug, do I need to prepare a quickstart?
>> 
>> D/
>> 
>> On May 13, 2010, at 2:51 AM, Cemal Bayramoglu wrote:
>> 
>>> Send a QuickStart (simplest one you can create that demonstrates this)
>>> and we'll take a look.
>>> 
>>> Regards - Cemal
>>> jWeekend
>>> OO & Java Technologies, Wicket
>>> Consulting, Development, Training
>>> http://jWeekend.com
>>> 
>>> 
>>> 
>>> On 13 May 2010 08:17, Douglas Ferguson  wrote:
 I am seeing some unexpected behavior.
 
 I have a page with a text field and a link on it.
 The text field is backed with a property model
 The text field has an AjaxFormComponentUpdatingBehavior on it.
 
 The link then persists the object that the property model is wrapping.
 
 I never see the setter get called for the object.
 The setter massages the data. I see the raw data, as entered in the 
 browser, get stored to my db.
 I also never hit my breakpoint int he setter.
 
 D/
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
>>> 
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>> 
>> 
>> 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: setter on model object not called

2010-05-13 Thread Cemal Bayramoglu
It sounds like you are using a PropertyModel. If so, that is the
"expected" behaviour, provided by the property resolver it employs.
If there is no accessor (getter), the field, even if private is
accessed (fields[i].setAccessible(true);).
This is by design, not a bug, but whether it's a good idea or not is
can be argued. The pragmatic argument for this design decision could
probably be along the lines of - the model object may not have
accessors and you may not have control of the code for it (so how do
you know the private variable exists? And encapsulation?).You could
end up with an app that runs in development and fails in production if
Java security management is configured differently.
So, use with care - in Java "getters" and "setters" are an unfortunate
fact of life, so prefer having accessors and mutators if you have the
choice.

 Regards - Cemal
jWeekend
OO & Java Technologies, Wicket
Consulting, Development, Training
http://jWeekend.com


On 13 May 2010 08:57, Douglas Ferguson  wrote:
> I figured it out.
>
> If the object doesn't have a getter, the setter won't be called, and instead 
> it just injects the value into the field.
>
> That seems like a bug, do I need to prepare a quickstart?
>
> D/
>
> On May 13, 2010, at 2:51 AM, Cemal Bayramoglu wrote:
>
>> Send a QuickStart (simplest one you can create that demonstrates this)
>> and we'll take a look.
>>
>> Regards - Cemal
>> jWeekend
>> OO & Java Technologies, Wicket
>> Consulting, Development, Training
>> http://jWeekend.com
>>
>>
>>
>> On 13 May 2010 08:17, Douglas Ferguson  wrote:
>>> I am seeing some unexpected behavior.
>>>
>>> I have a page with a text field and a link on it.
>>> The text field is backed with a property model
>>> The text field has an AjaxFormComponentUpdatingBehavior on it.
>>>
>>> The link then persists the object that the property model is wrapping.
>>>
>>> I never see the setter get called for the object.
>>> The setter massages the data. I see the raw data, as entered in the 
>>> browser, get stored to my db.
>>> I also never hit my breakpoint int he setter.
>>>
>>> D/
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: setter on model object not called

2010-05-13 Thread Douglas Ferguson
I figured it out.

If the object doesn't have a getter, the setter won't be called, and instead it 
just injects the value into the field.

That seems like a bug, do I need to prepare a quickstart?

D/

On May 13, 2010, at 2:51 AM, Cemal Bayramoglu wrote:

> Send a QuickStart (simplest one you can create that demonstrates this)
> and we'll take a look.
> 
> Regards - Cemal
> jWeekend
> OO & Java Technologies, Wicket
> Consulting, Development, Training
> http://jWeekend.com
> 
> 
> 
> On 13 May 2010 08:17, Douglas Ferguson  wrote:
>> I am seeing some unexpected behavior.
>> 
>> I have a page with a text field and a link on it.
>> The text field is backed with a property model
>> The text field has an AjaxFormComponentUpdatingBehavior on it.
>> 
>> The link then persists the object that the property model is wrapping.
>> 
>> I never see the setter get called for the object.
>> The setter massages the data. I see the raw data, as entered in the browser, 
>> get stored to my db.
>> I also never hit my breakpoint int he setter.
>> 
>> D/
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: setter on model object not called

2010-05-13 Thread Cemal Bayramoglu
Send a QuickStart (simplest one you can create that demonstrates this)
and we'll take a look.

Regards - Cemal
jWeekend
OO & Java Technologies, Wicket
Consulting, Development, Training
http://jWeekend.com



On 13 May 2010 08:17, Douglas Ferguson  wrote:
> I am seeing some unexpected behavior.
>
> I have a page with a text field and a link on it.
> The text field is backed with a property model
> The text field has an AjaxFormComponentUpdatingBehavior on it.
>
> The link then persists the object that the property model is wrapping.
>
> I never see the setter get called for the object.
> The setter massages the data. I see the raw data, as entered in the browser, 
> get stored to my db.
> I also never hit my breakpoint int he setter.
>
> D/
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



setter on model object not called

2010-05-13 Thread Douglas Ferguson
I am seeing some unexpected behavior.

I have a page with a text field and a link on it.
The text field is backed with a property model
The text field has an AjaxFormComponentUpdatingBehavior on it.

The link then persists the object that the property model is wrapping.

I never see the setter get called for the object.
The setter massages the data. I see the raw data, as entered in the browser, 
get stored to my db.
I also never hit my breakpoint int he setter.

D/
-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org