Class GrpcExceptionHandlerMethodResolver

java.lang.Object
net.devh.boot.grpc.server.advice.GrpcExceptionHandlerMethodResolver
All Implemented Interfaces:
InitializingBean

public class GrpcExceptionHandlerMethodResolver extends Object implements InitializingBean
Given an annotated @GrpcAdvice class and annotated methods with @GrpcExceptionHandler, GrpcExceptionHandlerMethodResolver resolves given exception type and maps it to the corresponding method to be executed, when this exception is being raised.

For an example how to make use of it, please have a look at @GrpcExceptionHandler.

See Also:
  • Constructor Details

    • GrpcExceptionHandlerMethodResolver

      public GrpcExceptionHandlerMethodResolver(GrpcAdviceDiscoverer grpcAdviceDiscoverer)
      Creates a new GrpcExceptionHandlerMethodResolver.
      Parameters:
      grpcAdviceDiscoverer - The advice discoverer to use.
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface InitializingBean
      Throws:
      Exception
    • resolveMethodWithInstance

      @NonNull public <E extends Throwable> Map.Entry<Object,Method> resolveMethodWithInstance(Class<E> exceptionType)
      When given exception type is subtype of already provided mapped exception, this returns a valid mapped method to be later executed.
      Type Parameters:
      E - type of exception
      Parameters:
      exceptionType - exception to check
      Returns:
      mapped method instance with its method
    • isMethodMappedForException

      public <E extends Throwable> boolean isMethodMappedForException(Class<E> exception)
      Lookup if a method is mapped to given exception.
      Type Parameters:
      E - type of exception
      Parameters:
      exception - exception to check
      Returns:
      true if mapped to valid method