Expose validated bean via ConstraintValidatorContext

Description

In the feedback forum a user suggested to expose the currently validated bean via javax.validation.ConstraintValidatorContext.

IMO that's a good addition as it would people allow to create custom cross-field constraints more easily. I'm not sure whether access should be restricted to the current leaf bean or whether also the root bean should be accessible. In the latter case some methods from ConstraintViolation might just be offered on ConstraintValidatorContext as well:

Another idea would be to have an unwrap() method on ConstraintValidatorContext which would allow for BV providers to expose additional functionality. WDYT?

Environment

None

Assignee

Unassigned

Reporter

Gunnar Morling

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

Priority

Major
Configure