Package io.guise.framework.validator
Class RegularExpressionStringValidator
- java.lang.Object
-
- com.globalmentor.beans.BoundPropertyObject
-
- io.guise.framework.event.GuiseBoundPropertyObject
-
- io.guise.framework.validator.AbstractValidator<V>
-
- io.guise.framework.validator.AbstractRegularExpressionValidator<java.lang.String>
-
- io.guise.framework.validator.RegularExpressionStringValidator
-
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,Validator<java.lang.String>
public class RegularExpressionStringValidator extends AbstractRegularExpressionValidator<java.lang.String>
A string validator that can validate against regular expressions.- Author:
- Garret Wilson
-
-
Field Summary
-
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
-
Fields inherited from interface io.guise.framework.validator.Validator
INVALID_VALUE_MESSAGE_PROPERTY, VALUE_REQUIRED_MESSAGE_PROPERTY, VALUE_REQUIRED_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description RegularExpressionStringValidator(java.lang.String regularExpression)
Constructs a string regular expression validator from a regular expression string, without requiring a non-null
value..RegularExpressionStringValidator(java.lang.String regularExpression, boolean valueRequired)
Constructs a string regular expression validator from a regular expression string.RegularExpressionStringValidator(java.util.regex.Pattern pattern)
Constructs a string regular expression validator from a regular expression pattern, without requiring a non-null
value.RegularExpressionStringValidator(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(java.lang.String value)
Retrieves a string representation of the given value appropriate for error messages.-
Methods inherited from class io.guise.framework.validator.AbstractRegularExpressionValidator
getPattern, validate
-
Methods inherited from class io.guise.framework.validator.AbstractValidator
getInvalidValueMessage, getValueRequiredMessage, isValid, isValueRequired, setInvalidValueMessage, setValueRequired, setValueRequiredMessage, throwInvalidValueValidationException, throwValueRequiredValidationException
-
Methods inherited from class io.guise.framework.event.GuiseBoundPropertyObject
getSession
-
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
-
Methods inherited from interface io.guise.framework.validator.Validator
getSession
-
-
-
-
Constructor Detail
-
RegularExpressionStringValidator
public RegularExpressionStringValidator(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 isnull
.
-
RegularExpressionStringValidator
public RegularExpressionStringValidator(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 isnull
.
-
RegularExpressionStringValidator
public RegularExpressionStringValidator(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 isnull
.
-
RegularExpressionStringValidator
public RegularExpressionStringValidator(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 isnull
.
-
-
Method Detail
-
toString
protected java.lang.String toString(java.lang.String value)
Retrieves a string representation of the given value appropriate for error messages. This implementation returns theObject.toString()
string representation of the value.This version returns the value itself.
- Specified by:
toString
in classAbstractRegularExpressionValidator<java.lang.String>
- Parameters:
value
- The value for which a string representation should be returned.- Returns:
- A string representation of the given value.
-
-