Пример #1
0
        public static IValidator GetByType(ValidatorType type)
        {
            IValidator validator;

            switch (type)
            {
            case ValidatorType.EMPTY:
                validator = new ValidatorEmpty();
                break;

            case ValidatorType.MONTH:
                validator = new ValidatorMonth();
                break;

            case ValidatorType.YEAR:
                validator = new ValidatorYear();
                break;

            case ValidatorType.CVV:
                validator = new ValidatorCvv();
                break;

            case ValidatorType.CREDIT_CARD:
                validator = new ValidatorCreditCard();
                break;

            default:
                validator = new ValidatorEmpty();
                break;
            }
            return(validator);
        }
Пример #2
0
 public static IValidator GetByType(ValidatorType type)
 {
     IValidator validator;
     switch (type) {
         case ValidatorType.EMPTY:
             validator = new ValidatorEmpty();
             break;
         case ValidatorType.MONTH:
             validator = new ValidatorMonth();
             break;
         case ValidatorType.YEAR:
             validator = new ValidatorYear();
             break;
         case ValidatorType.CVV:
             validator = new ValidatorCvv();
             break;
         case ValidatorType.CREDIT_CARD:
             validator = new ValidatorCreditCard();
             break;
         default:
             validator = new ValidatorEmpty();
             break;
     }
     return validator;
 }