Class MethodArgumentNotValidException
- java.lang.Object
- java.lang.Throwable
- java.lang.Exception
- java.lang.RuntimeException
- org.springframework.core.NestedRuntimeException
- org.springframework.messaging.MessagingException
- org.springframework.messaging.handler.invocation.MethodArgumentResolutionException
- org.springframework.messaging.handler.annotation.support.AbstractMethodArgumentResolutionException
- org.springframework.messaging.handler.annotation.support.MethodArgumentNotValidException
- All Implemented Interfaces:
Serializable
public class MethodArgumentNotValidException extends AbstractMethodArgumentResolutionException
Exception to be thrown when a method argument fails validation perhaps as a result of@Valid
style validation, or perhaps because it is required.- Since:
- 4.0.1
- Author:
- Brian Clozel, Rossen Stoyanchev
- See Also:
- Serialized Form
Constructor Summary
Constructors Constructor Description MethodArgumentNotValidException(Message<?> message, MethodParameter parameter)
Create a new instance with the invalidMethodParameter
.MethodArgumentNotValidException(Message<?> message, MethodParameter parameter, BindingResult bindingResult)
Create a new instance with the invalidMethodParameter
and aBindingResult
.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BindingResult
getBindingResult()
Return the BindingResult if the failure is validation-related, ornull
if none.Methods inherited from class org.springframework.messaging.handler.annotation.support.AbstractMethodArgumentResolutionException
getMethodParamMessage
Methods inherited from class org.springframework.messaging.handler.invocation.MethodArgumentResolutionException
getMethodParameter
Methods inherited from class org.springframework.messaging.MessagingException
getFailedMessage, toString
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
Constructor Detail
MethodArgumentNotValidException
public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter)
Create a new instance with the invalidMethodParameter
.
MethodArgumentNotValidException
public MethodArgumentNotValidException(Message<?> message, MethodParameter parameter, BindingResult bindingResult)
Create a new instance with the invalidMethodParameter
and aBindingResult
.
Method Detail
getBindingResult
public final BindingResult getBindingResult()
Return the BindingResult if the failure is validation-related, ornull
if none.