Interface ValidatingBean
public interface ValidatingBean
Implemented by
FieldBuilder
target bean classes that want to apply some bean-level validation logic themselves.
If a FieldBuilder
's target bean type implements this interface, then the FieldBuilder
will automatically
add a bean-level validation check by way of validateBean()
.
This class is a simpler, non-JSR 303 alternative to WholeBeanValidator
.
This is a bean-level validator, so any Binder
using this validator will need access to an actual bean in order
to validate (e.g., via Binder.setBean()
, Binder.writeBean()
,
Binder.writeBeanIfValid()
, etc.), otherwise you'll get an IllegalStateException
with bean level validators have been configured but no bean is currently set.
-
Method Summary
Modifier and TypeMethodDescriptionvalidateBean
(ValueContext context) Apply bean-level validation to this bean instance.
-
Method Details
-
validateBean
Apply bean-level validation to this bean instance.- Parameters:
context
- the value context for validation- Returns:
- the validation result
-