Interface JdbiInterceptor<S,T>

Type Parameters:
S - Transformation source type.
T - Type of the transformation result.
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@Alpha @FunctionalInterface public interface JdbiInterceptor<S,T>
Generic interface to allow transformation operation interception. Used to manage the various inferred data types that may need special treatment.
  • Method Summary

    Modifier and Type
    Method
    Description
    Process a given source object.
  • Method Details

    • intercept

      @CheckForNull T intercept(@Nullable S source, JdbiInterceptionChain<T> chain)
      Process a given source object.
      • If the interceptor wants to process the object, return the result directly.
      • If the interceptor passes on processing, it must return JdbiInterceptionChain.next()
      
        class SomeInterceptor implements JdbiInterceptor<Foo, Bar> {
            @Override
            public Bar intercept(Foo source, JdbiInterceptionChain<Foo, Bar> chain) {
                if (source != null && source.isBarCompatible()) {
                    return new Bar(source);
                } else {
                    return chain.next();
                }
            }
        }
       
      Parameters:
      source - A source object.
      Returns:
      The destination type.