public class ValidatorImpl extends AbstractValidator
Constructor and Description |
---|
ValidatorImpl()
Default constructor.
|
ValidatorImpl(Configuration conf) |
ValidatorImpl(javax.validation.ValidatorFactory validatorFactory,
javax.persistence.ValidationMode mode)
Type-specific constructor
Returns an Exception if a Validator could not be created.
|
Modifier and Type | Method and Description |
---|---|
void |
addValidationGroup(java.lang.Integer event,
java.lang.Class<?>... validationGroup)
Add a validation group for a specified event.
|
void |
addValidationGroup(java.lang.String validationGroupName,
java.lang.Class<?>... vgs)
Add a validation group for the specific property.
|
void |
addValidationGroup(java.lang.String validationGroupName,
java.lang.String group)
Add the validation group(s) for the specified event.
|
javax.validation.metadata.BeanDescriptor |
getConstraintsForClass(java.lang.Class<?> cls)
Returns the validation constraints for the specified class
|
java.lang.Class<?>[] |
getValidationGroup(java.lang.Integer event)
Return the validation groups to be validated for a specified event
|
boolean |
isValidating(java.lang.Integer event)
Returns whether the Validator is validating for the
specified event.
|
<T> ValidationException |
validate(T arg0,
int event)
Validates a given instance
|
<T> ValidationException |
validateProperty(T arg0,
java.lang.String property,
int event)
Validates a property of a given instance
|
<T> ValidationException |
validateValue(java.lang.Class<T> arg0,
java.lang.String arg1,
java.lang.Object arg2,
int event)
Validates a value based upon the constraints applied to a given class
attribute.
|
<T> boolean |
validating(T arg0,
int event)
Returns whether validation is active for the given event.
|
public ValidatorImpl()
public ValidatorImpl(Configuration conf)
public ValidatorImpl(javax.validation.ValidatorFactory validatorFactory, javax.persistence.ValidationMode mode)
validatorFactory
- Instance of validator factory to use. Specify
null to use the default factory.mode
- ValdiationMode enum valuepublic void addValidationGroup(java.lang.String validationGroupName, java.lang.Class<?>... vgs)
validationGroupName
- vgs
- public void addValidationGroup(java.lang.Integer event, java.lang.Class<?>... validationGroup)
event
- validationGroup
- public void addValidationGroup(java.lang.String validationGroupName, java.lang.String group)
event
- group
- public java.lang.Class<?>[] getValidationGroup(java.lang.Integer event)
event
- Lifecycle event idpublic boolean isValidating(java.lang.Integer event)
event
- the event to check for validationpublic javax.validation.metadata.BeanDescriptor getConstraintsForClass(java.lang.Class<?> cls)
cls
- Class for which constraints to returnpublic <T> ValidationException validate(T arg0, int event)
validate
in interface Validator
validate
in class AbstractValidator
T
- The instance to validatearg0
- The class, of type T to validateevent
- The event idpublic <T> ValidationException validateProperty(T arg0, java.lang.String property, int event)
validateProperty
in interface Validator
validateProperty
in class AbstractValidator
T
- The instance to validatearg0
- The property to validateproperty
- The property to validateevent
- The event idpublic <T> ValidationException validateValue(java.lang.Class<T> arg0, java.lang.String arg1, java.lang.Object arg2, int event)
validateValue
in interface Validator
validateValue
in class AbstractValidator
T
- The instance type to base validation uponarg0
- The class of type T to validatearg1
- The property to validatearg2
- The property value to validateevent
- The event idpublic <T> boolean validating(T arg0, int event)
validating
in interface Validator
validating
in class AbstractValidator
T
- arg0
- Type being validatedevent
- event typeCopyright © 2006-2013 Apache Software Foundation. All Rights Reserved.