public static class Validators.NDigitStringValidator extends Validators.StringTrimmingValidator
CLASS_VERSION
Constructor and Description |
---|
NDigitStringValidator()
Create a new instance.
|
NDigitStringValidator(boolean pRequired,
int pMinDigits,
int pMaxDigits)
Create a new instance.
|
NDigitStringValidator(boolean pRequired,
java.lang.String pErrorCode,
int pMinDigits,
int pMaxDigits)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getMaxDigits()
Returns property maxDigits.
|
int |
getMinDigits()
Returns property minDigits.
|
protected boolean |
lengthOkay(java.lang.String pValue)
Return whether the value of pValue is okay.
|
void |
setMaxDigits(int pMaxDigits)
Sets property maxDigits.
|
void |
setMinDigits(int pMinDigits)
Sets property minDigits.
|
java.lang.String |
validateValue(java.lang.String pPropertyName,
java.lang.Object pPropertyValue,
ValidatorContext<?> pContext)
Validate (and possibly convert) the specified property value.
|
shouldTrim
getMaxLength, setMaxLength
getClassRequired, getRequiredOption, getRequiredPredicate, isRequired, keyMustBePresent, setClassRequired, setRequired, setRequiredOption, setRequiredPredicate
assertAlphanumeric, assertBoolean, assertDateTime, assertDouble, assertInstanceOf, assertInteger, assertLong, assertNotBlankString, assertNotEmpty, assertNotEmpty, assertNotNull, assertNotNull, assertString, assertString, assertString, createInstance, getBeanPropertyValueForValidation, getErrorCode, getNameForClass, getPropertyNames, getPropertyValue, getPropertyValue, hasProperty, isDigits, isRequired, setErrorCode, setPropertyValue, validateBeanProperty
public NDigitStringValidator(boolean pRequired, java.lang.String pErrorCode, int pMinDigits, int pMaxDigits)
pRequired
- whether a non-null value is required.pErrorCode
- the error code to use.pMinDigits
- the minimum number of digits to allow.pMaxDigits
- the maximum number of digits to allow.public NDigitStringValidator()
public NDigitStringValidator(boolean pRequired, int pMinDigits, int pMaxDigits)
pRequired
- whether a non-null value is required.pMinDigits
- the minimum number of digits to allow.pMaxDigits
- the maximum number of digits to allow.public void setMinDigits(int pMinDigits)
public int getMinDigits()
public void setMaxDigits(int pMaxDigits)
public int getMaxDigits()
protected boolean lengthOkay(java.lang.String pValue)
pValue
- the value whose length to check.public java.lang.String validateValue(java.lang.String pPropertyName, java.lang.Object pPropertyValue, ValidatorContext<?> pContext)
Validator
validateValue
in interface Validator<java.lang.String>
validateValue
in class Validators.StringValidator
pPropertyName
- the name of the property being validated. This
is typically used as a key for fetching the value from pProperties.pPropertyValue
- the fetched property valuepContext
- the current validation context.