@Documented @Constraint(validatedBy={}) @Target(value={METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER}) @Retention(value=RUNTIME) public @interface Mod10Check
Allows to validate that a series of digits pass the Mod10 checksum
algorithm. The classic Mod10 is calculated by summing up the digits, with every odd
digit (from right to left) value multiplied by a multiplier.
As example ISBN-13 is Modulo 10 checksum with multiplier = 3.
There are known cases of codes using multipliers for both even and odd
digits; To support this kind of implementations the Mod10 constraint uses the
weight option, which has the same effect as the multiplier but for even
numbers.
The supported type is CharSequence. null is considered valid.
| Modifier and Type | Optional Element and Description |
|---|---|
int |
checkDigitPosition |
int |
endIndex |
Class<?>[] |
groups |
boolean |
ignoreNonDigitCharacters |
String |
message |
int |
multiplier |
Class<? extends Payload>[] |
payload |
int |
startIndex |
int |
weight |
public abstract String message
public abstract Class<?>[] groups
public abstract int multiplier
public abstract int weight
public abstract int startIndex
public abstract int endIndex
public abstract int checkDigitPosition
checkDigitPosition > 0 && (checkDigitPosition < startIndex || checkDigitPosition >= endIndex.public abstract boolean ignoreNonDigitCharacters
true) or result in a
validation error (false). Note that the values given for startIndex, endIndex
and checkDigitPosition need to take into account either digits only or all characters depending
on the setting of this option.Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved