(Available since v1.1)
Requires that a value be a valid Card Number (debit or credit card)
Javadoc Ref :
@CardNumber
Input Types 1 |
Number, CharSequence, byte, int, short, long, double, float |
Output Types |
Same as input |
1Automatic conversion will take place if the provided input does not match any of the input classes, as described in the conversions part of the manual.
allowedTypes |
Array specifying which cards are allowed. The default is an empty array, which is interpreted as allowing any kind of cards. The values of the array must be elements of the CardType enumeration, which contains the card types that are supported and identified by the system. |
ignoreNonDigits |
Whether nondigt characters are ignored. Default is false |
ignoreChars |
Set of characters to ignore. Default is " " (spaces will be ignored) |
message |
Literal message to use if validation fails. |
errorCode |
Error code to use if validation fails. |
messageKey |
Message key to use if validation fails. |
@CardNumber( allowedTypes = { CardType.VISA, CardType.MASTERCARD } )
private String creditCard;
@CardNumber
privte String anyCard;