@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 |
checkDigitIndex |
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 checkDigitIndex
checkDigitIndex > 0 && (checkDigitIndex < startIndex || checkDigitIndex >= endIndex
.Copyright © 2017 JBoss by Red Hat. All rights reserved.