Re: Conditional Annotation based Validation

2009-01-09 Thread Dirk Forchel
Thank you for your good explanation. Nevertheless I'll prefer to do it the Java way 'cos the validation is more complicated than just do some tests for required string properties. Dirk Forchel Greg Lindholm wrote: > > I see what you are asking for, but sorry I'm sure it doesn't exist, there >

Re: Conditional Annotation based Validation

2009-01-09 Thread Greg Lindholm
I see what you are asking for, but sorry I'm sure it doesn't exist, there is no annotation combining logic, each validation annotation has to stand-on-its-own. So to do what you are asking, you couldn't use the @RequiredStringValidator, you would need to use a Expression Validator and combine the

Re: Conditional Annotation based Validation

2009-01-08 Thread Dirk Forchel
Thank you for your posting. I already know how to use the @FieldExpressionValidator and annotations at property level (on setter methods) or how to use the validators with annotations at method level (@Validations for an execute() method). But I did not get it work with the @ExpressionValidator an

Re: Conditional Annotation based Validation

2009-01-08 Thread Greg Lindholm
You can use @FieldExpressionValidator and @ExpressionValidator annotations which allow you to write complex conditions. Here is an example a plucked from my code: @FieldExpressionValidator(expression = "!create || !password.trim().isEmpty()", message = "required", key = ERROR_PASSWORD_REQUIR

Re: Conditional Annotation based Validation

2009-01-07 Thread Dirk Forchel
Finally I followed your advice and use Java-based validation now. I did not get it work with the expression validator via annotations. If somebody knows how to do the following Java-based validation with annotations just let me know: public void validate() { if (privatePerson) {

Re: Conditional Annotation based Validation

2009-01-07 Thread Dave Newton
AFAIK the expression validator is available via annotations. You can also use a custom validator but I find it a little clumsy with annotations. Personally, as soon as validation gets even remotely complicated I fall back to using Java-based validation--I just think it's easier to maintain and