public interface ThreadContext
Modifier and Type | Method and Description |
---|---|
<T> io.vavr.control.Try<Property<T>> |
getProperty(String name)
Retrieves a
Try of the property for the given name. |
Thread |
getThread()
Returns the original thread.
|
<T> io.vavr.control.Try<Property<T>> |
removeProperty(String name)
Removes the property with the given name.
|
void |
setPropertyIfAbsent(String name,
io.vavr.control.Try<Property<?>> value)
Sets a value for the property for the given name, if it has not been set before.
|
@Nonnull <T> io.vavr.control.Try<Property<T>> getProperty(@Nonnull String name) throws ClassCastException
Try
of the property for the given name. The Try
is considered to fail in case of
exceptions or if the property does not exist. Implementations have to ensure that this method is thread-safe.name
- The name of the property.Try
of the property.ClassCastException
- If the property cannot be cast to the desired type.void setPropertyIfAbsent(@Nonnull String name, @Nonnull io.vavr.control.Try<Property<?>> value) throws ThreadContextPropertyException
name
- The name of the property.value
- A Try
of the property.ThreadContextPropertyException
- If there is an issue while setting the property.@Nonnull <T> io.vavr.control.Try<Property<T>> removeProperty(@Nonnull String name) throws ClassCastException
Caution: Implementations may not be thread-safe!
name
- The name of the property.Try
holding the removed value, or a failure if there was an exception or the property does not
exist.ClassCastException
- If the property cannot be cast to the desired type.Copyright © 2019 SAP SE. All rights reserved.