public class CallbackContext extends Object
| 修飾子とタイプ | クラスと説明 |
|---|---|
static interface |
CallbackContext.CallbackContextHolder
The holder of for callback context.
|
protected static class |
CallbackContext.InheritableBehaviorCommandHook |
protected static interface |
CallbackContext.InheritableCallback<CALL> |
protected static class |
CallbackContext.InheritableSqlFireHook |
protected static class |
CallbackContext.InheritableSqlLogHandler |
protected static class |
CallbackContext.InheritableSqlResultHandler |
protected static class |
CallbackContext.InheritableSqlStringFilter |
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected BehaviorCommandHook |
_behaviorCommandHook |
protected static CallbackContext.CallbackContextHolder |
_defaultHolder
The default holder for callback context, using thread local.
|
protected static ThreadLocal<CallbackContext> |
_defaultThreadLocal
The default thread-local for this.
|
protected static CallbackContext.CallbackContextHolder |
_holder
The holder for callback context, might be changed.
|
protected static boolean |
_locked
Is this static world locked?
|
protected SqlFireHook |
_sqlFireHook |
protected SqlLogHandler |
_sqlLogHandler |
protected SqlResultHandler |
_sqlResultHandler |
protected SqlStringFilter |
_sqlStringFilter |
| コンストラクタと説明 |
|---|
CallbackContext() |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
protected static void |
assertNotLocked()
Assert this is not locked.
|
static void |
clearBehaviorCommandHookOnThread()
(removes all existing hooks completely so use terminateLast...() basically)
Clear the hook interface of behavior commands from callback context on thread. |
static void |
clearCallbackContextOnThread()
Clear callback context on thread.
|
protected static void |
clearContextIfNoInterface(CallbackContext context) |
static void |
clearSqlFireHookOnThread()
(removes all existing hooks completely so use terminateLast...() basically)
Clear the hook interface of behavior commands from callback context on thread. |
static void |
clearSqlLogHandlerOnThread()
(removes all existing handlers completely so use terminateLast...() basically)
Clear the handler of SQL log from callback context on thread. |
static void |
clearSqlResultHandlerOnThread()
(removes all existing handlers completely so use terminateLast...() basically)
Clear the handler of SQL result from callback context on thread. |
static void |
clearSqlStringFilterOnThread()
(removes all existing filters completely so use terminateLast...() basically)
Clear the filter of SQL string from callback context on thread. |
protected static void |
endCallback(Consumer<CallbackContext> oneArgLambda) |
protected static CallbackContext.CallbackContextHolder |
getActiveHolder()
Get the active holder for callback context.
|
BehaviorCommandHook |
getBehaviorCommandHook() |
static CallbackContext |
getCallbackContextOnThread()
Get callback context on thread.
|
protected static CallbackContext |
getOrCreateContext() |
SqlFireHook |
getSqlFireHook() |
SqlLogHandler |
getSqlLogHandler() |
SqlResultHandler |
getSqlResultHandler() |
SqlStringFilter |
getSqlStringFilter() |
boolean |
hasAnyInterface() |
static boolean |
isExistBehaviorCommandHookOnThread()
Is existing the hook interface of behavior commands on thread?
|
static boolean |
isExistCallbackContextOnThread()
Is existing callback context on thread?
|
static boolean |
isExistSqlFireHookOnThread()
Is existing the hook interface of behavior commands on thread?
|
static boolean |
isExistSqlLogHandlerOnThread()
Is existing the handler of SQL log on thread?
|
static boolean |
isExistSqlResultHandlerOnThread()
Is existing the handler of SQL result on thread?
|
static boolean |
isExistSqlStringFilterOnThread()
Is existing the handler of SQL result on thread?
|
static boolean |
isLocked()
Is this static world locked?
|
static void |
lock()
Lock this static world, e.g. not to set the holder of thread-local.
|
protected CallbackContext.InheritableBehaviorCommandHook |
newInheritableBehaviorCommandHook(BehaviorCommandHook originally,
BehaviorCommandHook yourHook) |
protected CallbackContext.InheritableSqlFireHook |
newInheritableSqlFireHook(SqlFireHook originally,
SqlFireHook yourHook) |
protected CallbackContext.InheritableSqlLogHandler |
newInheritableSqlLogHandler(SqlLogHandler originally,
SqlLogHandler yourHandler) |
protected CallbackContext.InheritableSqlResultHandler |
newInheritableSqlResultHandler(SqlResultHandler originally,
SqlResultHandler yourHandler) |
protected CallbackContext.InheritableSqlStringFilter |
newInheritableSqlStringFilter(SqlStringFilter originally,
SqlStringFilter yourFilter) |
void |
setBehaviorCommandHook(BehaviorCommandHook behaviorCommandHook)
Set the hook interface of behavior commands.
|
static void |
setBehaviorCommandHookOnThread(BehaviorCommandHook behaviorCommandHook)
Set the hook interface of behavior commands.
|
static void |
setCallbackContextOnThread(CallbackContext callbackContext)
Set callback context on thread.
|
void |
setSqlFireHook(SqlFireHook sqlFireHook)
Set the hook interface of SQL fires.
|
static void |
setSqlFireHookOnThread(SqlFireHook sqlFireHook)
Set the hook interface of SQL fires.
|
void |
setSqlLogHandler(SqlLogHandler sqlLogHandler)
Set the handler of SQL log.
|
static void |
setSqlLogHandlerOnThread(SqlLogHandler sqlLogHandler)
Set the handler of SQL log.
|
void |
setSqlResultHandler(SqlResultHandler sqlResultHandler)
Set the handler of SQL result.
|
static void |
setSqlResultHandlerOnThread(SqlResultHandler sqlResultHandler)
Set the handler of SQL result.
|
void |
setSqlStringFilter(SqlStringFilter sqlStringFilter)
Set the filter of SQL string.
|
static void |
setSqlStringFilterOnThread(SqlStringFilter sqlStringFilter)
Set the filter of SQL string.
|
void |
terminateLastBehaviorCommandHook()
Terminate the last behavior command hook.
|
static void |
terminateLastBehaviorCommandHookOnThread()
Terminate the last hook interface of behavior commands from callback context on thread.
|
void |
terminateLastSqlFireHook()
Terminate the last SQL fire hook.
|
static void |
terminateLastSqlFireHookOnThread()
Terminate the last hook interface of SQL fires from callback context on thread.
|
void |
terminateLastSqlLogHandler()
Terminate the last SQL log handler.
|
static void |
terminateLastSqlLogHandlerOnThread()
Terminate the last handler interface of SQL logs from callback context on thread.
|
void |
terminateLastSqlResultHandler()
Terminate the last SQL log handler.
|
static void |
terminateLastSqlResultHandlerOnThread()
Terminate the last handler interface of SQL results from callback context on thread.
|
void |
terminateLastSqlStringFilter()
Terminate the last SQL string filter.
|
static void |
terminateLastSqlStringFilterOnThread()
Terminate the last filter interface of SQL strings from callback context on thread.
|
String |
toString() |
static void |
unlock()
Unlock this static world, e.g. to set the holder of thread-local.
|
static void |
useSurrogateHolder(CallbackContext.CallbackContextHolder holder)
Use the surrogate holder for callback context.
|
protected static final ThreadLocal<CallbackContext> _defaultThreadLocal
protected static final CallbackContext.CallbackContextHolder _defaultHolder
protected static CallbackContext.CallbackContextHolder _holder
protected static boolean _locked
protected BehaviorCommandHook _behaviorCommandHook
protected SqlFireHook _sqlFireHook
protected SqlLogHandler _sqlLogHandler
protected SqlResultHandler _sqlResultHandler
protected SqlStringFilter _sqlStringFilter
public static CallbackContext getCallbackContextOnThread()
public static void setCallbackContextOnThread(CallbackContext callbackContext)
callbackContext - The context of callback. (NotNull)public static boolean isExistCallbackContextOnThread()
public static void clearCallbackContextOnThread()
protected static CallbackContext.CallbackContextHolder getActiveHolder()
public static void useSurrogateHolder(CallbackContext.CallbackContextHolder holder)
holder - The holder instance. (NullAllowed: if null, use default holder)public static boolean isLocked()
public static void lock()
public static void unlock()
protected static void assertNotLocked()
public static void setBehaviorCommandHookOnThread(BehaviorCommandHook behaviorCommandHook)
CallbackContext.setBehaviorCommandHook(new BehaviorCommandHook() {
public void hookBefore(BehaviorCommandMeta meta) {
// You can implement your favorite callback here.
}
public void hookFinally(BehaviorCommandMeta meta, RuntimeException cause) {
// You can implement your favorite callback here.
}
});
try {
...(DB access)
} finally {
CallbackContext.terminateLastBehaviorCommandHookOnThread();
}
behaviorCommandHook - The hook interface of behavior commands. (NullAllowed: completely clear, Inheritable)public static boolean isExistBehaviorCommandHookOnThread()
public static void terminateLastBehaviorCommandHookOnThread()
public static void clearBehaviorCommandHookOnThread()
public static void setSqlFireHookOnThread(SqlFireHook sqlFireHook)
context.setSqlFireHook(new SqlFireHook() {
public void hookBefore(BehaviorCommandMeta meta, SqlFireReadyInfo fireReadyInfo) {
// You can implement your favorite callback here.
}
public void hookFinally(BehaviorCommandMeta meta, SqlFireResultInfo fireResultInfo) {
// You can implement your favorite callback here.
}
});
try {
...(DB access)
} finally {
CallbackContext.terminateLastSqlFireHookOnThread();
}
sqlFireHook - The hook interface of SQL fires. (NullAllowed: completely clear, Inheritable)public static boolean isExistSqlFireHookOnThread()
public static void terminateLastSqlFireHookOnThread()
public static void clearSqlFireHookOnThread()
public static void setSqlLogHandlerOnThread(SqlLogHandler sqlLogHandler)
context.setSqlLogHandler(new SqlLogHandler() {
public void handle(SqlLogInfo info) {
// You can get your SQL string here.
}
});
try {
...(DB access)
} finally {
CallbackContext.terminateLastSqlLogHandlerOnThread();
}
sqlLogHandler - The handler of SQL log. (NullAllowed: completely clear, Inheritable)public static boolean isExistSqlLogHandlerOnThread()
public static void terminateLastSqlLogHandlerOnThread()
public static void clearSqlLogHandlerOnThread()
public static void setSqlResultHandlerOnThread(SqlResultHandler sqlResultHandler)
context.setSqlResultHandler(new SqlResultHandler() {
public void handle(SqlResultInfo info) {
// You can get your SQL result information here.
}
});
try {
...(DB access)
} finally {
CallbackContext.terminateLastSqlResultHandlerOnThread();
}
sqlResultHandler - The handler of SQL result. (NullAllowed: completely clear, Inheritable)public static boolean isExistSqlResultHandlerOnThread()
public static void terminateLastSqlResultHandlerOnThread()
public static void clearSqlResultHandlerOnThread()
public static void setSqlStringFilterOnThread(SqlStringFilter sqlStringFilter)
context.setSqlStringFilter(new SqlStringFilter() {
public String filter(String executedSql) {
// You can filter your executed SQL string here.
}
});
try {
...(DB access)
} finally {
CallbackContext.terminateLastSqlStringFilterOnThread();
}
sqlStringFilter - The filter of SQL string. (NullAllowed: completely clear, Inheritable)public static boolean isExistSqlStringFilterOnThread()
public static void terminateLastSqlStringFilterOnThread()
public static void clearSqlStringFilterOnThread()
protected static CallbackContext getOrCreateContext()
protected static void endCallback(Consumer<CallbackContext> oneArgLambda)
protected static void clearContextIfNoInterface(CallbackContext context)
public boolean hasAnyInterface()
public void setBehaviorCommandHook(BehaviorCommandHook behaviorCommandHook)
context.setBehaviorCommandHook(new BehaviorCommandHook() {
public void hookBefore(BehaviorCommandMeta meta) {
// You can implement your favorite callback here.
}
public void hookFinally(BehaviorCommandMeta meta, RuntimeException cause) {
// You can implement your favorite callback here.
}
});
behaviorCommandHook - The hook interface of behavior commands. (NullAllowed: completely clear, Inheritable)public void terminateLastBehaviorCommandHook()
public void setSqlFireHook(SqlFireHook sqlFireHook)
context.setSqlFireHook(new SqlFireHook() {
public void hookBefore(BehaviorCommandMeta meta, SqlFireReadyInfo fireReadyInfo) {
// You can implement your favorite callback here.
}
public void hookFinally(BehaviorCommandMeta meta, SqlFireResultInfo fireResultInfo) {
// You can implement your favorite callback here.
}
});
sqlFireHook - The hook interface of SQL fires. (NullAllowed: completely clear, Inheritable)public void terminateLastSqlFireHook()
public void setSqlLogHandler(SqlLogHandler sqlLogHandler)
context.setSqlLogHandler(new SqlLogHandler() {
public void handle(String executedSql, String displaySql
, Object[] args, Class<?>[] argTypes) {
// You can get your SQL string here.
}
});
sqlLogHandler - The handler of SQL log. (NullAllowed: completely clear, Inheritable)public void terminateLastSqlLogHandler()
public void setSqlResultHandler(SqlResultHandler sqlResultHandler)
context.setSqlResultHandler(new SqlResultHandler() {
public void handle(SqlResultInfo info) {
// You can get your SQL result information here.
}
});
sqlResultHandler - The handler of SQL result. (NullAllowed: completely clear, Inheritable)public void terminateLastSqlResultHandler()
public void setSqlStringFilter(SqlStringFilter sqlStringFilter)
context.setSqlStringFilter(new SqlStringFilter() {
public String filterSelectCB(BehaviorCommandMeta meta, String executedSql) {
// You can filter your SQL string here.
}
...
});
sqlStringFilter - The filter of SQL string. (NullAllowed: completely clear, Inheritable)public void terminateLastSqlStringFilter()
protected CallbackContext.InheritableBehaviorCommandHook newInheritableBehaviorCommandHook(BehaviorCommandHook originally, BehaviorCommandHook yourHook)
protected CallbackContext.InheritableSqlFireHook newInheritableSqlFireHook(SqlFireHook originally, SqlFireHook yourHook)
protected CallbackContext.InheritableSqlLogHandler newInheritableSqlLogHandler(SqlLogHandler originally, SqlLogHandler yourHandler)
protected CallbackContext.InheritableSqlResultHandler newInheritableSqlResultHandler(SqlResultHandler originally, SqlResultHandler yourHandler)
protected CallbackContext.InheritableSqlStringFilter newInheritableSqlStringFilter(SqlStringFilter originally, SqlStringFilter yourFilter)
public BehaviorCommandHook getBehaviorCommandHook()
public SqlFireHook getSqlFireHook()
public SqlLogHandler getSqlLogHandler()
public SqlResultHandler getSqlResultHandler()
public SqlStringFilter getSqlStringFilter()
Copyright © 2014–2019 The DBFlute Project. All rights reserved.