Package io.micronaut.aop
Interface InterceptedMethod
-
- All Known Subinterfaces:
KotlinInterceptedMethod
- All Known Implementing Classes:
SynchronousInterceptedMethod
public interface InterceptedMethod
The intercept method supporting intercepting different reactive invocations.- Since:
- 2.1.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
InterceptedMethod.ResultType
Possible result types.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <E extends java.lang.Throwable>
java.lang.ObjecthandleException(java.lang.Exception exception)
Handle the exception that should be thrown out of the invocation.java.lang.Object
handleResult(java.lang.Object result)
Handle the value that should be the result of the invocation.java.lang.Object
interceptResult()
Proceeds with invocation ofInvocationContext.proceed()
and converts result to appropriate type.java.lang.Object
interceptResult(Interceptor<?,?> from)
Proceeds with invocation ofInvocationContext.proceed(Interceptor)
and converts result to appropriate type.default java.util.concurrent.CompletionStage<?>
interceptResultAsCompletionStage()
Proceeds with invocation ofInvocationContext.proceed()
and converts result toCompletionStage
.default java.util.concurrent.CompletionStage<?>
interceptResultAsCompletionStage(Interceptor<?,?> from)
Proceeds with invocation ofInvocationContext.proceed(Interceptor)
and converts result toCompletionStage
.default org.reactivestreams.Publisher<?>
interceptResultAsPublisher()
Proceeds with invocation ofInvocationContext.proceed()
and converts result toPublisher
.default org.reactivestreams.Publisher<?>
interceptResultAsPublisher(Interceptor<?,?> from)
Proceeds with invocation ofInvocationContext.proceed(Interceptor)
and converts result toPublisher
.default org.reactivestreams.Publisher<?>
interceptResultAsPublisher(java.util.concurrent.ExecutorService executorService)
Proceeds with invocation ofInvocationContext.proceed()
and converts result toPublisher
.static InterceptedMethod
of(MethodInvocationContext<?,?> context)
Creates a new instance of intercept method supporting intercepting different reactive invocations.InterceptedMethod.ResultType
resultType()
Returns result type of the method.io.micronaut.core.type.Argument<?>
returnTypeValue()
Returns result type value.default java.lang.Object
unsupported()
Indicated unsupported return type.
-
-
-
Method Detail
-
of
static InterceptedMethod of(MethodInvocationContext<?,?> context)
Creates a new instance of intercept method supporting intercepting different reactive invocations.- Parameters:
context
- TheMethodInvocationContext
- Returns:
- The
InterceptedMethod
-
resultType
InterceptedMethod.ResultType resultType()
Returns result type of the method.- Returns:
- The
InterceptedMethod.ResultType
-
returnTypeValue
io.micronaut.core.type.Argument<?> returnTypeValue()
Returns result type value.- Returns:
- The return type value.
-
interceptResult
java.lang.Object interceptResult()
Proceeds with invocation ofInvocationContext.proceed()
and converts result to appropriate type.- Returns:
- The intercepted result
-
interceptResult
java.lang.Object interceptResult(Interceptor<?,?> from)
Proceeds with invocation ofInvocationContext.proceed(Interceptor)
and converts result to appropriate type.- Parameters:
from
- The interceptor to start from- Returns:
- The intercepted result
-
interceptResultAsCompletionStage
default java.util.concurrent.CompletionStage<?> interceptResultAsCompletionStage()
Proceeds with invocation ofInvocationContext.proceed()
and converts result toCompletionStage
.- Returns:
- The intercepted result
-
interceptResultAsPublisher
default org.reactivestreams.Publisher<?> interceptResultAsPublisher()
Proceeds with invocation ofInvocationContext.proceed()
and converts result toPublisher
.- Returns:
- The intercepted result
-
interceptResultAsPublisher
default org.reactivestreams.Publisher<?> interceptResultAsPublisher(java.util.concurrent.ExecutorService executorService)
Proceeds with invocation ofInvocationContext.proceed()
and converts result toPublisher
.- Parameters:
executorService
- The executor service to subscribe on- Returns:
- The intercepted result
-
interceptResultAsCompletionStage
default java.util.concurrent.CompletionStage<?> interceptResultAsCompletionStage(Interceptor<?,?> from)
Proceeds with invocation ofInvocationContext.proceed(Interceptor)
and converts result toCompletionStage
.- Parameters:
from
- The interceptor to start from- Returns:
- The intercepted result
-
interceptResultAsPublisher
default org.reactivestreams.Publisher<?> interceptResultAsPublisher(Interceptor<?,?> from)
Proceeds with invocation ofInvocationContext.proceed(Interceptor)
and converts result toPublisher
.- Parameters:
from
- The interceptor to start from- Returns:
- The intercepted result
-
handleResult
java.lang.Object handleResult(java.lang.Object result)
Handle the value that should be the result of the invocation.- Parameters:
result
- The result of the invocation- Returns:
- The result of the invocation being returned from the interceptor
-
handleException
<E extends java.lang.Throwable> java.lang.Object handleException(java.lang.Exception exception) throws E extends java.lang.Throwable
Handle the exception that should be thrown out of the invocation.- Type Parameters:
E
- Sneaky throws helper- Parameters:
exception
- The exception- Returns:
- The result of the invocation being returned from the interceptor
- Throws:
E
- The exceptionE extends java.lang.Throwable
-
unsupported
default java.lang.Object unsupported()
Indicated unsupported return type.- Returns:
- The result of the invocation being returned from the interceptor
-
-