com.opensymphony.xwork2.validator.validators

## Class CreditCardValidator

- java.lang.Object
- - com.opensymphony.xwork2.validator.validators.ValidatorSupport
  - - com.opensymphony.xwork2.validator.validators.FieldValidatorSupport
    - - com.opensymphony.xwork2.validator.validators.RegexFieldValidator
      - - com.opensymphony.xwork2.validator.validators.CreditCardValidator

- All Implemented Interfaces:
    FieldValidator, ShortCircuitableValidator, Validator

      public class CreditCardValidator
      extends RegexFieldValidator

  CreditCardFieldValidator checks that a given String/Array/Collection field, if not empty, is a valid credit card number.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CREDIT_CARD_PATTERN`

    - ### Fields inherited from class com.opensymphony.xwork2.validator.validators.FieldValidatorSupport

      `currentValue, fieldName, type`

    - ### Fields inherited from class com.opensymphony.xwork2.validator.validators.ValidatorSupport

      `defaultMessage, EMPTY_STRING, messageKey, stack, textProviderFactory`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CreditCardValidator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `validateFieldValue(Object object, String value, String regexToUse)`

    - ### Methods inherited from class com.opensymphony.xwork2.validator.validators.RegexFieldValidator

      `getRegex, isCaseSensitive, isTrimed, setCaseSensitive, setCaseSensitiveExpression, setRegex, setRegexExpression, setTrim, setTrimExpression, validate`

    - ### Methods inherited from class com.opensymphony.xwork2.validator.validators.FieldValidatorSupport

      `getCurrentValue, getFieldName, getValidatorType, setFieldName, setValidatorType`

    - ### Methods inherited from class com.opensymphony.xwork2.validator.validators.ValidatorSupport

      `addActionError, addFieldError, getDefaultMessage, getFieldValue, getMessage, getMessageKey, getMessageParameters, getValidatorContext, isShortCircuit, parse, setDefaultMessage, setMessageKey, setMessageParameters, setShortCircuit, setTextProviderFactory, setValidatorContext, setValueStack`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.opensymphony.xwork2.validator.Validator

      `getDefaultMessage, getMessage, getMessageKey, getMessageParameters, getValidatorContext, setDefaultMessage, setMessageKey, setMessageParameters, setValidatorContext, setValueStack`

- - ### Field Detail

    - #### CREDIT_CARD_PATTERN

          public static final String CREDIT_CARD_PATTERN

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CreditCardValidator

          public CreditCardValidator()

  - ### Method Detail

    - #### validateFieldValue

          protected void validateFieldValue(Object object,
                                            String value,
                                            String regexToUse)

      Overrides:
        `validateFieldValue` in class `RegexFieldValidator`

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.