java.lang.Object
io.smallrye.common.vertx.ContextLocals
Utilities to access Vert.x Context locals.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Optional<T> Gets the value from the context local associated with the given key.static <T> TGets the value from the context local associated with the given key.static <T> voidStores the given key/value in the context local.static booleanRemoves the value associated with the given key from the context locals.
-
Method Details
-
get
Gets the value from the context local associated with the given key.- Type Parameters:
T- the expected type of the associated value- Parameters:
key- the key, must not benull- Returns:
- an optional containing the associated value if any, empty otherwise.
-
get
Gets the value from the context local associated with the given key. If there is no associated value, it returns the given default.- Type Parameters:
T- the expected type of the associated value- Parameters:
key- the key, must not benulldef- the default value returned if there is no associated value with the given key. Can benull- Returns:
- the associated value if any, the given default otherwise.
-
put
Stores the given key/value in the context local. This method overwrite the existing value if any.- Type Parameters:
T- the expected type of the associated value- Parameters:
key- the key, must not benullvalue- the value, must not benull
-
remove
Removes the value associated with the given key from the context locals.- Parameters:
key- the key, must not benull- Returns:
trueif there were a value associated with the given key.falseotherwise.
-