| hi, Guillaume Smet, I was looking into this one - and I thought that it can be implemented like this:
...
@Constraint(validatedBy = { })
@ReportAsSingleViolation
@Mod11Check(weights = { 8, 9, 2, 3, 4, 5, 6, 7 }, processingDirection = Mod11Check.ProcessingDirection.LEFT_TO_RIGHT)
public @interface REGON9 {
...
So just by adding additional parameter to Mod check (weights), and then simply declaring the annotations for REGON and so on. But the problem that I see is that even though the algorithm seems to be similar to Mod check, for REGON you need to calculate
and for Mod11 it's :
moduloParam - ( sum % moduloParam )
So I don't think that this approach would work for the case of this REGON number, and that a new validator should be written for it, rather than just putting a Mod11Check annotation on the REGON annotation declaration. Most likely this new validator will extend from the Mod11CheckValidator. What do you think ? |