Class Invocation.Run

java.lang.Object
io.avaje.inject.aop.Invocation.Base<Void>
io.avaje.inject.aop.Invocation.Run
All Implemented Interfaces:
Invocation
Enclosing interface:
Invocation

public static final class Invocation.Run extends Invocation.Base<Void>
Runnable based Invocation.
  • Constructor Details

  • Method Details

    • invoke

      public Object invoke() throws Throwable
      Description copied from interface: Invocation
      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
    • fallback

      public Invocation.Run fallback(Consumer<Throwable> fallback)
      Register a fallback method which can be used to recover from an exception while intercepting an invocation
    • wrap

      public Invocation.Base<Void> wrap(MethodInterceptor methodInterceptor)
      Description copied from class: Invocation.Base
      Wrap this invocation using a methodInterceptor returning the wrapped call.

      This invocation is effectively nested inside the returned invocation.

      Specified by:
      wrap in class Invocation.Base<Void>
      Parameters:
      methodInterceptor - The method interceptor to use to wrap this call with
      Returns:
      The wrapped call
    • hasRecoveryMethod

      public boolean hasRecoveryMethod()
      Description copied from interface: Invocation
      Return whether this invocation has a registered recovery method
    • invokeRecoveryMethod

      public Object invokeRecoveryMethod(Throwable t)
      Description copied from interface: Invocation
      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.
    • with

      public Invocation.Run with(Object instance, Method method, Object... args)
      Description copied from class: Invocation.Base
      Set the instance, method and arguments for the invocation.
      Overrides:
      with in class Invocation.Base<Void>