- All Known Implementing Classes:
Invocation.Base,Invocation.Call,Invocation.Run
public interface Invocation
Method invocation used in
MethodInterceptor.invoke(Invocation) for Aspects.
Represents a method invocation that can be intercepted with additional before and after invocation logic.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classInvocation base type for both callable and runnable methods.static final classCallable based Invocation with checked exceptions.static interfaceRunnable with checked exceptions.static interfaceCallable with checked exceptions.static final classRunnable based Invocation. -
Method Summary
Modifier and TypeMethodDescriptionObject[]Return the arguments used for this invocation.booleanReturn whether this invocation has a registered recovery methodinstance()Return the 'this' instance of the invocation.invoke()Invoke the underlying method returning the result.Invoke the recovery method associated for this invocation and return the result.default ObjectInvoke the underlying method returning the result.method()Return the method being called for this invocation.voidSet the result that will be returned to the caller.
-
Method Details
-
invoke
Invoke the underlying method returning the result.- Returns:
- The result of the method call. This will return null for void methods.
- Throws:
Throwable- Exception thrown by underlying method
-
invokeUnchecked
Invoke the underlying method returning the result. Checked exceptions will be caught and rethrown asInvocationExceptions.- Returns:
- The result of the method call. This will return null for void methods.
-
result
Set the result that will be returned to the caller.This will replace a prior result set by calling
#invokeor can be used to provide a result allowing to skip calling#invokealtogether.- Parameters:
result- The result that will be returned to the caller.
-
arguments
Object[] arguments()Return the arguments used for this invocation. -
method
Method method()Return the method being called for this invocation. -
instance
Object instance()Return the 'this' instance of the invocation.This is typically used when invoking fallback/recovery methods.
-
hasRecoveryMethod
boolean hasRecoveryMethod()Return whether this invocation has a registered recovery method -
invokeRecoveryMethod
Invoke the recovery method associated for this invocation and return the result.- Returns:
- The result of the method call. This will return null for void methods.
- Throws:
IllegalStateException- if no fallback method is configured with this invocation
-