Package org.springframework.validation
Interface SmartValidator
- All Superinterfaces:
- Validator
- All Known Implementing Classes:
- CustomValidatorBean,- LocalValidatorFactoryBean,- OptionalValidatorFactoryBean,- SpringValidatorAdapter
Extended variant of the 
Validator interface, adding support for
 validation 'hints'.- Since:
- 3.1
- Author:
- Juergen Hoeller, Sam Brannen
- 
Method SummaryModifier and TypeMethodDescriptiondefault <T> TReturn a contained validator instance of the specified type, unwrapping as far as necessary.voidValidate the suppliedtargetobject, which must be of a type ofClassfor which theValidator.supports(Class)method typically returnstrue.default voidvalidateValue(Class<?> targetType, String fieldName, Object value, Errors errors, 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.Methods inherited from interface org.springframework.validation.Validatorsupports, validate, validateObject
- 
Method Details- 
validateValidate the suppliedtargetobject, which must be of a type ofClassfor which theValidator.supports(Class)method typically returnstrue.The supplied errorsinstance 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 typeClass).Note: Validation hints may get ignored by the actual target Validator, in which case this method should behave just like its regularValidator.validate(Object, Errors)sibling.- Parameters:
- target- the object that is to be validated
- errors- contextual state about the validation process
- validationHints- one or more hint objects to be passed to the validation engine
- See Also:
 
- 
validateValuedefault void validateValue(Class<?> targetType, String fieldName, @Nullable Object value, Errors errors, 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.- Parameters:
- targetType- the target type
- fieldName- the name of the field
- value- the candidate value
- errors- contextual state about the validation process
- validationHints- one or more hint objects to be passed to the validation engine
- Since:
- 5.1
- See Also:
 
- 
unwrapReturn a contained validator instance of the specified type, unwrapping as far as necessary.- Type Parameters:
- T- the type of the object to return
- Parameters:
- type- the class of the object to return
- Returns:
- a validator instance of the specified type; nullif there isn't a nested validator; an exception may be raised if the specified validator type does not match.
- Since:
- 6.1
 
 
-