| @gunnar.morling I just noticed there already is a way to programmatically alter the ConstraintValidator list for a given constraint: implementing a org.hibernate.validator.spi.constraintdefinition.ConstraintDefinitionContributor and registering it through org.hibernate.validator.HibernateValidatorConfiguration.addConstraintDefinitionContributor(ConstraintDefinitionContributor). See for instance org.hibernate.validator.test.constraintvalidator.AcmeConstraintDefinitionContributor. This feature is still experimental and was introduced by Hardy in version 5.2. Maybe this means that this ticket has already been fixed, or is at least in the process of being fixed? I had started implementing an API using org.hibernate.validator.cfg.ConstraintMapping as a starting point (in order to be consistent with the XML file, where constraint=>validator "mappings" are defined under the <constraint-mappings> markup). I guess there's no point working on this, if Hardy's API does the job? |