Enum Constant and Description |
---|
AMEX
Amex card type.
|
DINERS_CLUB
Diners club card type.
|
DISCOVER
Discover card type.
|
EMPTY
Empty card type.
|
JCB
Jcb card type.
|
MADA
Mada card type.
|
MAESTRO
Maestro card type.
|
MASTERCARD
Mastercard card type.
|
UNIONPAY
Unionpay card type.
|
UNKNOWN
Unknown card type.
|
VISA
Visa card type.
|
Modifier and Type | Field and Description |
---|---|
private static int[] |
AMEX_SPACE_INDICES |
private static int[] |
DEFAULT_SPACE_INDICES |
private int |
mFrontResource |
private int |
mMaxCardLength |
private int |
mMinCardLength |
private java.util.regex.Pattern |
mPattern |
private java.util.regex.Pattern |
mRelaxedPrefixPattern |
private int |
mSecurityCodeLength |
private int |
mSecurityCodeName |
Modifier and Type | Method and Description |
---|---|
static CardType |
forCardNumber(java.lang.String cardNumber)
Returns the card type matching this account, or
UNKNOWN
for no match. |
private static CardType |
forCardNumberPattern(java.lang.String cardNumber) |
private static CardType |
forCardNumberRelaxedPrefixPattern(java.lang.String cardNumber) |
int |
getFrontResource()
Gets front resource.
|
int |
getMaxCardLength()
Gets max card length.
|
int |
getMinCardLength()
Gets min card length.
|
java.util.regex.Pattern |
getPattern()
Gets pattern.
|
java.util.regex.Pattern |
getRelaxedPrefixPattern()
Gets relaxed prefix pattern.
|
int |
getSecurityCodeLength()
Gets security code length.
|
int |
getSecurityCodeName()
Gets security code name.
|
int[] |
getSpaceIndices()
Get space indices int [ ].
|
static boolean |
isLuhnValid(java.lang.String cardNumber)
Performs the Luhn check on the given card number.
|
boolean |
validate(java.lang.String cardNumber)
Validate boolean.
|
static CardType |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static CardType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final CardType VISA
public static final CardType MASTERCARD
public static final CardType DISCOVER
public static final CardType AMEX
public static final CardType DINERS_CLUB
public static final CardType JCB
public static final CardType MAESTRO
public static final CardType UNIONPAY
public static final CardType UNKNOWN
public static final CardType EMPTY
public static final CardType MADA
private static final int[] AMEX_SPACE_INDICES
private static final int[] DEFAULT_SPACE_INDICES
private final java.util.regex.Pattern mPattern
private final java.util.regex.Pattern mRelaxedPrefixPattern
private final int mFrontResource
private final int mMinCardLength
private final int mMaxCardLength
private final int mSecurityCodeLength
private final int mSecurityCodeName
public static CardType[] values()
for (CardType c : CardType.values()) System.out.println(c);
public static CardType valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static CardType forCardNumber(java.lang.String cardNumber)
UNKNOWN
for no match.
A partial account type may be given, with the caveat that it may not have enough digits to
match.cardNumber
- the card numberprivate static CardType forCardNumberPattern(java.lang.String cardNumber)
private static CardType forCardNumberRelaxedPrefixPattern(java.lang.String cardNumber)
public java.util.regex.Pattern getPattern()
public java.util.regex.Pattern getRelaxedPrefixPattern()
public int getFrontResource()
public int getSecurityCodeName()
public int getSecurityCodeLength()
public int getMinCardLength()
CardType
public int getMaxCardLength()
CardType
public int[] getSpaceIndices()
public static boolean isLuhnValid(java.lang.String cardNumber)
cardNumber
- a String consisting of numeric digits (only).true
if the sequence passes the checksumjava.lang.IllegalArgumentException
- if cardNumber
contained a non-digit (where Character.isDefined(char)
is false
).public boolean validate(java.lang.String cardNumber)
cardNumber
- The card number to validate.true
if this card number is locally valid.