Package org.springframework.data.mongodb
Interface MongoTransactionOptions
- All Superinterfaces:
ReadConcernAware
,ReadPreferenceAware
,TransactionMetadata
,WriteConcernAware
public interface MongoTransactionOptions
extends TransactionMetadata, ReadConcernAware, ReadPreferenceAware, WriteConcernAware
Options to be applied within a specific transaction scope.
- Since:
- 4.3
- Author:
- Christoph Strobl
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MongoTransactionOptions
Value Object representing empty options enforcing client defaults. -
Method Summary
Modifier and TypeMethodDescriptiondefault <T> T
map
(Function<MongoTransactionOptions, T> mappingFunction) Apply the current options using the given mappingFunction
and return its result.default MongoTransactionOptions
mergeWith
(@Nullable MongoTransactionOptions fallbackOptions) Merge current options with given ones.static MongoTransactionOptions
of
(@Nullable com.mongodb.TransactionOptions options) Factory method to wrap given MongoDB driver nativeTransactionOptions
intoMongoTransactionOptions
.default @Nullable com.mongodb.TransactionOptions
Methods inherited from interface org.springframework.data.mongodb.core.ReadConcernAware
getReadConcern, hasReadConcern
Methods inherited from interface org.springframework.data.mongodb.core.ReadPreferenceAware
getReadPreference, hasReadPreference
Methods inherited from interface org.springframework.data.mongodb.TransactionMetadata
getMaxCommitTime, hasMaxCommitTime
Methods inherited from interface org.springframework.data.mongodb.core.WriteConcernAware
getWriteConcern, hasWriteConcern
-
Field Details
-
NONE
Value Object representing empty options enforcing client defaults. Returns null for all getter methods.
-
-
Method Details
-
mergeWith
@Contract("null -> this") default MongoTransactionOptions mergeWith(@Nullable MongoTransactionOptions fallbackOptions) Merge current options with given ones. Will return first non null value from getters whereas the this has precedence over the given fallbackOptions.- Parameters:
fallbackOptions
- can be null.- Returns:
- new instance of
MongoTransactionOptions
or this if fallbackOptions is null orNONE
.
-
map
Apply the current options using the given mappingFunction
and return its result.- Parameters:
mappingFunction
-- Returns:
- result of the mapping function.
-
toDriverOptions
default @Nullable com.mongodb.TransactionOptions toDriverOptions()- Returns:
- MongoDB driver native
TransactionOptions
. - See Also:
-
of
Factory method to wrap given MongoDB driver nativeTransactionOptions
intoMongoTransactionOptions
.- Parameters:
options
- can be null.- Returns:
NONE
if given object is null.
-