Package com.helger.scope
Class ScopeHelper
- java.lang.Object
-
- com.helger.scope.ScopeHelper
-
@ThreadSafe public final class ScopeHelper extends Object
Global scope utility methods that don't nicely fit somewhere else.- Author:
- Philip Helger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScopeHelper.DebugScopeExceptionThe exception used for receiving scope debug stack traces
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_DEBUG_GLOBAL_SCOPEstatic booleanDEFAULT_DEBUG_LIFE_CYCLEstatic booleanDEFAULT_DEBUG_REQUEST_SCOPEstatic booleanDEFAULT_DEBUG_SESSION_SCOPEstatic booleanDEFAULT_DEBUG_WITH_STACK_TRACE
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ExceptiongetDebugException()static ThrowablegetDebugStackTrace()Deprecated, for removal: This API element is subject to removal in a future version.In favour ofgetDebugException()as we should not return Throwablestatic booleanisDebugGlobalScopeEnabled()static booleanisDebugGlobalScopeLifeCycle()This is a just a helper method to determine whether global scope creation/deletion issues should be logged or not.static booleanisDebugGlobalScopeLifeCycle(org.slf4j.Logger aLogger)Deprecated, for removal: This API element is subject to removal in a future version.UseisDebugGlobalScopeLifeCycle()insteadstatic booleanisDebugRequestScopeEnabled()static booleanisDebugRequestScopeLifeCycle()This is a just a helper method to determine whether request scope creation/deletion issues should be logged or not.static booleanisDebugRequestScopeLifeCycle(org.slf4j.Logger aLogger)Deprecated, for removal: This API element is subject to removal in a future version.UseisDebugRequestScopeLifeCycle()insteadstatic booleanisDebugSessionScopeEnabled()static booleanisDebugSessionScopeLifeCycle()This is a just a helper method to determine whether session scope creation/deletion issues should be logged or not.static booleanisDebugSessionScopeLifeCycle(org.slf4j.Logger aLogger)Deprecated, for removal: This API element is subject to removal in a future version.UseisDebugSessionScopeLifeCycle()insteadstatic booleanisDebugWithStackTrace()static booleanisLifeCycleDebuggingEnabled()static voidsetDebugGlobalScopeEnabled(boolean bDebugScope)Enable or disable global scope life cycle debugging.static voidsetDebugRequestScopeEnabled(boolean bDebugScope)Enable or disable request scope life cycle debugging.static voidsetDebugSessionScopeEnabled(boolean bDebugScope)Enable or disable session scope life cycle debugging.static voidsetDebugWithStackTrace(boolean bDebugWithStackTrace)Enable or disable stack traces when debugging scopes.static voidsetLifeCycleDebuggingEnabled(boolean bDebugLifeCycle)Enable or disable scope life cycle debugging for all scopes.
-
-
-
Field Detail
-
DEFAULT_DEBUG_LIFE_CYCLE
public static final boolean DEFAULT_DEBUG_LIFE_CYCLE
- See Also:
- Constant Field Values
-
DEFAULT_DEBUG_GLOBAL_SCOPE
public static final boolean DEFAULT_DEBUG_GLOBAL_SCOPE
- See Also:
- Constant Field Values
-
DEFAULT_DEBUG_SESSION_SCOPE
public static final boolean DEFAULT_DEBUG_SESSION_SCOPE
- See Also:
- Constant Field Values
-
DEFAULT_DEBUG_REQUEST_SCOPE
public static final boolean DEFAULT_DEBUG_REQUEST_SCOPE
- See Also:
- Constant Field Values
-
DEFAULT_DEBUG_WITH_STACK_TRACE
public static final boolean DEFAULT_DEBUG_WITH_STACK_TRACE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setLifeCycleDebuggingEnabled
public static void setLifeCycleDebuggingEnabled(boolean bDebugLifeCycle)
Enable or disable scope life cycle debugging for all scopes.- Parameters:
bDebugLifeCycle-trueif the scope life cycle should be debugged,falseto disable it. By default is is disabled.
-
isLifeCycleDebuggingEnabled
public static boolean isLifeCycleDebuggingEnabled()
- Returns:
trueif life cycle debugging for all scopes is enabled,falseif it is disabled. The default value is disabled.
-
setDebugGlobalScopeEnabled
public static void setDebugGlobalScopeEnabled(boolean bDebugScope)
Enable or disable global scope life cycle debugging.- Parameters:
bDebugScope-trueif the global scope life cycle should be debugged,falseto disable it. By default is is disabled.
-
isDebugGlobalScopeEnabled
public static boolean isDebugGlobalScopeEnabled()
- Returns:
trueif global scope life cycle debugging is enabled,falseif it is disabled. The default value is disabled.
-
setDebugSessionScopeEnabled
public static void setDebugSessionScopeEnabled(boolean bDebugScope)
Enable or disable session scope life cycle debugging.- Parameters:
bDebugScope-trueif the session scope life cycle should be debugged,falseto disable it. By default is is disabled.
-
isDebugSessionScopeEnabled
public static boolean isDebugSessionScopeEnabled()
- Returns:
trueif session scope life cycle debugging is enabled,falseif it is disabled. The default value is disabled.
-
setDebugRequestScopeEnabled
public static void setDebugRequestScopeEnabled(boolean bDebugScope)
Enable or disable request scope life cycle debugging.- Parameters:
bDebugScope-trueif the request scope life cycle should be debugged,falseto disable it. By default is is disabled.
-
isDebugRequestScopeEnabled
public static boolean isDebugRequestScopeEnabled()
- Returns:
trueif request scope life cycle debugging is enabled,falseif it is disabled. The default value is disabled.
-
setDebugWithStackTrace
public static void setDebugWithStackTrace(boolean bDebugWithStackTrace)
Enable or disable stack traces when debugging scopes.- Parameters:
bDebugWithStackTrace-trueto enable stack traces,falseto disable them. By default is is disabled.
-
isDebugWithStackTrace
public static boolean isDebugWithStackTrace()
- Returns:
trueif stack traces should be logged,falseif not. The default value is disabled.
-
isDebugGlobalScopeLifeCycle
@Deprecated(forRemoval=true, since="11.0.4") public static boolean isDebugGlobalScopeLifeCycle(@Nonnull org.slf4j.Logger aLogger)
Deprecated, for removal: This API element is subject to removal in a future version.UseisDebugGlobalScopeLifeCycle()insteadThis is a just a helper method to determine whether global scope creation/deletion issues should be logged or not.- Parameters:
aLogger- The logger to check.- Returns:
trueif global scope creation/deletion should be logged,falseotherwise.- Since:
- 9.4.7
-
isDebugGlobalScopeLifeCycle
public static boolean isDebugGlobalScopeLifeCycle()
This is a just a helper method to determine whether global scope creation/deletion issues should be logged or not.- Returns:
trueif global scope creation/deletion should be logged,falseotherwise.- Since:
- 11.0.4
-
isDebugSessionScopeLifeCycle
@Deprecated(forRemoval=true, since="11.0.4") public static boolean isDebugSessionScopeLifeCycle(@Nonnull org.slf4j.Logger aLogger)
Deprecated, for removal: This API element is subject to removal in a future version.UseisDebugSessionScopeLifeCycle()insteadThis is a just a helper method to determine whether session scope creation/deletion issues should be logged or not.- Parameters:
aLogger- The logger to check.- Returns:
trueif session scope creation/deletion should be logged,falseotherwise.- Since:
- 9.4.7
-
isDebugSessionScopeLifeCycle
public static boolean isDebugSessionScopeLifeCycle()
This is a just a helper method to determine whether session scope creation/deletion issues should be logged or not.- Returns:
trueif session scope creation/deletion should be logged,falseotherwise.- Since:
- 11.0.4
-
isDebugRequestScopeLifeCycle
@Deprecated(forRemoval=true, since="11.0.4") public static boolean isDebugRequestScopeLifeCycle(@Nonnull org.slf4j.Logger aLogger)
Deprecated, for removal: This API element is subject to removal in a future version.UseisDebugRequestScopeLifeCycle()insteadThis is a just a helper method to determine whether request scope creation/deletion issues should be logged or not.- Parameters:
aLogger- The logger to check.- Returns:
trueif request scope creation/deletion should be logged,falseotherwise.- Since:
- 9.4.7
-
isDebugRequestScopeLifeCycle
public static boolean isDebugRequestScopeLifeCycle()
This is a just a helper method to determine whether request scope creation/deletion issues should be logged or not.- Returns:
trueif request scope creation/deletion should be logged,falseotherwise.- Since:
- 11.0.4
-
getDebugStackTrace
@Nullable @Deprecated(forRemoval=true, since="11.0.5") public static Throwable getDebugStackTrace()
Deprecated, for removal: This API element is subject to removal in a future version.In favour ofgetDebugException()as we should not return Throwable- Returns:
- An exception with the current stack trace or
nullifisDebugWithStackTrace()isfalse - See Also:
isDebugWithStackTrace()
-
getDebugException
@Nullable public static Exception getDebugException()
- Returns:
- An exception with the current stack trace or
nullifisDebugWithStackTrace()isfalse - Since:
- 11.0.5
- See Also:
isDebugWithStackTrace()
-
-