All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.ext.mongo.impl.config.ReadConcernLevelParser Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR1
Show newest version
package io.vertx.ext.mongo.impl.config;

import com.mongodb.ConnectionString;
import com.mongodb.ReadConcern;
import com.mongodb.ReadConcernLevel;
import io.vertx.core.json.JsonObject;

class ReadConcernLevelParser {

  private final ReadConcern readConcern;

  ReadConcernLevelParser(ConnectionString connectionString, JsonObject config) {
    ReadConcern readConcern = fromConfig(config);
    if (readConcern == null && connectionString != null) {
      readConcern = connectionString.getReadConcern();
    }
    this.readConcern = readConcern;
  }

  private ReadConcern fromConfig(JsonObject config) {
    String readConcernLevel = config.getString("readConcernLevel");
    return readConcernLevel != null ? new ReadConcern(ReadConcernLevel.fromString(readConcernLevel)) : null;
  }

  ReadConcern readConcern() {
    return readConcern;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy