public interface SmartValidator extends Validator
Validator
interface, adding support for
validation 'hints'.Modifier and Type | Method and Description |
---|---|
void |
validate(java.lang.Object target,
Errors errors,
java.lang.Object... validationHints)
Validate the supplied
target object, which must be of a type of Class
for which the Validator.supports(Class) method typically returns true . |
default void |
validateValue(java.lang.Class<?> targetType,
java.lang.String fieldName,
java.lang.Object value,
Errors errors,
java.lang.Object... validationHints)
Validate the supplied value for the specified field on the target type,
reporting the same validation errors as if the value would be bound to
the field on an instance of the target class.
|
void validate(java.lang.Object target, Errors errors, java.lang.Object... validationHints)
target
object, which must be of a type of Class
for which the Validator.supports(Class)
method typically returns true
.
The supplied errors
instance can be used to report any
resulting validation errors.
This variant of validate()
supports validation hints, such as
validation groups against a JSR-303 provider (in which case, the provided hint
objects need to be annotation arguments of type Class
).
Note: Validation hints may get ignored by the actual target Validator
,
in which case this method should behave just like its regular
Validator.validate(Object, Errors)
sibling.
target
- the object that is to be validatederrors
- contextual state about the validation processvalidationHints
- one or more hint objects to be passed to the validation engineValidator.validate(Object, Class[])
default void validateValue(java.lang.Class<?> targetType, java.lang.String fieldName, @Nullable java.lang.Object value, Errors errors, java.lang.Object... validationHints)
targetType
- the target typefieldName
- the name of the fieldvalue
- the candidate valueerrors
- contextual state about the validation processvalidationHints
- one or more hint objects to be passed to the validation engineValidator.validateValue(Class, String, Object, Class[])