// Path: src/main/java/net/andreinc/jbvext/annotations/str/CreditCardType.java
// public enum CreditCardType {
// 
//     AMEX(CreditCardValidator.AMEX),
//     DINERS(CreditCardValidator.DINERS),
//     DISCOVER(CreditCardValidator.DISCOVER),
//     MASTERCARD(CreditCardValidator.MASTERCARD),
//     VISA(CreditCardValidator.VISA),
//     VPAY(CreditCardValidator.VPAY),
//     ALL(
//             CreditCardValidator.AMEX +
//             CreditCardValidator.DINERS +
//             CreditCardValidator.DISCOVER +
//             CreditCardValidator.MASTERCARD +
//             CreditCardValidator.VISA +
//             CreditCardValidator.VPAY
//     );
// 
//     private Long internalValue;
// 
//     CreditCardType(Long internalValue) {
//         this.internalValue = internalValue;
//     }
// 
//     public Long getInternalValue() {
//         return internalValue;
//     }
// }


import net.andreinc.jbvext.annotations.str.CC;
import net.andreinc.jbvext.annotations.str.CreditCardType;
import org.apache.commons.validator.routines.CreditCardValidator;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
package net.andreinc.jbvext.annotations.str.validators;



public class CCValidator implements ConstraintValidator<CC, String> {

    private CC annotation;

    @Override
    public void initialize(CC constraintAnnotation) {
        this.annotation = constraintAnnotation;
    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {

        if (null == value) {
            return false;
        }

        CreditCardType[] types = annotation.value();

// Path: src/main/java/net/andreinc/jbvext/annotations/str/CreditCardType.java
// public enum CreditCardType {
// 
//     AMEX(CreditCardValidator.AMEX),
//     DINERS(CreditCardValidator.DINERS),
//     DISCOVER(CreditCardValidator.DISCOVER),
//     MASTERCARD(CreditCardValidator.MASTERCARD),
//     VISA(CreditCardValidator.VISA),
//     VPAY(CreditCardValidator.VPAY),
//     ALL(
//             CreditCardValidator.AMEX +
//             CreditCardValidator.DINERS +
//             CreditCardValidator.DISCOVER +
//             CreditCardValidator.MASTERCARD +
//             CreditCardValidator.VISA +
//             CreditCardValidator.VPAY
//     );
// 
//     private Long internalValue;
// 
//     CreditCardType(Long internalValue) {
//         this.internalValue = internalValue;
//     }
// 
//     public Long getInternalValue() {
//         return internalValue;
//     }
// }


// Path: src/main/java/net/andreinc/jbvext/annotations/str/validators/CCValidator.java
import net.andreinc.jbvext.annotations.str.CC;
import net.andreinc.jbvext.annotations.str.CreditCardType;
import org.apache.commons.validator.routines.CreditCardValidator;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

package net.andreinc.jbvext.annotations.str.validators;



public class CCValidator implements ConstraintValidator<CC, String> {

    private CC annotation;

    @Override
    public void initialize(CC constraintAnnotation) {
        this.annotation = constraintAnnotation;
    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {

        if (null == value) {
            return false;
        }

        CreditCardType[] types = annotation.value();

        for(CreditCardType creditCardType : types) {