Class GroupedAccessor

java.lang.Object
me.ahoo.cosid.segment.grouped.GroupedAccessor

@ThreadSafe public final class GroupedAccessor extends Object
Thread-local accessor for managing grouped key context.

Provides thread-local storage for the current group key, allowing different threads to work with different group contexts.

  • Constructor Details

    • GroupedAccessor

      public GroupedAccessor()
  • Method Details

    • set

      public static void set(GroupedKey groupedKey)
      Sets the grouped key for the current thread.
      Parameters:
      groupedKey - the key to set
    • setIfNotNever

      public static void setIfNotNever(GroupedKey groupedKey)
      Sets the grouped key if it's not NEVER.
      Parameters:
      groupedKey - the key to set
    • get

      public static GroupedKey get()
      Gets the grouped key for the current thread.
      Returns:
      the key or null if not set
    • requiredGet

      public static @NonNull GroupedKey requiredGet()
      Gets the grouped key, throwing if not set.
      Returns:
      the key
      Throws:
      NullPointerException - if not set
    • clear

      public static void clear()
      Clears the grouped key for the current thread.