org.jarbframework.validation
Class DatabaseConstraintValidator
java.lang.Object
org.jarbframework.validation.DatabaseConstraintValidator
public class DatabaseConstraintValidator
- extends Object
Validates the property values of a bean satisfy our database constraints.
Performed database checks include:
- Not nullable columns cannot have
null values, unless they are generated
- Column length can never be exceeded. (char and number based)
- Fraction length in number column cannot be exceeded
Whenever a database constraint is violated, a constraint violation will be
added for that property. Multiple constraint violations can occur, even on
the same property.
- Since:
- 23-05-2011
- Author:
- Jeroen van Schagen
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DatabaseConstraintValidator
public DatabaseConstraintValidator()
- Construct a new
DatabaseConstraintValidator.
isValid
public boolean isValid(Object bean,
javax.validation.ConstraintValidatorContext validatorContext)
- Determine if a bean follows all column constraints defined in the database.
- Parameters:
bean - the bean that should be validatedvalidatorContext - used to create constraint violations
- Returns:
- whether the bean is valid, or not
setMessageInterpolator
public void setMessageInterpolator(javax.validation.MessageInterpolator messageInterpolator)
setConstraintRepository
public void setConstraintRepository(DatabaseConstraintRepository constraintRepository)
setSchemaMapper
public void setSchemaMapper(SchemaMapper schemaMapper)
Copyright © 2011-2012. All Rights Reserved.