Class BinaryDocument
java.lang.Object
com.couchbase.client.java.document.AbstractDocument<com.couchbase.client.deps.io.netty.buffer.ByteBuf>
com.couchbase.client.java.document.BinaryDocument
- All Implemented Interfaces:
Document<com.couchbase.client.deps.io.netty.buffer.ByteBuf>
public class BinaryDocument extends AbstractDocument<com.couchbase.client.deps.io.netty.buffer.ByteBuf>
Represents raw
ByteBuf
content in a document.- Since:
- 2.0
- Author:
- Michael Nitschinger
-
Method Summary
Modifier and Type Method Description static BinaryDocument
create(String id)
Creates aBinaryDocument
which the document id.static BinaryDocument
create(String id, int expiry, com.couchbase.client.deps.io.netty.buffer.ByteBuf content)
Creates aBinaryDocument
which the document id, content and the expiration time.static BinaryDocument
create(String id, int expiry, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas)
Creates aBinaryDocument
which the document id, content, CAS value, expiration time and status code.static BinaryDocument
create(String id, int expiry, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas, MutationToken mutationToken)
Creates aBinaryDocument
which the document id, content, CAS value, expiration time and status code.static BinaryDocument
create(String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content)
Creates aBinaryDocument
which the document id and content.static BinaryDocument
create(String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas)
Creates aBinaryDocument
which the document id, content and the CAS value.static BinaryDocument
from(BinaryDocument doc, long cas)
Creates a copy from a differentBinaryDocument
, but changes the CAS value.static BinaryDocument
from(BinaryDocument doc, String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content)
Creates a copy from a differentBinaryDocument
, but changes the document ID and content.Methods inherited from class com.couchbase.client.java.document.AbstractDocument
cas, content, equals, expiry, hashCode, id, mutationToken, readFromSerializedStream, toString, writeToSerializedStream
-
Method Details
-
create
Creates aBinaryDocument
which the document id.- Parameters:
id
- the per-bucket unique document id.- Returns:
- a
BinaryDocument
.
-
create
public static BinaryDocument create(String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content)Creates aBinaryDocument
which the document id and content.- Parameters:
id
- the per-bucket unique document id.content
- the content of the document.- Returns:
- a
BinaryDocument
.
-
create
public static BinaryDocument create(String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas)Creates aBinaryDocument
which the document id, content and the CAS value.- Parameters:
id
- the per-bucket unique document id.content
- the content of the document.cas
- the CAS (compare and swap) value for optimistic concurrency.- Returns:
- a
BinaryDocument
.
-
create
public static BinaryDocument create(String id, int expiry, com.couchbase.client.deps.io.netty.buffer.ByteBuf content)Creates aBinaryDocument
which the document id, content and the expiration time.- Parameters:
id
- the per-bucket unique document id.content
- the content of the document.expiry
- the expiration time of the document.- Returns:
- a
BinaryDocument
.
-
create
public static BinaryDocument create(String id, int expiry, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas)Creates aBinaryDocument
which the document id, content, CAS value, expiration time and status code. This factory method is normally only called within the client library when a response is analyzed and a document is returned which is enriched with the status code. It does not make sense to pre populate the status field from the user level code.- Parameters:
id
- the per-bucket unique document id.content
- the content of the document.cas
- the CAS (compare and swap) value for optimistic concurrency.expiry
- the expiration time of the document.- Returns:
- a
BinaryDocument
.
-
create
public static BinaryDocument create(String id, int expiry, com.couchbase.client.deps.io.netty.buffer.ByteBuf content, long cas, MutationToken mutationToken)Creates aBinaryDocument
which the document id, content, CAS value, expiration time and status code. This factory method is normally only called within the client library when a response is analyzed and a document is returned which is enriched with the status code. It does not make sense to pre populate the status field from the user level code.- Parameters:
id
- the per-bucket unique document id.content
- the content of the document.cas
- the CAS (compare and swap) value for optimistic concurrency.expiry
- the expiration time of the document.mutationToken
- the optional mutation token of the document.- Returns:
- a
BinaryDocument
.
-
from
public static BinaryDocument from(BinaryDocument doc, String id, com.couchbase.client.deps.io.netty.buffer.ByteBuf content)Creates a copy from a differentBinaryDocument
, but changes the document ID and content.- Parameters:
doc
- the originalBinaryDocument
to copy.id
- the per-bucket unique document id.content
- the content of the document.- Returns:
- a copied
BinaryDocument
with the changed properties.
-
from
Creates a copy from a differentBinaryDocument
, but changes the CAS value.- Parameters:
doc
- the originalBinaryDocument
to copy.cas
- the CAS (compare and swap) value for optimistic concurrency.- Returns:
- a copied
BinaryDocument
with the changed properties.
-