|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.tzavellas.validation.PropertyValidator<T>
T
- the type (or a parent type) of the propertypublic class PropertyValidator<T>
A class used to validate a JavaBean property.
Nested Class Summary | |
---|---|
static class |
PropertyValidator.Builder<T>
A builder used to create a PropertyValidator |
Field Summary | |
---|---|
protected String |
property
|
Constructor Summary | |
---|---|
PropertyValidator(String property)
This is for the LinkedValidatorBuilder and subclasses. |
|
PropertyValidator(String property,
com.tzavellas.validation.validators.Validator<T> validator,
ValidationError errorMessage)
Construct a PropertyValidator |
Method Summary | |
---|---|
String |
getProperty()
Get the name of the property this validator will validate. |
boolean |
isValid(T value)
Test if the specified property value is valid |
void |
setDefaultErrorMessage(String message)
Modify the default message of the ValidationError this validator returns. |
void |
setErrorCode(String errorCode)
Modify the error code of the ValidationError this validator returns. |
ValidationError |
validate(T value)
Test if the specified property value is valid |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String property
Constructor Detail |
---|
public PropertyValidator(String property)
LinkedValidatorBuilder
and subclasses. If you want to
construct a PropertyValidator
use the other constructor or use/subclass
LinkedValidatorBuilder
.
public PropertyValidator(String property, com.tzavellas.validation.validators.Validator<T> validator, ValidationError errorMessage)
PropertyValidator
property
- the name of the propertyvalidator
- the validator that will validate the property's valueerrorMessage
- the error that will be returned if the validation failsMethod Detail |
---|
public String getProperty()
public boolean isValid(T value)
value
- the value of the property.
public ValidationError validate(T value)
value
- the value of the property.
ValdationError
.public void setErrorCode(String errorCode)
errorCode
- the new error codepublic void setDefaultErrorMessage(String message)
message
- the new default message
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |