Class ParameterValidationResult
java.lang.Object
org.springframework.validation.beanvalidation.ParameterValidationResult
- Direct Known Subclasses:
ParameterErrors
Store and expose the results of method validation via
Validator
for a specific method parameter.
- For a constraints directly on a method parameter, each
ConstraintViolation
is adapted toMessageSourceResolvable
. - For cascaded constraints via
@Valid
on a bean method parameter,SpringValidatorAdapter
is used to initialize anErrors
with field errors, and create theParameterErrors
sub-class.
- Since:
- 6.1
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ConstructorDescriptionParameterValidationResult
(MethodParameter methodParameter, Object argument, Collection<? extends MessageSourceResolvable> resolvableErrors, Collection<ConstraintViolation<Object>> violations) Create aParameterValidationResult
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
The method argument value that was validated.The method parameter the validation results are for.List ofMessageSourceResolvable
representations adapted from the underlyingviolations
.The violations associated with the method parameter, in the same order asgetResolvableErrors()
.int
hashCode()
toString()
-
Constructor Details
-
ParameterValidationResult
public ParameterValidationResult(MethodParameter methodParameter, @Nullable Object argument, Collection<? extends MessageSourceResolvable> resolvableErrors, Collection<ConstraintViolation<Object>> violations) Create aParameterValidationResult
.
-
-
Method Details
-
getMethodParameter
The method parameter the validation results are for. -
getArgument
The method argument value that was validated. -
getResolvableErrors
List ofMessageSourceResolvable
representations adapted from the underlyingviolations
.- For a constraints directly on a method parameter, error codes are
based on the names of the constraint annotation, the object, the method,
the parameter, and parameter type, e.g.
["Max.myObject#myMethod.myParameter", "Max.myParameter", "Max.int", "Max"]
. Arguments include the parameter itself as aMessageSourceResolvable
, e.g.["myObject#myMethod.myParameter", "myParameter"]
, followed by actual constraint annotation attributes (i.e. excluding "message", "groups" and "payload") in alphabetical order of attribute names. - For cascaded constraints via
@Valid
on a bean method parameter, this method returnsfield errors
that you can also access more conveniently through methods of theParameterErrors
sub-class.
- For a constraints directly on a method parameter, error codes are
based on the names of the constraint annotation, the object, the method,
the parameter, and parameter type, e.g.
-
getViolations
The violations associated with the method parameter, in the same order asgetResolvableErrors()
. -
equals
-
hashCode
public int hashCode() -
toString
-