Class ExceptionResolverMethodResolver

java.lang.Object
org.springframework.shell.command.annotation.ExceptionResolverMethodResolver

public class ExceptionResolverMethodResolver extends Object
  • Constructor Details

    • ExceptionResolverMethodResolver

      public ExceptionResolverMethodResolver(Class<?> handlerType)
      A constructor that finds ExceptionResolver methods in the given type.
      Parameters:
      handlerType - the type to introspect
  • Method Details

    • hasExceptionMappings

      public boolean hasExceptionMappings()
      Whether the contained type has any exception mappings.
    • resolveMethod

      @Nullable public Method resolveMethod(Exception exception)
      Find a Method to handle the given exception.

      Uses ExceptionDepthComparator if more than one match is found.

      Parameters:
      exception - the exception
      Returns:
      a Method to handle the exception, or null if none found
    • resolveMethodByThrowable

      @Nullable public Method resolveMethodByThrowable(Throwable exception)
      Find a Method to handle the given Throwable.

      Uses ExceptionDepthComparator if more than one match is found.

      Parameters:
      exception - the exception
      Returns:
      a Method to handle the exception, or null if none found
    • resolveMethodByExceptionType

      @Nullable public Method resolveMethodByExceptionType(Class<? extends Throwable> exceptionType)
      Find a Method to handle the given exception type. This can be useful if an Exception instance is not available (e.g. for tools).

      Uses ExceptionDepthComparator if more than one match is found.

      Parameters:
      exceptionType - the exception type
      Returns:
      a Method to handle the exception, or null if none found