We're updating the issue view to help you get more done. 

Support interpolation of dynamically set message parameters

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:

1 2 @Future private Date shippingDate;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 public class MyFutureValidator implements ConstraintValidator<Future, Date> { public void initialize(Future constraintAnnotation) {} public boolean isValid(Date value, ConstraintValidatorContext context) { Date now = ...; if( value.before( 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.

Environment

None

Status

Assignee

Unassigned

Reporter

Gunnar Morling

Labels

None

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

1.1.0.Beta2

Priority

Major