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 Details

    • NONE

      static final MongoTransactionOptions NONE
      Value Object representing empty options enforcing client defaults. Returns null for all getter methods.
  • Method Details

    • mergeWith

      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 or NONE.
    • map

      default <T> T map(Function<MongoTransactionOptions,T> mappingFunction)
      Apply the current options using the given mapping Function and return its result.
      Parameters:
      mappingFunction -
      Returns:
      result of the mapping function.
    • toDriverOptions

      @Nullable default com.mongodb.TransactionOptions toDriverOptions()
      Returns:
      MongoDB driver native TransactionOptions.
      See Also:
    • of

      static MongoTransactionOptions of(@Nullable com.mongodb.TransactionOptions options)
      Factory method to wrap given MongoDB driver native TransactionOptions into MongoTransactionOptions.
      Parameters:
      options -
      Returns:
      NONE if given object is null.