Package org.springframework.validation.method

# Class MethodValidationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.validation.method.MethodValidationException

All Implemented Interfaces:
  `Serializable`, `MethodValidationResult`

public class MethodValidationException extends RuntimeException implements MethodValidationResult
Exception that is a `MethodValidationResult`.

Since:
  6.1
Author:
  Rossen Stoyanchev
See Also:
  - `MethodValidator`
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`MethodValidationException(MethodValidationResult validationResult)`

## Method Summary

Modifier and Type
Method
Description
`List<MessageSourceResolvable>`
`getCrossParameterValidationResults()`
Return errors from cross-parameter validation.
`Method`
`getMethod()`
Return the method to which validation was applied.
`List<ParameterValidationResult>`
`getParameterValidationResults()`
Return all validation results per method parameter, including both `MethodValidationResult.getValueResults()` and `MethodValidationResult.getBeanResults()`.
`Object`
`getTarget()`
Return the target of the method invocation to which validation was applied.
`boolean`
`isForReturnValue()`
Whether the violations are for a return value.

### Methods inherited from class java.lang.Throwable

`addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.springframework.validation.method.MethodValidationResult

`getAllErrors, getAllValidationResults, getBeanResults, getValueResults, hasErrors`

## Constructor Details

### MethodValidationException

public MethodValidationException(MethodValidationResult validationResult)

## Method Details

### getTarget

public Object getTarget()
Description copied from interface: `MethodValidationResult`
Return the target of the method invocation to which validation was applied.

Specified by:
  `getTarget` in interface `MethodValidationResult`

### getMethod

public Method getMethod()
Description copied from interface: `MethodValidationResult`
Return the method to which validation was applied.

Specified by:
  `getMethod` in interface `MethodValidationResult`

### isForReturnValue

public boolean isForReturnValue()
Description copied from interface: `MethodValidationResult`
Whether the violations are for a return value. If true the violations are from validating a return value. If false the violations are from validating method arguments.

Specified by:
  `isForReturnValue` in interface `MethodValidationResult`

### getParameterValidationResults

public List<ParameterValidationResult> getParameterValidationResults()
Description copied from interface: `MethodValidationResult`
Return all validation results per method parameter, including both `MethodValidationResult.getValueResults()` and `MethodValidationResult.getBeanResults()`.

Use `MethodValidationResult.getCrossParameterValidationResults()` for access to errors from cross-parameter validation.

Specified by:
  `getParameterValidationResults` in interface `MethodValidationResult`
See Also:
  - `MethodValidationResult.getValueResults()`
  - `MethodValidationResult.getBeanResults()`

### getCrossParameterValidationResults

public List<MessageSourceResolvable> getCrossParameterValidationResults()
Description copied from interface: `MethodValidationResult`
Return errors from cross-parameter validation.

Specified by:
  `getCrossParameterValidationResults` in interface `MethodValidationResult`