T
- the document typeAsyncWriteOperation<T>
, WriteOperation<T>
FindAndDeleteOperation
, FindAndReplaceOperation
, FindAndUpdateOperation
public abstract class BaseFindAndModifyOperation<T> extends Object implements AsyncWriteOperation<T>, WriteOperation<T>
Modifier | Constructor | Description |
---|---|---|
protected |
BaseFindAndModifyOperation(MongoNamespace namespace,
WriteConcern writeConcern,
boolean retryWrites,
Decoder<T> decoder) |
Construct a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
protected void |
addTxnNumberToCommand(ServerDescription serverDescription,
ConnectionDescription connectionDescription,
BsonDocument commandDocument,
SessionContext sessionContext) |
|
protected void |
addWriteConcernToCommand(ConnectionDescription connectionDescription,
BsonDocument commandDocument,
SessionContext sessionContext) |
|
T |
execute(WriteBinding binding) |
General execute which can return anything of type T
|
void |
executeAsync(AsyncWriteBinding binding,
SingleResultCallback<T> callback) |
General execute which can return anything of type T
|
protected abstract com.mongodb.operation.CommandOperationHelper.CommandCreator |
getCommandCreator(SessionContext sessionContext) |
|
protected abstract String |
getDatabaseName() |
|
Decoder<T> |
getDecoder() |
Gets the decoder used to decode the result documents.
|
protected abstract FieldNameValidator |
getFieldNameValidator() |
|
MongoNamespace |
getNamespace() |
Gets the namespace.
|
WriteConcern |
getWriteConcern() |
Get the write concern for this operation
|
boolean |
isRetryWrites() |
Returns true if the operation should be retried.
|
protected BaseFindAndModifyOperation(MongoNamespace namespace, WriteConcern writeConcern, boolean retryWrites, Decoder<T> decoder)
namespace
- the database and collection namespace for the operation.writeConcern
- the writeConcern for the operationretryWrites
- if writes should be retried if they fail due to a network error.decoder
- the decoder for the result documents.public T execute(WriteBinding binding)
WriteOperation
execute
in interface WriteOperation<T>
binding
- the binding to execute in the context ofpublic void executeAsync(AsyncWriteBinding binding, SingleResultCallback<T> callback)
AsyncWriteOperation
executeAsync
in interface AsyncWriteOperation<T>
binding
- the binding to execute in the context ofcallback
- the callback to be called when the operation has been executedprotected abstract String getDatabaseName()
public MongoNamespace getNamespace()
public WriteConcern getWriteConcern()
WriteConcern
public Decoder<T> getDecoder()
public boolean isRetryWrites()
protected abstract com.mongodb.operation.CommandOperationHelper.CommandCreator getCommandCreator(SessionContext sessionContext)
protected void addTxnNumberToCommand(ServerDescription serverDescription, ConnectionDescription connectionDescription, BsonDocument commandDocument, SessionContext sessionContext)
protected void addWriteConcernToCommand(ConnectionDescription connectionDescription, BsonDocument commandDocument, SessionContext sessionContext)
protected abstract FieldNameValidator getFieldNameValidator()