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

com.noenv.wiremongo.command.distinct.DistinctBatchWithQueryCommand Maven / Gradle / Ivy

There is a newer version: 4.5.10
Show newest version
package com.noenv.wiremongo.command.distinct;

import io.vertx.core.json.JsonObject;
import io.vertx.ext.mongo.DistinctOptions;

import static io.vertx.ext.mongo.FindOptions.DEFAULT_BATCH_SIZE;

public class DistinctBatchWithQueryCommand extends DistinctBatchBaseCommand {

  private final JsonObject query;
  private final int batchSize;
  private final DistinctOptions options;

  public DistinctBatchWithQueryCommand(String collection, String fieldName, String resultClassname, JsonObject query) {
    this(collection, fieldName, resultClassname, query, DEFAULT_BATCH_SIZE);
  }

  public DistinctBatchWithQueryCommand(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize) {
    this(collection, fieldName, resultClassname, query, batchSize, null);
  }

  public DistinctBatchWithQueryCommand(String collection, String fieldName, String resultClassname, JsonObject query, DistinctOptions options) {
    this(collection, fieldName, resultClassname, query, DEFAULT_BATCH_SIZE, options);
  }

  public DistinctBatchWithQueryCommand(String collection, String fieldName, String resultClassname, JsonObject query, int batchSize, DistinctOptions options) {
    super("distinctBatchWithQuery", collection, fieldName, resultClassname, options);
    this.query = query;
    this.batchSize = batchSize;
    this.options = options;
  }

  public JsonObject getQuery() {
    return query;
  }

  public int getBatchSize() {
    return batchSize;
  }

  @Override
  public String toString() {
    return super.toString() + ", query: " + (query != null ? query.encode() : "null") + ", option: " + (options != null ? options.toJson().encode() : "null");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy