Top Description Inners Methods
org.hibernate.validator.constraints

public @Interface LuhnCheck

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

Luhn algorithm check constraint.

Allows to validate that a series of digits pass the Luhn Modulo 10 checksum algorithm. The Luhn Mod10 is calculated by summing up the digits, with every odd digit (from right to left) value multiplied by 2, if the value is greater than 9 the the result digits a summed before the total summing.

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
LuhnCheck.List

Defines several @LuhnCheck 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 Class<? extends Payload>[]
public int

Returns:

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

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()
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.

org.hibernate.validator.constraints back to summary

public @Interface LuhnCheck.List

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

Defines several @LuhnCheck annotations on the same element.

Method Summary

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

Method Detail

valueback to summary
public LuhnCheck[] value()