You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Howard Lewis Ship <hl...@gmail.com> on 2008/06/24 18:54:37 UTC
Required parameters: also not null?
I've been thinking of a change to how component parameters work.
Currently, the required attribute of the Parameter annotation
indicates that a component parameter must be bound (either explicitly,
or to a default). It makes no assurances that it is bound to a
non-null value.
I'm considering changing that, so that there would be a null check
for component parameters that are required, with an immediate failure
if the value bound to a required parameter is null.
The question is: is this a destabilizing change? Has anyone written
components with required parameters that are allowed to be null?
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Required parameters: also not null?
Posted by Kristian Marinkovic <kr...@porsche.co.at>.
don't forget the BeanEditorForm... object may as well be null
"Howard Lewis Ship" <hl...@gmail.com>
25.06.2008 00:06
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>
An
"Tapestry users" <us...@tapestry.apache.org>
Kopie
Thema
Re: Required parameters: also not null?
Working on this now, and there are plenty of cases where a binding is
required but the value may be null; for example, TextField (the value
may initially be null, but must be bound).
On Tue, Jun 24, 2008 at 1:17 PM, Matt Kerr <mr...@gmail.com> wrote:
> the 'value' proposition you mention is forward compatibility, no?
>
> i guess if fwd compatibility is not a concern - sure, do whatever.
>
>
> On Tue, Jun 24, 2008 at 3:23 PM, Howard Lewis Ship <hl...@gmail.com>
wrote:
>> True, my concern is that we'll find that every use of required=true
>> also has acceptNull=false, in which case we add complexity without
>> providing value.
>>
>> On Tue, Jun 24, 2008 at 12:12 PM, Filip S. Adamsen <fs...@fsadev.com>
wrote:
>>> +1 on something like that.
>>>
>>> -Filip
>>>
>>> On 2008-06-24 19:48, Thiago H. de Paula Figueiredo wrote:
>>>>
>>>> Em Tue, 24 Jun 2008 14:32:15 -0300, Matt Kerr <mr...@gmail.com>
>>>> escreveu:
>>>>
>>>>> why not specify whether params allow null - rather than break things
?
>>>>> default to the old behavior.
>>>>>
>>>>> it's not uncommon to have a null param - dunno why it would be
>>>>> different in a component.
>>>>
>>>> Agreed 100%. Required = some value must be given to the parameter.
Not
>>>> null = some not null value must be given. Required != not null.
>>>>
>>>> We could add some like this to @Parameter and support it in
tapestry-core
>>>> easily:
>>>>
>>>> boolean acceptNull() default true;
>>>>
>>>> Then anyone writing components would get the automatic null value
checking
>>>> if wanted or needed without disrupting old code or changing how
parameters
>>>> work.
>>>>
>>>> Thiago
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator Apache Tapestry and Apache HiveMind
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Required parameters: also not null?
Posted by Howard Lewis Ship <hl...@gmail.com>.
Working on this now, and there are plenty of cases where a binding is
required but the value may be null; for example, TextField (the value
may initially be null, but must be bound).
On Tue, Jun 24, 2008 at 1:17 PM, Matt Kerr <mr...@gmail.com> wrote:
> the 'value' proposition you mention is forward compatibility, no?
>
> i guess if fwd compatibility is not a concern - sure, do whatever.
>
>
> On Tue, Jun 24, 2008 at 3:23 PM, Howard Lewis Ship <hl...@gmail.com> wrote:
>> True, my concern is that we'll find that every use of required=true
>> also has acceptNull=false, in which case we add complexity without
>> providing value.
>>
>> On Tue, Jun 24, 2008 at 12:12 PM, Filip S. Adamsen <fs...@fsadev.com> wrote:
>>> +1 on something like that.
>>>
>>> -Filip
>>>
>>> On 2008-06-24 19:48, Thiago H. de Paula Figueiredo wrote:
>>>>
>>>> Em Tue, 24 Jun 2008 14:32:15 -0300, Matt Kerr <mr...@gmail.com>
>>>> escreveu:
>>>>
>>>>> why not specify whether params allow null - rather than break things ?
>>>>> default to the old behavior.
>>>>>
>>>>> it's not uncommon to have a null param - dunno why it would be
>>>>> different in a component.
>>>>
>>>> Agreed 100%. Required = some value must be given to the parameter. Not
>>>> null = some not null value must be given. Required != not null.
>>>>
>>>> We could add some like this to @Parameter and support it in tapestry-core
>>>> easily:
>>>>
>>>> boolean acceptNull() default true;
>>>>
>>>> Then anyone writing components would get the automatic null value checking
>>>> if wanted or needed without disrupting old code or changing how parameters
>>>> work.
>>>>
>>>> Thiago
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator Apache Tapestry and Apache HiveMind
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Required parameters: also not null?
Posted by Matt Kerr <mr...@gmail.com>.
the 'value' proposition you mention is forward compatibility, no?
i guess if fwd compatibility is not a concern - sure, do whatever.
On Tue, Jun 24, 2008 at 3:23 PM, Howard Lewis Ship <hl...@gmail.com> wrote:
> True, my concern is that we'll find that every use of required=true
> also has acceptNull=false, in which case we add complexity without
> providing value.
>
> On Tue, Jun 24, 2008 at 12:12 PM, Filip S. Adamsen <fs...@fsadev.com> wrote:
>> +1 on something like that.
>>
>> -Filip
>>
>> On 2008-06-24 19:48, Thiago H. de Paula Figueiredo wrote:
>>>
>>> Em Tue, 24 Jun 2008 14:32:15 -0300, Matt Kerr <mr...@gmail.com>
>>> escreveu:
>>>
>>>> why not specify whether params allow null - rather than break things ?
>>>> default to the old behavior.
>>>>
>>>> it's not uncommon to have a null param - dunno why it would be
>>>> different in a component.
>>>
>>> Agreed 100%. Required = some value must be given to the parameter. Not
>>> null = some not null value must be given. Required != not null.
>>>
>>> We could add some like this to @Parameter and support it in tapestry-core
>>> easily:
>>>
>>> boolean acceptNull() default true;
>>>
>>> Then anyone writing components would get the automatic null value checking
>>> if wanted or needed without disrupting old code or changing how parameters
>>> work.
>>>
>>> Thiago
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Required parameters: also not null?
Posted by Howard Lewis Ship <hl...@gmail.com>.
True, my concern is that we'll find that every use of required=true
also has acceptNull=false, in which case we add complexity without
providing value.
On Tue, Jun 24, 2008 at 12:12 PM, Filip S. Adamsen <fs...@fsadev.com> wrote:
> +1 on something like that.
>
> -Filip
>
> On 2008-06-24 19:48, Thiago H. de Paula Figueiredo wrote:
>>
>> Em Tue, 24 Jun 2008 14:32:15 -0300, Matt Kerr <mr...@gmail.com>
>> escreveu:
>>
>>> why not specify whether params allow null - rather than break things ?
>>> default to the old behavior.
>>>
>>> it's not uncommon to have a null param - dunno why it would be
>>> different in a component.
>>
>> Agreed 100%. Required = some value must be given to the parameter. Not
>> null = some not null value must be given. Required != not null.
>>
>> We could add some like this to @Parameter and support it in tapestry-core
>> easily:
>>
>> boolean acceptNull() default true;
>>
>> Then anyone writing components would get the automatic null value checking
>> if wanted or needed without disrupting old code or changing how parameters
>> work.
>>
>> Thiago
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Required parameters: also not null?
Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
+1 on something like that.
-Filip
On 2008-06-24 19:48, Thiago H. de Paula Figueiredo wrote:
> Em Tue, 24 Jun 2008 14:32:15 -0300, Matt Kerr <mr...@gmail.com>
> escreveu:
>
>> why not specify whether params allow null - rather than break things ?
>> default to the old behavior.
>>
>> it's not uncommon to have a null param - dunno why it would be
>> different in a component.
>
> Agreed 100%. Required = some value must be given to the parameter. Not
> null = some not null value must be given. Required != not null.
>
> We could add some like this to @Parameter and support it in
> tapestry-core easily:
>
> boolean acceptNull() default true;
>
> Then anyone writing components would get the automatic null value
> checking if wanted or needed without disrupting old code or changing how
> parameters work.
>
> Thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Required parameters: also not null?
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Tue, 24 Jun 2008 14:32:15 -0300, Matt Kerr <mr...@gmail.com>
escreveu:
> why not specify whether params allow null - rather than break things ?
> default to the old behavior.
>
> it's not uncommon to have a null param - dunno why it would be
> different in a component.
Agreed 100%. Required = some value must be given to the parameter. Not
null = some not null value must be given. Required != not null.
We could add some like this to @Parameter and support it in tapestry-core
easily:
boolean acceptNull() default true;
Then anyone writing components would get the automatic null value checking
if wanted or needed without disrupting old code or changing how parameters
work.
Thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Required parameters: also not null?
Posted by Matt Kerr <mr...@gmail.com>.
why not specify whether params allow null - rather than break things ?
default to the old behavior.
it's not uncommon to have a null param - dunno why it would be
different in a component.
On Tue, Jun 24, 2008 at 12:54 PM, Howard Lewis Ship <hl...@gmail.com> wrote:
> I've been thinking of a change to how component parameters work.
>
> Currently, the required attribute of the Parameter annotation
> indicates that a component parameter must be bound (either explicitly,
> or to a default). It makes no assurances that it is bound to a
> non-null value.
>
> I'm considering changing that, so that there would be a null check
> for component parameters that are required, with an immediate failure
> if the value bound to a required parameter is null.
>
> The question is: is this a destabilizing change? Has anyone written
> components with required parameters that are allowed to be null?
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org