ScopedValue (Java SE 23 & JDK 23 [ad-hoc build]) (original) (raw)
Nested Class Summary
Nested Classesstatic interface
Preview.
An operation that returns a result and may throw an exception.static final class
Preview.
A mapping of scoped values, as keys, to values.
Method Summary
Calls a value-returning operation with a ScopedValue
bound to a value in the current thread.[get](#get%28%29)()
Returns the value of the scoped value if bound in the current thread.boolean
[isBound](#isBound%28%29)()
Returns true
if this scoped value is bound in the current thread.
Creates a scoped value that is initially unbound for all threads.[orElse](#orElse%28T%29)([T](ScopedValue.html "type parameter in ScopedValue") other)
Returns the value of this scoped value if bound in the current thread, otherwise returns other
.[orElseThrow](#orElseThrow%28java.util.function.Supplier%29)([Supplier](../util/function/Supplier.html "interface in java.util.function")<? extends X> exceptionSupplier)
Returns the value of this scoped value if bound in the current thread, otherwise throws an exception produced by the exception supplying function.static <T> void
Run an operation with a ScopedValue
bound to a value in the current thread.
Creates a new Carrier
with a single mapping of a ScopedValue
key to a value.
Methods declared in class java.lang.Object
[clone](Object.html#clone%28%29), [equals](Object.html#equals%28java.lang.Object%29), [finalize](Object.html#finalize%28%29), [getClass](Object.html#getClass%28%29), [hashCode](Object.html#hashCode%28%29), [notify](Object.html#notify%28%29), [notifyAll](Object.html#notifyAll%28%29), [toString](Object.html#toString%28%29), [wait](Object.html#wait%28%29), [wait](Object.html#wait%28long%29), [wait](Object.html#wait%28long,int%29)
Method Details
where
callWhere
runWhere
newInstance
get
isBound
orElse
orElseThrow