does it need a full blown project?
BeanValidator<T> implements IValidator<T>
{
@Dependency
private transient Validator validator;
private final Class< ? > beanClass;
private final String beanProperty;
public BeanValidator(Class< ? > beanClass, String beanProperty)
{
this.beanClass = beanClass;
this.beanProperty = beanProperty;
}
public void validate(IValidatable<T> validatable)
{
Object value = validatable.getValue();
Set< ? > errors = validator.validateValue(beanClass,
beanProperty, value);
for (Object error : errors)
{
ConstraintViolation< ? > violation = (ConstraintViolation<
? >)error;
ValidationError ve = new ValidationError();
ve.setMessage(violation.getMessage());
validatable.error(ve);
}
}
}
-igor
On Tue, Jan 12, 2010 at 5:51 AM, Ophélie Salm <[email protected]> wrote:
> Hi all,
>
> I'm Ophélie @ Zenika !
>
> As the subject states, i've got a few questions regarding the JSR 303 (bean
> validation) integration with wicket. That's something a lot of people at
> Zenika are eager to see evolving from the current "yes, it'd be great!"
> project to a real concrete one. I know it's part of the wicket 1.5 wishlist
> too, so i assume you might be interested as well ;)
>
> To be fair, this idea came up with this blog post :
> http://magnus-k-karlsson.blogspot.com/2009/10/integrate-jsr-303-bean-validation-and.html
> but what we really want first, is to make bean validation available as a form
> Behavior. Although it's still an open discussion.
>
> As i was searching the nabble archive, i noticed that the same subject came
> up regularly, but i can't seem to find an ongoing project. However, i
> stumbled upon the wicketstuff-hibernate-behavior made by Ryan Sonnek, which
> is based on the Hibernate Validator framework. Unfortunately, this project
> has moved to the attic due to lack of updates. So i was thinking about
> starting over with this as a base project or inspiration, then to make it
> fully compatible with wicket 1.4.x and of course the JSR 303.
>
> I know some people already did some blog posts, sharing their own code as an
> answer to the JSR 303 integration, but what we want here, is to make it
> available to a wider audience of wicket users, say, as a wicket stuff
> component first and, why not, as part of wicket core later on.
>
> So, before starting anything, i need to know if someone is already taking
> charge of a similar project ? If not, we're ready to dig into this matter
> here at Zenika. So let me hear some feedback about this idea, what do you
> think ?
>
> Regards.
> --
> Ophélie Salm
> Zenika
> http://www.zenika.com
> http://blog.zenika.com
> http://yeswicket.com
>