nl.knowlogy.validation.validators
Class AllowedValuesValidator
java.lang.Object
nl.knowlogy.validation.validators.BasePropertyValidator
nl.knowlogy.validation.validators.AllowedValuesValidator
- All Implemented Interfaces:
- PropertyValidation
public class AllowedValuesValidator
- extends BasePropertyValidator
Validates if a property contains specific values.
Default the values are separated by ',' .
- Author:
- Robert
AllowedValuesValidator
public AllowedValuesValidator(ClassValidator classValidator,
String propertyName,
String allAllowedValues)
AllowedValuesValidator
public AllowedValuesValidator(ClassValidator classValidator,
String propertyName,
String allAllowedValues,
String errorCode)
AllowedValuesValidator
public AllowedValuesValidator(ClassValidator classValidator,
String propertyName,
String[] allowedValues,
String errorCode)
getDefaultErrorCode
public String getDefaultErrorCode()
- Specified by:
getDefaultErrorCode
in class BasePropertyValidator
- See Also:
BasePropertyValidator.getDefaultErrorCode()
doValidatePropertyValue
public void doValidatePropertyValue(Object toValidate,
Object propertyValue,
Messages messages)
- Description copied from interface:
PropertyValidation
- Validates the property value of object obj. In case of any validation
errors, an they are added to the errors object.
messages
- errors object to which any validation errors are added.- See Also:
nl.knowlogy.validation.metadata.PropertyValidation#doValidatePropertyValue(java.lang.Object,
nl.knowlogy.validation.Messages)
setAllAllowedValues
public void setAllAllowedValues(String allAllowedValues)
- Sets the allowed values of the property. This is a comma seperated string
containing the values.
- Parameters:
allowedValues
- The allowedValues to set.
setAllAllowedValues
public void setAllAllowedValues(String[] allowedValues)
toString
public String toString()
- Overrides:
toString
in class BasePropertyValidator
Copyright © 2007. All Rights Reserved.