Class RegularExpressionCharArrayValidator

  • All Implemented Interfaces:
    com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, Validator<char[]>

    public class RegularExpressionCharArrayValidator
    extends AbstractRegularExpressionValidator<char[]>
    A character array validator that can validate against regular expressions.
    Author:
    Garret Wilson
    • Constructor Summary

      Constructors 
      Constructor Description
      RegularExpressionCharArrayValidator​(java.lang.String regularExpression)
      Constructs a string regular expression validator from a regular expression string, without requiring a non-null value..
      RegularExpressionCharArrayValidator​(java.lang.String regularExpression, boolean valueRequired)
      Constructs a string regular expression validator from a regular expression string.
      RegularExpressionCharArrayValidator​(java.util.regex.Pattern pattern)
      Constructs a string regular expression validator from a regular expression pattern, without requiring a non-null value.
      RegularExpressionCharArrayValidator​(java.util.regex.Pattern pattern, boolean valueRequired)
      Constructs a string regular expression validator from a regular expression pattern.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String toString​(char[] value)
      Retrieves a string representation of the given value appropriate for error messages.
      • 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
    • Constructor Detail

      • RegularExpressionCharArrayValidator

        public RegularExpressionCharArrayValidator​(java.lang.String regularExpression)
        Constructs a string regular expression validator from a regular expression string, without requiring a non-null value..
        Parameters:
        regularExpression - The regular expression against which to validate string values.
        Throws:
        java.lang.NullPointerException - if the given regular expression is null.
      • RegularExpressionCharArrayValidator

        public RegularExpressionCharArrayValidator​(java.lang.String regularExpression,
                                                   boolean valueRequired)
        Constructs a string regular expression validator from a regular expression string.
        Parameters:
        regularExpression - The regular expression against which to validate string values.
        valueRequired - Whether the value must be non-null in order to be considered valid.
        Throws:
        java.lang.NullPointerException - if the given regular expression is null.
      • RegularExpressionCharArrayValidator

        public RegularExpressionCharArrayValidator​(java.util.regex.Pattern pattern)
        Constructs a string regular expression validator from a regular expression pattern, without requiring a non-null value.
        Parameters:
        pattern - The regular expression pattern against which to validate string values.
        Throws:
        java.lang.NullPointerException - if the given regular expression pattern is null.
      • RegularExpressionCharArrayValidator

        public RegularExpressionCharArrayValidator​(java.util.regex.Pattern pattern,
                                                   boolean valueRequired)
        Constructs a string regular expression validator from a regular expression pattern.
        Parameters:
        pattern - The regular expression pattern against which to validate string values.
        valueRequired - Whether the value must be non-null in order to be considered valid.
        Throws:
        java.lang.NullPointerException - if the given regular expression pattern is null.
    • Method Detail

      • toString

        protected java.lang.String toString​(char[] value)
        Retrieves a string representation of the given value appropriate for error messages. This implementation returns the Object.toString() string representation of the value.

        This version a string with the given characters or null if the character array is null.

        Specified by:
        toString in class AbstractRegularExpressionValidator<char[]>
        Parameters:
        value - The value for which a string representation should be returned.
        Returns:
        A string representation of the given value.