public static class Validators.MapValidator<V> extends Validators.RequiredValidator<java.util.Map<java.lang.String,V>> implements ParentValidator<java.util.Map<java.lang.String,V>>
CLASS_VERSION
Constructor and Description |
---|
MapValidator(boolean pRequired)
Create a new map validator.
|
MapValidator(boolean pRequired,
Validator<? extends V> pValueValidator)
Create a new map validator.
|
MapValidator(java.lang.String pErrorCode,
boolean pRequired)
Create a new map validator.
|
MapValidator(java.lang.String pErrorCode,
boolean pRequired,
Validator<? extends V> pValueValidator)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.Object,Validator<?>> |
getChildValidatorMap()
Return a map form of the child validators, used for generating
a human readable representation of the parent-child relationship.
|
java.util.Collection<? extends Validator<?>> |
getChildValidators()
Get any child validators.
|
java.lang.Object |
getDefaultKeyForChildValidatorMap()
Return the default key for the childValidatorMap, if any.
|
void |
setChildValidatorMap(java.util.Map<?,Validator<?>> pChildMap)
Set the child validator map.
|
java.util.Map<java.lang.String,V> |
validateValue(java.lang.String pPropertyName,
java.lang.Object pPropertyValue,
ValidatorContext<?> pContext)
Validate (and possibly convert) the specified property value.
|
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
validateBeanProperty
public MapValidator(boolean pRequired)
pRequired
- whether a non-null value is required.public MapValidator(boolean pRequired, Validator<? extends V> pValueValidator)
pRequired
- whether a non-null value is required.pValueValidator
- the validator to use to validate every value.public MapValidator(java.lang.String pErrorCode, boolean pRequired)
pErrorCode
- the error code to use in case of error.pRequired
- whether a non-null value is requiredpublic MapValidator(java.lang.String pErrorCode, boolean pRequired, Validator<? extends V> pValueValidator)
pErrorCode
- the error code to use.pRequired
- whether the validator is required.pValueValidator
- the validator to use on the values
of the map.public java.util.Map<java.lang.String,V> validateValue(java.lang.String pPropertyName, java.lang.Object pPropertyValue, ValidatorContext<?> pContext)
Validator
validateValue
in interface Validator<java.util.Map<java.lang.String,V>>
validateValue
in class Validators.RequiredValidator<java.util.Map<java.lang.String,V>>
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.public java.util.Collection<? extends Validator<?>> getChildValidators()
Parentable
getChildValidators
in interface Parentable
public java.util.Map<java.lang.Object,Validator<?>> getChildValidatorMap()
Parentable
getChildValidatorMap
in interface Parentable
public void setChildValidatorMap(java.util.Map<?,Validator<?>> pChildMap)
Parentable
setChildValidatorMap
in interface Parentable
pChildMap
- the child validator map.public java.lang.Object getDefaultKeyForChildValidatorMap()
Parentable
getDefaultKeyForChildValidatorMap
in interface Parentable