Class CallingContext

java.lang.Object
io.helidon.pico.api.CallingContext

public abstract class CallingContext extends Object
For internal use only to Helidon. Applicable when PicoServicesConfig.TAG_DEBUG is enabled.
  • Field Details

    • DEBUG_HINT

      public static final String DEBUG_HINT
      Helpful hint to give developers needing to see more debug info.
      See Also:
  • Constructor Details

    • CallingContext

      protected CallingContext()
      This needs to be private since a generated builder will be extending this.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • trace

      public abstract StackTraceElement[] trace()
      Only populated when PicoServicesConfig.TAG_DEBUG is set.
      Returns:
      the stack trace for who initialized
    • moduleName

      public abstract Optional<String> moduleName()
      Only populated when PicoServicesConfig.TAG_MODULE_NAME is set.
      Returns:
      the module name
    • threadName

      public abstract String threadName()
      The thread that created the calling context.
      Returns:
      thread creating the calling context
    • globalCallingContext

      public static void globalCallingContext(CallingContext callingContext, boolean throwIfAlreadySet)
      Sets the default global calling context.
      Parameters:
      callingContext - the default global context
      throwIfAlreadySet - should an exception be thrown if the global calling context was already set
      Throws:
      IllegalStateException - if context was already set and the throwIfAlreadySet is active
    • toErrorMessage

      public static String toErrorMessage(CallingContext callingContext, String msg)
      Convenience method for producing an error message that may involve advising the user to apply a debug mode.
      Parameters:
      callingContext - the calling context (caller can be using a custom calling context, which is why we accept it here instead of using the global one)
      msg - the base message to display
      Returns:
      the message appropriate for any exception being thrown
    • toErrorMessage

      public static String toErrorMessage(String msg)
      Convenience method for producing an error message that may involve advising the user to apply a debug mode. Use toErrorMessage(CallingContext, String) iinstead f a calling context is available.
      Parameters:
      msg - the base message to display
      Returns:
      the message appropriate for any exception being thrown
      See Also: