Package net.devh.boot.grpc.server.advice
Class GrpcExceptionHandlerMethodResolver
java.lang.Object
net.devh.boot.grpc.server.advice.GrpcExceptionHandlerMethodResolver
- All Implemented Interfaces:
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
.
-
Constructor Summary
ConstructorsConstructorDescriptionGrpcExceptionHandlerMethodResolver
(GrpcAdviceDiscoverer grpcAdviceDiscoverer) Creates a new GrpcExceptionHandlerMethodResolver. -
Method Summary
Modifier and TypeMethodDescriptionvoid
<E extends Throwable>
booleanisMethodMappedForException
(Class<E> exception) Lookup if a method is mapped to given exception.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.
-
Constructor Details
-
GrpcExceptionHandlerMethodResolver
Creates a new GrpcExceptionHandlerMethodResolver.- Parameters:
grpcAdviceDiscoverer
- The advice discoverer to use.
-
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- 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
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
-