Module storm

Class SqlInterceptorManager

java.lang.Object
st.orm.template.impl.SqlInterceptorManager

public final class SqlInterceptorManager extends Object
SqlInterceptorManager relies on preview features of the Java platform:
  • SqlInterceptorManager refers to one or more preview APIs: Carrier.
Programs can only use SqlInterceptorManager when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Manages SQL interceptors.
Since:
1.1
  • Method Details

    • registerGlobalInterceptor

      public static void registerGlobalInterceptor(@Nonnull UnaryOperator<Sql> interceptor)
      Register a global interceptor that will be called for all SQL statements.
      Parameters:
      interceptor - the interceptor to call for each SQL statement.
    • registerGlobalObserver

      public static void registerGlobalObserver(@Nonnull Consumer<Sql> observer)
      Register a global observer that will be called for all SQL statements.
      Parameters:
      observer - the observer to call for each SQL statement.
    • unregisterGlobalObserver

      public static void unregisterGlobalObserver(@Nonnull UnaryOperator<Sql> observer)
      Unregister a global observer.
      Parameters:
      observer - the observer to unregister.
    • unregisterGlobalObserver

      public static void unregisterGlobalObserver(@Nonnull Consumer<Sql> observer)
      Unregister a global observer.
      Parameters:
      observer - the observer to unregister.
    • intercept

      public static ScopedValue.CarrierPREVIEW intercept(@Nonnull UnaryOperator<Sql> operator)
      Create a new scoped interceptor that applies an operator to SQL statements processed by the current thread and any child threads.

      This interceptor is scoped to the current thread context and propagates only to its child threads. It is isolated from sibling threads, meaning changes made to the interceptor set will not affect other threads that share the same parent scope.

      Parameters:
      operator - the operator to apply to each SQL statement.
      Returns:
      a ScopedValue.CarrierPREVIEW that binds the interceptor to the current thread's scoped context.
    • intercept

      public static ScopedValue.CarrierPREVIEW intercept(@Nonnull Consumer<Sql> observer)
      Create a new scoped interceptor that applies an operator to SQL statements processed by the current thread and any child threads.

      This interceptor is scoped to the current thread context and propagates only to its child threads. It is isolated from sibling threads, meaning changes made to the interceptor set will not affect other threads that share the same parent scope.

      Parameters:
      observer - the observer to invoke with each SQL statement.
      Returns:
      a ScopedValue.CarrierPREVIEW that binds the interceptor to the current thread's scoped context.