public static class Validators.OptionValidator<T> extends Validators.RequiredValidator<T>
CLASS_VERSION| Constructor and Description |
|---|
OptionValidator()
Create a new instance.
|
OptionValidator(java.util.Set<T> pOptions)
Create a new instance.
|
OptionValidator(java.util.Set<T> pOptions,
java.lang.Class<? extends T> pClass)
Create a new instance.
|
OptionValidator(java.lang.String pErrorCode,
boolean pRequired,
java.util.Set<T> pOptions)
Create a new instance.
|
OptionValidator(java.lang.String pErrorCode,
boolean pRequired,
java.util.Set<T> pOptions,
java.lang.Class<T> pClass)
Create a new instance.
|
OptionValidator(java.lang.String pErrorCode,
java.util.Set<T> pOptions)
Create a new instance.
|
OptionValidator(java.lang.String pErrorCode,
java.util.Set<T> pOptions,
java.lang.Class<T> pClass)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
getBeanPropertyValueForValidation(java.lang.Object pBean,
java.lang.String pPropertyName)
Get the bean property value for update.
|
java.util.Set<T> |
getOptions()
Return the set of valid options.
|
java.lang.Object |
getOptionsAsArrayOrCollection()
Returns property optionsAsArrayOrCollection.
|
java.lang.String[] |
getPreferredOptionalSourcePropertyNames()
Returns property preferredOptionalSourcePropertyNames.
|
void |
setOptions(java.util.Set<T> pOptions) |
void |
setOptionsAsArrayOrCollection(java.lang.Object pOptionsAsArrayOrCollection)
Sets property optionsAsArrayOrCollection.
|
void |
setPreferredOptionalSourcePropertyNames(java.lang.String[] pPreferredOptionalSourcePropertyNames)
Sets property preferredOptionalSourcePropertyNames.
|
T |
validateValue(java.lang.String pPropertyName,
java.lang.Object pPropertyValue,
ValidatorContext<?> pContext)
Validate (and possibly convert) the specified property value.
|
getClassesRequired, getClassRequired, getRequiredOption, getRequiredPredicate, isRequired, isSourceOnly, keyMustBePresent, setClassesRequired, setClassRequired, setRequired, setRequiredOption, setRequiredPredicate, setSourceOnlyassertAlphanumeric, assertBoolean, assertDateTime, assertDouble, assertInstanceOf, assertInstanceOf, assertInteger, assertInteger, assertLong, assertNotBlankString, assertNotEmpty, assertNotEmpty, assertNotNull, assertNotNull, assertString, assertString, assertString, assertUnicodeAlphanumeric, createInstance, createInstance, getCheckedBeanPropertyValueForValidation, getErrorCode, getNameForClass, getNameForClasses, getParentValidator, getPropertyNames, getPropertyValue, getPropertyValue, hasProperty, isDigits, isRequired, setErrorCode, setParentValidator, setPropertyValue, validateBeanPropertyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetErrorCode, setErrorCodevalidateBeanPropertypublic OptionValidator()
public OptionValidator(java.util.Set<T> pOptions, java.lang.Class<? extends T> pClass)
pOptions - the set of available optionspClass - the required class, if any.public OptionValidator(java.util.Set<T> pOptions)
pOptions - the set of available optionspublic OptionValidator(java.lang.String pErrorCode,
java.util.Set<T> pOptions)
pOptions - the set of available optionspErrorCode - the error code to report on failurepublic OptionValidator(java.lang.String pErrorCode,
java.util.Set<T> pOptions,
java.lang.Class<T> pClass)
pOptions - the set of available optionspErrorCode - the error code to report on failurepClass - the required class, if any.public OptionValidator(java.lang.String pErrorCode,
boolean pRequired,
java.util.Set<T> pOptions,
java.lang.Class<T> pClass)
pOptions - the set of available optionspRequired - whether a non-null vpErrorCode - the error code to report on failurepClass - the required class, if any.public OptionValidator(java.lang.String pErrorCode,
boolean pRequired,
java.util.Set<T> pOptions)
pOptions - the set of available optionspErrorCode - the error code to report on failurepRequired - whether a non-null value is required.public void setPreferredOptionalSourcePropertyNames(java.lang.String[] pPreferredOptionalSourcePropertyNames)
public java.lang.String[] getPreferredOptionalSourcePropertyNames()
public java.util.Set<T> getOptions()
public void setOptions(java.util.Set<T> pOptions)
public void setOptionsAsArrayOrCollection(java.lang.Object pOptionsAsArrayOrCollection)
public java.lang.Object getOptionsAsArrayOrCollection()
public T validateValue(java.lang.String pPropertyName, java.lang.Object pPropertyValue, ValidatorContext<?> pContext)
ValidatorvalidateValue in interface Validator<T>validateValue in class Validators.RequiredValidator<T>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.protected java.lang.Object getBeanPropertyValueForValidation(java.lang.Object pBean,
java.lang.String pPropertyName)
throws PropertyNotFoundException
Validators.ValidatorImplgetBeanPropertyValueForValidation in class Validators.ValidatorImpl<T>pBean - the bean to get the property value frompPropertyName - the name of the property whose value should be fetched.PropertyNotFoundException