You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk> on 2004/08/23 18:32:53 UTC
Shortcomings of the IValidator interface
I have some issues with the IValidator interface. Basically, validators are
conversion objects with built-in validation. It is therefore impossible to
hook a validator into a, say, @Upload component, since there's no sensible
way to convert a file between String and Object.
I think Tapestry needs something else than the IValidator - the IVerifier.
The IVerifier would only verify a given object, not try to convert it.
It would be cool if this could be done in a way similar to the IValidator,
so I thought: "Why not extend the IValidator interface?" This would allow us
to tap into the validation delegate and render script contributions.
Any comments?
-Filip
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
RE: Shortcomings of the IValidator interface
Posted by "Filip S. Adamsen" <fi...@stubkjaer-adamsen.dk>.
Okay, I'll make due with the present features for the time being.
> -----Original Message-----
> From: Howard Lewis Ship [mailto:hlship@gmail.com]
> Sent: Thursday, August 26, 2004 3:20 PM
> To: Tapestry development
> Subject: Re: Shortcomings of the IValidator interface
>
> Can't be totally prescient. In fact, even back a couple of years ago,
> there was the desire to split the interface. I would like to, to allow
> you to assemble a sequence of validators.
>
> However, the underlying reason is the desire to limit the number of
> required parameters on the ValidField component.
>
> Slated for 3.1 is a rework of this, to allow validations of some form
> for pretty much any form control component (Checkbox,
> PropertySelection, TextArea, etc.)
>
> I think complexity approach will involve HiveMind.
>
> I'm currently thinking that the validator parameter shouldn't be an
> IValidator instance, it should be the name of a validator instance, a
> bean name that can be looked up in HiveMind ... allowing the validator
> to be shared thoughout the app, it might look something like this:
>
> <component id="inputName" type="TextField">
> <binding name="value" expression="name"/>
> <static-binding name="displayName" value="Name"/>
>
> <static-binding name="validator" value="string,required"/>
>
> </component>
>
> The "string,required" would be sufficient to locate a string validator
> instance. I've been prototyping this approach in my current project.
>
> Once you are on that track, it easier to split the interface as you've
> suggested, and allow for a series of verifiers.
>
> One step at a time, though.
>
>
> On Mon, 23 Aug 2004 18:32:53 +0200, Filip S. Adamsen
> <fi...@stubkjaer-adamsen.dk> wrote:
> > I have some issues with the IValidator interface. Basically, validators
> are
> > conversion objects with built-in validation. It is therefore impossible
> to
> > hook a validator into a, say, @Upload component, since there's no
> sensible
> > way to convert a file between String and Object.
> >
> > I think Tapestry needs something else than the IValidator - the
> IVerifier.
> > The IVerifier would only verify a given object, not try to convert it.
> >
> > It would be cool if this could be done in a way similar to the
> IValidator,
> > so I thought: "Why not extend the IValidator interface?" This would
> allow us
> > to tap into the validation delegate and render script contributions.
> >
> > Any comments?
> >
> > -Filip
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> >
> >
>
>
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Jakarta Tapestry
> Creator, Jakarta HiveMind
> http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
Re: Shortcomings of the IValidator interface
Posted by Howard Lewis Ship <hl...@gmail.com>.
Can't be totally prescient. In fact, even back a couple of years ago,
there was the desire to split the interface. I would like to, to allow
you to assemble a sequence of validators.
However, the underlying reason is the desire to limit the number of
required parameters on the ValidField component.
Slated for 3.1 is a rework of this, to allow validations of some form
for pretty much any form control component (Checkbox,
PropertySelection, TextArea, etc.)
I think complexity approach will involve HiveMind.
I'm currently thinking that the validator parameter shouldn't be an
IValidator instance, it should be the name of a validator instance, a
bean name that can be looked up in HiveMind ... allowing the validator
to be shared thoughout the app, it might look something like this:
<component id="inputName" type="TextField">
<binding name="value" expression="name"/>
<static-binding name="displayName" value="Name"/>
<static-binding name="validator" value="string,required"/>
</component>
The "string,required" would be sufficient to locate a string validator
instance. I've been prototyping this approach in my current project.
Once you are on that track, it easier to split the interface as you've
suggested, and allow for a series of verifiers.
One step at a time, though.
On Mon, 23 Aug 2004 18:32:53 +0200, Filip S. Adamsen
<fi...@stubkjaer-adamsen.dk> wrote:
> I have some issues with the IValidator interface. Basically, validators are
> conversion objects with built-in validation. It is therefore impossible to
> hook a validator into a, say, @Upload component, since there's no sensible
> way to convert a file between String and Object.
>
> I think Tapestry needs something else than the IValidator - the IVerifier.
> The IVerifier would only verify a given object, not try to convert it.
>
> It would be cool if this could be done in a way similar to the IValidator,
> so I thought: "Why not extend the IValidator interface?" This would allow us
> to tap into the validation delegate and render script contributions.
>
> Any comments?
>
> -Filip
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
>
>
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org