All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.edgarespina.mwa.validation.Jsr303HandlerExceptionResolver Maven / Gradle / Ivy

There is a newer version: 0.2.7
Show newest version
package com.github.edgarespina.mwa.validation;

import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.bind.MethodArgumentNotValidException;

import com.github.edgarespina.mwa.handler.BindHandlerExceptionResolver;

/**
 * Handle {@link MethodArgumentNotValidException} and print them using a
 * {@link HttpMessageConverter}.
 *
 * @author edgar.espina
 * @since 0.1
 */
public class Jsr303HandlerExceptionResolver extends
    BindHandlerExceptionResolver {

  /**
   * Creates a new {@link Jsr303HandlerExceptionResolver}.
   */
  public Jsr303HandlerExceptionResolver() {
    super(MethodArgumentNotValidException.class);
  }

  /**
   * {@inheritDoc}
   */
  @Override
  protected Object convert(final Exception exception) {
    return super.convert(((MethodArgumentNotValidException) exception)
        .getBindingResult());
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy