Package com.helger.scope.singleton
Class SingletonHelper
- java.lang.Object
-
- com.helger.scope.singleton.SingletonHelper
-
@ThreadSafe public final class SingletonHelper extends Object
Global singleton utility methods that don't nicely fit somewhere else.- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_DEBUG_CONSISTENCYstatic booleanDEFAULT_DEBUG_WITH_STACK_TRACE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ThrowablegetDebugStackTrace()static booleanisDebugConsistency()static booleanisDebugWithStackTrace()static voidsetDebugConsistency(boolean bDebugConsistency)Enable or disable singleton consistency debugging.static voidsetDebugWithStackTrace(boolean bDebugWithStackTrace)Enable or disable stack traces when debugging singletons.
-
-
-
Field Detail
-
DEFAULT_DEBUG_CONSISTENCY
public static final boolean DEFAULT_DEBUG_CONSISTENCY
-
DEFAULT_DEBUG_WITH_STACK_TRACE
public static final boolean DEFAULT_DEBUG_WITH_STACK_TRACE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setDebugConsistency
public static void setDebugConsistency(boolean bDebugConsistency)
Enable or disable singleton consistency debugging.- Parameters:
bDebugConsistency-trueif the singleton consistency should be debugged,falseto disable it.
-
isDebugConsistency
public static boolean isDebugConsistency()
- Returns:
trueif singleton consistency debugging is enabled,falseif it is disabled. The default value isGlobalDebug.isDebugMode().
-
setDebugWithStackTrace
public static void setDebugWithStackTrace(boolean bDebugWithStackTrace)
Enable or disable stack traces when debugging singletons.- 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.
-
getDebugStackTrace
@Nullable public static Throwable getDebugStackTrace()
- Returns:
- An exception with the current stack trace or
nullifisDebugWithStackTrace()isfalse - See Also:
isDebugWithStackTrace()
-
-