Class JdbiInterceptionChainHolder<S,T>

java.lang.Object
org.jdbi.v3.core.interceptor.JdbiInterceptionChainHolder<S,T>
Type Parameters:
S - The source type.
T - The target type.

@Alpha public final class JdbiInterceptionChainHolder<S,T> extends Object
An interception chain holder to manage transformation operations.
  • Constructor Details

    • JdbiInterceptionChainHolder

      public JdbiInterceptionChainHolder(Function<S,T> defaultTransformer)
      Creates a new chain holder with a default interceptor.
      Parameters:
      defaultTransformer - A default interceptor that is used when no other registered interceptor processes a source object. Must not be null.
    • JdbiInterceptionChainHolder

      public JdbiInterceptionChainHolder()
      Creates a new chain holder. Throws UnsupportedOperationException if no registered interceptor processes a source object.
  • Method Details

    • process

      @Nonnull public T process(@Nullable S source)
      Processes a source object and returns a target object.
      Parameters:
      source - A source object.
      Returns:
      A target object processed by one of the registered JdbiInterceptor instances.
    • addFirst

      public void addFirst(JdbiInterceptor<S,T> interceptor)
      Registers a new interceptor at the beginning of the chain. Any subsequent call to process(Object) will use this interceptor before all other already registered interceptors.
      Parameters:
      interceptor - An object implementing JdbiInterceptor.
    • addLast

      public void addLast(JdbiInterceptor<S,T> interceptor)
      Registers a new interceptor at the end of the chain. Any subsequent call to process(Object) will use this interceptor after all other already registered interceptors.
      Parameters:
      interceptor - An object implementing JdbiInterceptor.
    • copy

      public void copy(JdbiInterceptionChainHolder<S,T> chainHolder)