Top Description Inners Methods
org.hibernate.validator.constraints

public @Interface Mod10Check

extends Annotation
Annotations
@Documented
@Constraint
validatedBy:
@Target:METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE
@Retention:RUNTIME
@Repeatable:List
Static Imports
java.lang.annotation.ElementType.ANNOTATION_TYPE, .ElementType.CONSTRUCTOR, .ElementType.FIELD, .ElementType.METHOD, .ElementType.PARAMETER, .ElementType.TYPE_USE, .RetentionPolicy.RUNTIME

@Modulo 10 check constraint.

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.

Authors
George Gastaldi, Hardy Ferentschik, Victor Rezende dos Santos

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static @interface
Mod10Check.List

Defines several @Mod10Check annotations on the same element.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The index of the check digit in the input. Per default it is assumed that the check digit is the last digit of the specified range. If set, the digit at the specified index is used. If set the following must hold true:
checkDigitIndex > 0 && (checkDigitIndex < startIndex || checkDigitIndex >= endIndex.
checkDigitIndex
()

public int

Returns:

the end index (inclusive) for calculating the checksum. If not specified the whole value is considered.
endIndex
()

public Class<?>[]
public boolean

Returns:

Whether non-digit characters in the validated input should be ignored (true) or result in a validation error (false).
ignoreNonDigitCharacters
()

public String
public int

Returns:

The multiplier to be used for odd digits when calculating the Mod10 checksum.
multiplier
()

public Class<? extends Payload>[]
public int

Returns:

the start index (inclusive) for calculating the checksum. If not specified 0 is assumed.
startIndex
()

public int

Returns:

The weight to be used for even digits when calculating the Mod10 checksum.
weight
()

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

checkDigitIndexback to summary
public int checkDigitIndex()
Returns:int

The index of the check digit in the input. Per default it is assumed that the check digit is the last digit of the specified range. If set, the digit at the specified index is used. If set the following must hold true:
checkDigitIndex > 0 && (checkDigitIndex < startIndex || checkDigitIndex >= endIndex.

endIndexback to summary
public int endIndex()
Returns:int

the end index (inclusive) for calculating the checksum. If not specified the whole value is considered.

groupsback to summary
public Class<?>[] groups()
ignoreNonDigitCharactersback to summary
public boolean ignoreNonDigitCharacters()
Returns:boolean

Whether non-digit characters in the validated input should be ignored (true) or result in a validation error (false).

messageback to summary
public String message()
multiplierback to summary
public int multiplier()
Returns:int

The multiplier to be used for odd digits when calculating the Mod10 checksum.

payloadback to summary
public Class<? extends Payload>[] payload()
startIndexback to summary
public int startIndex()
Returns:int

the start index (inclusive) for calculating the checksum. If not specified 0 is assumed.

weightback to summary
public int weight()
Returns:int

The weight to be used for even digits when calculating the Mod10 checksum.

org.hibernate.validator.constraints back to summary

public @Interface Mod10Check.List

extends Annotation
Annotations
@Target:METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE
@Retention:RUNTIME
@Documented

Defines several @Mod10Check annotations on the same element.

Method Summary

Modifier and TypeMethod and Description
public Mod10Check[]
Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public Mod10Check[] value()