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(Integer event,
Class<?>... validationGroup)
Add a validation group for a specified event.
|
void |
addValidationGroup(String validationGroupName,
Class<?>... vgs)
Add a validation group for the specific property.
|
void |
addValidationGroup(String validationGroupName,
String group)
Add the validation group(s) for the specified event.
|
javax.validation.metadata.BeanDescriptor |
getConstraintsForClass(Class<?> cls)
Returns the validation constraints for the specified class
|
Class<?>[] |
getValidationGroup(Integer event)
Return the validation groups to be validated for a specified event
|
boolean |
isValidating(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,
String property,
int event)
Validates a property of a given instance
|
<T> ValidationException |
validateValue(Class<T> arg0,
String arg1,
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(String validationGroupName, Class<?>... vgs)
validationGroupName
- vgs
- public void addValidationGroup(Integer event, Class<?>... validationGroup)
event
- validationGroup
- public void addValidationGroup(String validationGroupName, String group)
event
- group
- public Class<?>[] getValidationGroup(Integer event)
event
- Lifecycle event idpublic boolean isValidating(Integer event)
event
- the event to check for validationpublic javax.validation.metadata.BeanDescriptor getConstraintsForClass(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, 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(Class<T> arg0, String arg1, 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–2022 Apache Software Foundation. All rights reserved.