@Documented @Constraint(validatedBy={}) @Target(value={METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE}) @Retention(value=RUNTIME) @Repeatable(value=Mod10Check.List.class) 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 |
java.lang.Class<?>[] |
groups |
boolean |
ignoreNonDigitCharacters |
java.lang.String |
message |
int |
multiplier |
java.lang.Class<? extends javax.validation.Payload>[] |
payload |
int |
startIndex |
int |
weight |
public abstract java.lang.String message
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 © 2007-2022 Red Hat, Inc. All Rights Reserved