Class OwnedOrExternal<T>

java.lang.Object
com.couchbase.client.core.env.OwnedOrExternal<T>

@Internal public class OwnedOrExternal<T> extends Object
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 Details Link icon

    • owned Link icon

      public static <T> OwnedOrExternal<T> owned(T resource)
    • external Link icon

      public static <T> OwnedOrExternal<T> external(T resource)
    • isOwned Link icon

      public boolean isOwned()
      Returns true if the resource is managed by the SDK, otherwise false.
    • get Link icon

      public T get()
      Returns the resource.
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object