Class CountryAwareAddressValidator

  • All Implemented Interfaces:
    org.springframework.validation.Validator

    public class CountryAwareAddressValidator
    extends java.lang.Object
    implements org.springframework.validation.Validator
    Implementation of Validator that validate instances of AddressData.

    The CountryAwareAddressValidator does not validate all fields itself, but delegates to other Validators countrySpecificAddressValidators. AddressValidator uses the country.isocode field to select a suitable validator for a specific country. If a matching validator cannot be found, commonAddressValidator is used.

    • Constructor Detail

      • CountryAwareAddressValidator

        public CountryAwareAddressValidator()
    • Method Detail

      • supports

        public boolean supports​(java.lang.Class clazz)
        Specified by:
        supports in interface org.springframework.validation.Validator
      • validate

        public void validate​(java.lang.Object target,
                             org.springframework.validation.Errors errors)
        Specified by:
        validate in interface org.springframework.validation.Validator
      • getCommonAddressValidator

        public org.springframework.validation.Validator getCommonAddressValidator()
      • setCommonAddressValidator

        public void setCommonAddressValidator​(org.springframework.validation.Validator commonAddressValidator)
      • getCountrySpecificAddressValidators

        public java.util.Map<java.lang.String,​org.springframework.validation.Validator> getCountrySpecificAddressValidators()
      • setCountrySpecificAddressValidators

        public void setCountrySpecificAddressValidators​(java.util.Map<java.lang.String,​org.springframework.validation.Validator> customAddressValidators)