Class PANValidator

  • All Implemented Interfaces:
    com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Validator<com.globalmentor.iso.idcard.PAN>

    public class PANValidator
    extends AbstractValidator<com.globalmentor.iso.idcard.PAN>
    A validator to validate a Primary Account Number (PAN) of an identification card as defined in ISO/IEC 7812-1:2000(E), "Identification cards - Identification of issuers - Part 1: Numbering system". The validator ensures that the PAN represents one of the allowed ID card products. PANs for unknown products are considered invalid.
    See Also:
    IDCard
    • Constructor Summary

      Constructors 
      Constructor Description
      PANValidator​(boolean valueRequired)
      Value required constructor accepting all known products.
      PANValidator​(boolean valueRequired, com.globalmentor.iso.idcard.Product... validProducts)
      Value required and valid products constructor.
      PANValidator​(com.globalmentor.iso.idcard.Product... validProducts)
      Valid products constructor with no value required.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<com.globalmentor.iso.idcard.Product> getValidProducts()  
      void setValidProducts​(com.globalmentor.iso.idcard.Product... validProducts)
      Sets the PAN products that the validator considers valid.
      void setValidProducts​(java.util.Set<com.globalmentor.iso.idcard.Product> newValidProducts)
      Sets the PAN products that the validator considers valid.
      void validate​(com.globalmentor.iso.idcard.PAN value)
      Checks whether a given value is valid, and throws an exception if not.
      • Methods inherited from class com.globalmentor.beans.BoundPropertyObject

        addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.globalmentor.beans.PropertyBindable

        addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
    • Field Detail

      • VALID_PRODUCTS_PROPERTY

        public static final java.lang.String VALID_PRODUCTS_PROPERTY
        The valid products bound property.
    • Constructor Detail

      • PANValidator

        public PANValidator​(com.globalmentor.iso.idcard.Product... validProducts)
        Valid products constructor with no value required.
        Parameters:
        validProducts - The products that are allowed, if any.
        Throws:
        java.lang.NullPointerException - if the given array of valid products is null.
      • PANValidator

        public PANValidator​(boolean valueRequired)
        Value required constructor accepting all known products.
        Parameters:
        valueRequired - Whether the value must be non-null in order to be considered valid.
      • PANValidator

        public PANValidator​(boolean valueRequired,
                            com.globalmentor.iso.idcard.Product... validProducts)
        Value required and valid products constructor.
        Parameters:
        valueRequired - Whether the value must be non-null in order to be considered valid.
        validProducts - The products that are allowed, if any.
        Throws:
        java.lang.NullPointerException - if the given array of valid products is null.
    • Method Detail

      • getValidProducts

        public java.util.Set<com.globalmentor.iso.idcard.Product> getValidProducts()
        Returns:
        The read-only set of valid products.
      • setValidProducts

        public void setValidProducts​(java.util.Set<com.globalmentor.iso.idcard.Product> newValidProducts)
        Sets the PAN products that the validator considers valid. This is a bound property.
        Parameters:
        newValidProducts - The set of valid products.
        Throws:
        java.lang.NullPointerException - if the given set of valid products is null.
        See Also:
        VALID_PRODUCTS_PROPERTY
      • setValidProducts

        public void setValidProducts​(com.globalmentor.iso.idcard.Product... validProducts)
        Sets the PAN products that the validator considers valid. This is a bound property. This implementation delegates to setValidProducts(Set)
        Parameters:
        validProducts - The products that are allowed, if any.
        Throws:
        java.lang.NullPointerException - if the given array of valid products is null.
        See Also:
        VALID_PRODUCTS_PROPERTY