Interface HelidonInterceptor<W>

Type Parameters:
W - type of the work item processed by the interceptor
All Known Subinterfaces:
HelidonInterceptor.WithPostCompletion<W>
All Known Implementing Classes:
HelidonInterceptor.Base

public interface HelidonInterceptor<W>
Common behavior for interceptors, invoking a preInvocation method before running an intercepted Executable.

Implementing classes typically extend HelidonInterceptor.Base.

See also the HelidonInterceptor.WithPostCompletion interface.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    HelidonInterceptor implementation providing as much logic as possible.
    static interface 
    Common behavior among interceptors with both pre-invocation and post-completion behavior.
  • Method Summary

    Modifier and Type
    Method
    Description
    aroundConstruct(jakarta.interceptor.InvocationContext context)
    Invoked during the intercepted constructor invocation.
    default Object
    aroundConstruction(jakarta.interceptor.InvocationContext context)
    Invokes the implementation's preInvocation logic for a constructor, once for each work item associated with the constructor.
    default Object
    aroundInvocation(jakarta.interceptor.InvocationContext context)
    Invokes the implementation's preInvocation logic for a method, once for each work item associated with the method.
    aroundInvoke(jakarta.interceptor.InvocationContext context)
    Invoked during the intercepted method invocation.
    void
    preInvocation(jakarta.interceptor.InvocationContext context, W workItem)
    Performs whatever pre-invocation work is needed for the given context, applied to the specified work item.
    workItems(Executable executable)
    Returns the work items the specific interceptor instance should process.
  • Method Details

    • aroundConstruction

      default Object aroundConstruction(jakarta.interceptor.InvocationContext context) throws Exception
      Invokes the implementation's preInvocation logic for a constructor, once for each work item associated with the constructor.
      Parameters:
      context - InvocationContext
      Returns:
      any value returned by the intercepted Executable
      Throws:
      Exception - when the intercepted code throws an exception
    • aroundConstruct

      Object aroundConstruct(jakarta.interceptor.InvocationContext context) throws Exception
      Invoked during the intercepted constructor invocation.

      Typically, concrete implementations should extend HelidonInterceptor.Base which implements this method with @AroundConstruct. Annotation processing for @AroundConstruct does not recognize the annotation on a default method implementation defined on the interface.

      Parameters:
      context - the invocation context for the intercepted call
      Returns:
      the value returned from the intercepted constructor
      Throws:
      Exception - if the invoked constructor throws an exception
    • aroundInvocation

      default Object aroundInvocation(jakarta.interceptor.InvocationContext context) throws Exception
      Invokes the implementation's preInvocation logic for a method, once for each work item associated with the method.
      Parameters:
      context - InvocationContext
      Returns:
      any value returned by the intercepted Executable
      Throws:
      Exception - when the intercepted code throws an exception
    • aroundInvoke

      Object aroundInvoke(jakarta.interceptor.InvocationContext context) throws Exception
      Invoked during the intercepted method invocation.

      Typically, concrete implementations should extend HelidonInterceptor.Base which implements this method with @AroundInvoke. Annotation processing for @AroundInvoke does not recognize the annotation on a default method implementation defined on the interface.

      Parameters:
      context - the invocation context for the intercepted call
      Returns:
      the value returned from the intercepted method
      Throws:
      Exception - if the invoked method throws an exception
    • workItems

      Iterable<W> workItems(Executable executable)
      Returns the work items the specific interceptor instance should process.
      Parameters:
      executable - the specific Executable being intercepted
      Returns:
      the work items pertinent to the specified Executable
    • preInvocation

      void preInvocation(jakarta.interceptor.InvocationContext context, W workItem)
      Performs whatever pre-invocation work is needed for the given context, applied to the specified work item.

      If the pre-invocation handler throws an exception, any other pre-invocation

      Parameters:
      context - InvocationContext for the execution being intercepted
      workItem - the work item on which to operate