Class Invocation.Base<T>

java.lang.Object
io.avaje.inject.aop.Invocation.Base<T>
Type Parameters:
T - The result type
All Implemented Interfaces:
Invocation
Direct Known Subclasses:
Invocation.Call, Invocation.Run
Enclosing interface:
Invocation

public abstract static class Invocation.Base<T> extends Object implements Invocation
Invocation base type for both callable and runnable methods.
  • Constructor Details

    • Base

      public Base()
  • Method Details

    • with

      public Invocation.Base<T> with(Object instance, Method method, Object... args)
      Set the instance, method and arguments for the invocation.
    • result

      public void result(Object result)
      Description copied from interface: Invocation
      Set the result that will be returned to the caller.

      This will replace a prior result set by calling #invoke or can be used to provide a result allowing to skip calling #invoke altogether.

      Specified by:
      result in interface Invocation
      Parameters:
      result - The result that will be returned to the caller.
    • finalResult

      public T finalResult()
      Return the final invocation result.
    • arguments

      public Object[] arguments()
      Description copied from interface: Invocation
      Return the arguments used for this invocation.
      Specified by:
      arguments in interface Invocation
    • arguments

      public Object[] arguments(Throwable e)
      Description copied from interface: Invocation
      Return the arguments additionally appending the throwable.
      Specified by:
      arguments in interface Invocation
    • method

      public Method method()
      Description copied from interface: Invocation
      Return the method being called for this invocation.
      Specified by:
      method in interface Invocation
    • instance

      public Object instance()
      Description copied from interface: Invocation
      Return the 'this' instance of the invocation.

      This is typically used when invoking fallback/recovery methods.

      Specified by:
      instance in interface Invocation
    • wrap

      public abstract Invocation.Base<T> wrap(MethodInterceptor methodInterceptor)
      Wrap this invocation using a methodInterceptor returning the wrapped call.

      This invocation is effectively nested inside the returned invocation.

      Parameters:
      methodInterceptor - The method interceptor to use to wrap this call with
      Returns:
      The wrapped call