Package com.couchbase.client.core.env
Class OwnedOrExternal<T>
java.lang.Object
com.couchbase.client.core.env.OwnedOrExternal<T>
A holder for a resource that is either "owned" (created and managed
by the SDK) or "external" (created and managed outside the SDK).
Note: Although this class bears a passing resemblance to
Supplier
, it has different semantics.
Unlike Supplier.get()
, this class's get()
method is guaranteed to return the same instance every time.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> OwnedOrExternal
<T> external
(T resource) get()
Returns the resource.boolean
isOwned()
Returns true if the resource is managed by the SDK, otherwise false.static <T> OwnedOrExternal
<T> owned
(T resource) toString()