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

Make @Mod10Check and @Mod11Check constraints usable via API

Description

The constraints @Mod10Check and @Mod11Check should be usable via the API for programmatic constraint declaration.

For each constraint we have a corresponding definition type which allows to configure that constraint via the API in a type-safe manner (actually it was missing for @ModCheck).

We need Mod10CheckDef and Mod11CheckDef; E.g. @Mod11Check would then be used like this:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 HibernateValidatorConfiguration configuration = Validation .byProvider( HibernateValidator.class ).configure(); ConstraintMapping constraintMapping = configuration.createConstraintMapping(); constraintMapping .type( Book.class ) .property( "isbn", FIELD ) .constraint( new Mod11CheckDef() .multiplier( 10 ) .checkDigitPosition( 9 ) .endIndex( 9 ) .treatCheck10As( 'X' ) ); Validator validator = configuration .addMapping( constraintMapping ) .buildValidatorFactory() .getValidator();

Environment

None

Status

Assignee

Unassigned

Reporter

Gunnar Morling

Components

Fix versions

Affects versions

5.1.0.Alpha1

Priority

Major