Issue Type: New Feature New Feature
Affects Versions: 1.1.0.Beta2
Assignee: Unassigned
Components: spec-general
Created: 30/Nov/12 2:49 AM
Description:

Based on a question on stackoverflow, there seem to be use cases for setting message parameters dynamically, e.g. to put a dynamically determined valid value into the message:

@Future
private Date shippingDate;
public class MyFutureValidator implements ConstraintValidator<Future, Date> {

    public void initialize(Future constraintAnnotation) {}

    public boolean isValid(Date value, ConstraintValidatorContext context) {

        Date now = ...;

        if( value.after( now ) ) {

            context.disableDefaultConstraintViolation();
            context
                .buildConstraintViolationWithTemplate("Must be after {now}")
                .setValue( "now", now )
                .addConstraintViolation();

            return false;
        }

        return true;
    }
}

If we don't find enough time for this, we should at least add an unwrap() method on ConstraintValidatorContext to allow for provider specific implementations.

Project: Bean Validation
Priority: Major Major
Reporter: Gunnar Morling
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira