Package me.ahoo.cosid.segment.grouped
Class GroupedAccessor
java.lang.Object
me.ahoo.cosid.segment.grouped.GroupedAccessor
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()Clears the grouped key for the current thread.static GroupedKeyget()Gets the grouped key for the current thread.static @NonNull GroupedKeyGets the grouped key, throwing if not set.static voidset(GroupedKey groupedKey) Sets the grouped key for the current thread.static voidsetIfNotNever(GroupedKey groupedKey) Sets the grouped key if it's not NEVER.
-
Constructor Details
-
GroupedAccessor
public GroupedAccessor()
-
-
Method Details
-
set
Sets the grouped key for the current thread.- Parameters:
groupedKey- the key to set
-
setIfNotNever
Sets the grouped key if it's not NEVER.- Parameters:
groupedKey- the key to set
-
get
Gets the grouped key for the current thread.- Returns:
- the key or null if not set
-
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.
-