Interface Context

All Known Implementing Classes:
FastThreadLocalContextImpl, ThreadLocalContextImpl

public interface Context
上下文接口
Author:
wangliang181230
  • Method Details

    • put

      @Nullable <V> V put(String key, V value)
      设置值
      Type Parameters:
      V - 上下文数据类型
      Parameters:
      key - 键
      value - 值
      Returns:
      previousValue 返回以前的值 或 null
    • get

      @Nullable <V> V get(String key)
      获取值
      Type Parameters:
      V - 值类型
      Parameters:
      key - 键
      Returns:
      value 值
    • remove

      @Nullable <V> V remove(String key)
      移除值
      Type Parameters:
      V - 值类型
      Parameters:
      key - 键
      Returns:
      removedValue 返回被移除的值 或 null
    • remove

      default boolean remove(String key, Object value)
      移除值,如果与value相等的话
      Parameters:
      key - 键
      value - 目标值
      Returns:
      true=原有值与目标值相等 | false=原有值与目标值不相等
    • containsKey

      boolean containsKey(String key)
      是否含有键
      Parameters:
      key - 键
      Returns:
      true=包含 | false=不包含
    • entries

      @NonNull Map<String,Object> entries()
      获取所有上下文
      Returns:
      所有上下文
    • clear

      void clear()
      清空上下文