SmartValidator class abstract interface

A Validator that can check only the constraints of some validation groups.

Groups let one class carry rules for different situations: an id that must be empty on create and set on update, checks that only run before an order is shipped. BeanValidator is the implementation; applications receive it rather than write one. The framework calls validateWithGroups when @Validated([OnUpdate]) names groups, and so do DataBinder.validate and ValidationUtils.invokeValidator when they are given groups.

// Check only the constraints declared with groups: [OnUpdate].
final errors = BeanPropertyBindingResult(form, 'signup');
validator.validateWithGroups(form, errors, [OnUpdate]);

Spring (Java):

SmartValidator validator = new LocalValidatorFactoryBean();
Errors errors = new BeanPropertyBindingResult(form, "signup");
validator.validate(form, errors, OnUpdate.class);
Implemented types

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
supports(Object target) → bool
Whether this validator knows how to check target; usually a type test such as target is SignupForm.
inherited
toString() → String
A string representation of this object.
inherited
validate(Object target, Errors errors) → void
Checks target and records every problem in errors, with Errors.rejectValue for a field or Errors.reject for the whole object. Records nothing when target is valid; does not throw for invalid data.
inherited
validateWithGroups(Object target, Errors errors, List<Type> groups) → void
Checks target against the constraints of groups only and records the problems in errors.

Operators

operator ==(Object other) → bool
The equality operator.
inherited