Package org.springframework.web.bind
Class MethodArgumentNotValidException
- java.lang.Object
- java.lang.Throwable
- java.lang.Exception
- org.springframework.web.bind.MethodArgumentNotValidException
- All Implemented Interfaces:
Serializable
public class MethodArgumentNotValidException extends Exception
Exception to be thrown when validation on an argument annotated with@Valid
fails.- Since:
- 3.1
- Author:
- Rossen Stoyanchev
- See Also:
- Serialized Form
Constructor Summary
Constructors Constructor Description MethodArgumentNotValidException(MethodParameter parameter, BindingResult bindingResult)
Constructor forMethodArgumentNotValidException
.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BindingResult
getBindingResult()
Return the results of the failed validation.String
getMessage()
MethodParameter
getParameter()
Return the method parameter that failed validation.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Constructor Detail
MethodArgumentNotValidException
public MethodArgumentNotValidException(MethodParameter parameter, BindingResult bindingResult)
Constructor forMethodArgumentNotValidException
.- Parameters:
parameter
- the parameter that failed validationbindingResult
- the results of the validation
Method Detail
getParameter
public MethodParameter getParameter()
Return the method parameter that failed validation.
getBindingResult
public BindingResult getBindingResult()
Return the results of the failed validation.
getMessage
public String getMessage()
- Overrides:
getMessage
in classThrowable