Interface MethodValidationResult
- All Known Implementing Classes:
MethodValidationException
public interface MethodValidationResult
Container for method validation results where underlying
violations
have been adapted to
ParameterValidationResult
each containing a list of
MessageSourceResolvable
grouped by method
parameter.
For @Valid
-annotated, Object method
parameters or return types with cascaded violations, the ParameterErrors
subclass of ParameterValidationResult
implements
Errors
and exposes
field errors
.
- Since:
- 6.1
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptionReturn all validation results.Return only validation results for@Valid
method parameters with cascaded constraints.Returns the set of constraint violations reported during a validation.Return only validation results for method parameters with constraints declared directly on them.void
Check ifgetConstraintViolations()
is empty, and if not, raiseMethodValidationException
.
-
Method Details
-
getConstraintViolations
Set<ConstraintViolation<?>> getConstraintViolations()Returns the set of constraint violations reported during a validation.- Returns:
- the
Set
ofConstraintViolation
s, or an empty Set
-
getAllValidationResults
List<ParameterValidationResult> getAllValidationResults()Return all validation results. This includes method parameters with constraints declared on them, as well as@Valid
method parameters with cascaded constraints.- See Also:
-
getValueResults
List<ParameterValidationResult> getValueResults()Return only validation results for method parameters with constraints declared directly on them. This excludes@Valid
method parameters with cascaded constraints.- See Also:
-
getBeanResults
List<ParameterErrors> getBeanResults()Return only validation results for@Valid
method parameters with cascaded constraints. This excludes method parameters with constraints declared directly on them.- See Also:
-
throwIfViolationsPresent
void throwIfViolationsPresent()Check ifgetConstraintViolations()
is empty, and if not, raiseMethodValidationException
.- Throws:
MethodValidationException
- if the result contains any violations
-