Record Class RSOps

java.lang.Object
java.lang.Record
org.restheart.mongodb.RSOps

public record RSOps(com.mongodb.ReadPreference readPreference, com.mongodb.ReadConcern readConcern, com.mongodb.WriteConcern writeConcern) extends Record
ReplicaSet Connection Options
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    RSOps(com.mongodb.ReadPreference readPreference, com.mongodb.ReadConcern readConcern, com.mongodb.WriteConcern writeConcern)
    Creates an instance of a RSOps record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.mongodb.client.MongoDatabase
    apply(com.mongodb.client.MongoDatabase db)
    apply the read concern, read preference and write concern to the given db
    com.mongodb.client.MongoDatabase
    applyReadConcern(com.mongodb.client.MongoDatabase db)
     
    com.mongodb.client.MongoDatabase
    applyReadPreference(com.mongodb.client.MongoDatabase db)
     
    com.mongodb.client.MongoDatabase
    applyWriteConcern(com.mongodb.client.MongoDatabase db)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    static RSOps
    from(com.mongodb.ConnectionString mongoUri)
     
    final int
    Returns a hash code value for this object.
    com.mongodb.ReadConcern
    Returns the value of the readConcern record component.
    com.mongodb.ReadPreference
    Returns the value of the readPreference record component.
    final String
    Returns a string representation of this record class.
    withReadConcern(com.mongodb.ReadConcern readConcern)
     
    withReadConcern(String readConcern)
     
    withReadPreference(com.mongodb.ReadPreference readPreference)
     
    withReadPreference(String readPreference)
     
    withWriteConcern(com.mongodb.WriteConcern writeConcern)
     
    withWriteConcern(String writeConcern)
     
    com.mongodb.WriteConcern
    Returns the value of the writeConcern record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • RSOps

      public RSOps()
    • RSOps

      public RSOps(com.mongodb.ReadPreference readPreference, com.mongodb.ReadConcern readConcern, com.mongodb.WriteConcern writeConcern)
      Creates an instance of a RSOps record class.
      Parameters:
      readPreference - the value for the readPreference record component
      readConcern - the value for the readConcern record component
      writeConcern - the value for the writeConcern record component
  • Method Details

    • withReadPreference

      public RSOps withReadPreference(com.mongodb.ReadPreference readPreference)
    • withReadPreference

      public RSOps withReadPreference(String readPreference) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • withReadConcern

      public RSOps withReadConcern(com.mongodb.ReadConcern readConcern)
    • withReadConcern

      public RSOps withReadConcern(String readConcern) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • withWriteConcern

      public RSOps withWriteConcern(com.mongodb.WriteConcern writeConcern)
    • withWriteConcern

      public RSOps withWriteConcern(String writeConcern)
    • apply

      public com.mongodb.client.MongoDatabase apply(com.mongodb.client.MongoDatabase db)
      apply the read concern, read preference and write concern to the given db
      Parameters:
      collection -
      Returns:
    • applyReadPreference

      public com.mongodb.client.MongoDatabase applyReadPreference(com.mongodb.client.MongoDatabase db)
    • applyReadConcern

      public com.mongodb.client.MongoDatabase applyReadConcern(com.mongodb.client.MongoDatabase db)
    • applyWriteConcern

      public com.mongodb.client.MongoDatabase applyWriteConcern(com.mongodb.client.MongoDatabase db)
    • from

      public static RSOps from(com.mongodb.ConnectionString mongoUri)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • readPreference

      public com.mongodb.ReadPreference readPreference()
      Returns the value of the readPreference record component.
      Returns:
      the value of the readPreference record component
    • readConcern

      public com.mongodb.ReadConcern readConcern()
      Returns the value of the readConcern record component.
      Returns:
      the value of the readConcern record component
    • writeConcern

      public com.mongodb.WriteConcern writeConcern()
      Returns the value of the writeConcern record component.
      Returns:
      the value of the writeConcern record component