Package org.datanucleus
Class BeanValidationHandler
- java.lang.Object
-
- org.datanucleus.BeanValidationHandler
-
public class BeanValidationHandler extends java.lang.Object
Handles the integration of "javax.validation" Bean Validation API (JSR 303). Note that this is the only class referring to BeanValidation classes so that it is usable in environments without BeanValidation present.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
BeanValidationHandler.PersistenceTraversalResolver
Resolver for traversal of validation.
-
Field Summary
Fields Modifier and Type Field Description (package private) ClassLoaderResolver
clr
(package private) Configuration
conf
(package private) javax.validation.Validator
validator
-
Constructor Summary
Constructors Constructor Description BeanValidationHandler(ExecutionContext ec, java.lang.Object validatorFactory)
Constructor for a validation handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
private java.lang.Class<?>[]
getGroups(java.lang.String property, java.lang.String eventName)
Parse comma separated string of class names and return a corresponding array of classesvoid
preDelete(java.lang.Object pc)
void
prePersist(java.lang.Object pc)
void
preStore(java.lang.Object pc)
void
validate(java.lang.Object pc, java.lang.String callbackName, java.lang.Class<?>[] groups)
Validate the constraints of an object
-
-
-
Field Detail
-
validator
javax.validation.Validator validator
-
clr
ClassLoaderResolver clr
-
conf
Configuration conf
-
-
Constructor Detail
-
BeanValidationHandler
public BeanValidationHandler(ExecutionContext ec, java.lang.Object validatorFactory)
Constructor for a validation handler.- Parameters:
ec
- ExecutionContext that we are persisting invalidatorFactory
- Validation factory
-
-
Method Detail
-
close
public void close()
-
validate
public void validate(java.lang.Object pc, java.lang.String callbackName, java.lang.Class<?>[] groups)
Validate the constraints of an object- Parameters:
pc
- the objectcallbackName
- Name of the callbackgroups
- the validation groups
-
preDelete
public void preDelete(java.lang.Object pc)
-
preStore
public void preStore(java.lang.Object pc)
-
prePersist
public void prePersist(java.lang.Object pc)
-
getGroups
private java.lang.Class<?>[] getGroups(java.lang.String property, java.lang.String eventName)
Parse comma separated string of class names and return a corresponding array of classes- Parameters:
property
- the string with comma separated class names- Returns:
- The groups
-
-