Class ScopedLogContext.Carrier

java.lang.Object
cloud.opencode.base.log.enhance.ScopedLogContext.Carrier
Enclosing class:
ScopedLogContext

public static final class ScopedLogContext.Carrier extends Object
Carrier for binding multiple values and executing tasks 用于绑定多个值和执行任务的载体
Since:
JDK 25, opencode-base-log V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • and

      Adds another binding 添加另一个绑定
      Parameters:
      key - the scoped value key | 作用域值键
      value - the value to bind | 要绑定的值
      Returns:
      this carrier for chaining | 用于链式调用的此载体
    • run

      public void run(Runnable task)
      Runs a task in this context 在此上下文中运行任务
      Parameters:
      task - the task to run | 要运行的任务
    • call

      public <T> T call(Callable<T> task) throws Exception
      Calls a task in this context 在此上下文中调用任务
      Type Parameters:
      T - the result type | 结果类型
      Parameters:
      task - the task to call | 要调用的任务
      Returns:
      the result | 结果
      Throws:
      Exception - if task fails | 如果任务失败
    • underlying

      public ScopedValue.Carrier underlying()
      Gets the underlying carrier 获取底层载体
      Returns:
      the ScopedValue carrier | ScopedValue 载体