Class GrpcExceptionHandlerMethodResolver

java.lang.Object
org.springframework.grpc.server.advice.GrpcExceptionHandlerMethodResolver
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

public class GrpcExceptionHandlerMethodResolver extends Object implements org.springframework.beans.factory.InitializingBean
Maps exception types to @GrpcExceptionHandler methods.
Author:
Oleksandr Shevchenko
See Also:
  • Constructor Details

    • GrpcExceptionHandlerMethodResolver

      public GrpcExceptionHandlerMethodResolver(GrpcAdviceDiscoverer grpcAdviceDiscoverer)
      Create a new instance.
      Parameters:
      grpcAdviceDiscoverer - the advice discoverer to use
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • resolveMethodWithInstance

      public <E extends Throwable> Map.Entry<@Nullable Object, @Nullable Method> resolveMethodWithInstance(Class<E> exceptionType)
      Resolve the handler method and bean instance for the given exception type.
      Type Parameters:
      E - the exception type
      Parameters:
      exceptionType - the exception type to resolve
      Returns:
      entry with bean and method, or nulls if no mapping exists
    • isMethodMappedForException

      public <E extends Throwable> boolean isMethodMappedForException(Class<E> exception)
      Check if a handler method exists for the given exception type.
      Type Parameters:
      E - the exception type
      Parameters:
      exception - the exception type to check
      Returns:
      true if a handler is mapped