Package dev.enola.common.context
Class TLC
java.lang.Object
dev.enola.common.context.TLC
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tstatic <K extends Enum<K> & Context.Key<T>,T>
Tget(K key) SeeContext.get(Class).static Contextopen()Opens a new (!)Context, "stacked" over the current one (if any).static <T> Optional<T> static <K extends Enum<K> & Context.Key<T>,T>
Optional<T> optional(K key)
-
Method Details
-
open
Opens a new (!)Context, "stacked" over the current one (if any).This is typically invoked from a try-with-resources, as the returned context must be closed again at some point; so the typical usage is:
try (var ctx = TLC.open()) {. -
get
SeeContext.get(Class).Use
optional(Enum)to check if key is available in Context. -
optional
-
get
-
optional
-