java.lang.Object
st.orm.template.impl.SqlInterceptorManager
SqlInterceptorManager relies on preview features of the Java platform:
SqlInterceptorManagerrefers to one or more preview APIs:Carrier.
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 Summary
Modifier and TypeMethodDescriptionstatic ScopedValue.CarrierPREVIEWCreate a new scoped interceptor that applies an operator to SQL statements processed by the current thread and any child threads.static ScopedValue.CarrierPREVIEWintercept(UnaryOperator<Sql> operator) Create a new scoped interceptor that applies an operator to SQL statements processed by the current thread and any child threads.static voidregisterGlobalInterceptor(UnaryOperator<Sql> interceptor) Register a global interceptor that will be called for all SQL statements.static voidregisterGlobalObserver(Consumer<Sql> observer) Register a global observer that will be called for all SQL statements.static voidunregisterGlobalObserver(Consumer<Sql> observer) Unregister a global observer.static voidunregisterGlobalObserver(UnaryOperator<Sql> observer) Unregister a global observer.
-
Method Details
-
registerGlobalInterceptor
Register a global interceptor that will be called for all SQL statements.- Parameters:
interceptor- the interceptor to call for each SQL statement.
-
registerGlobalObserver
Register a global observer that will be called for all SQL statements.- Parameters:
observer- the observer to call for each SQL statement.
-
unregisterGlobalObserver
Unregister a global observer.- Parameters:
observer- the observer to unregister.
-
unregisterGlobalObserver
Unregister a global observer.- Parameters:
observer- the observer to unregister.
-
intercept
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
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.
-
SqlInterceptorManagerwhen preview features are enabled.