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

com.noenv.wiremongo.mapping.index.DropIndex Maven / Gradle / Ivy

There is a newer version: 4.5.10
Show newest version
package com.noenv.wiremongo.mapping.index;

import com.noenv.wiremongo.command.Command;
import com.noenv.wiremongo.command.index.DropIndexCommand;
import com.noenv.wiremongo.mapping.collection.WithCollection;
import com.noenv.wiremongo.matching.Matcher;
import io.vertx.core.json.JsonObject;

import static com.noenv.wiremongo.matching.EqualsMatcher.equalTo;

public class DropIndex extends WithCollection {

  private Matcher name;

  public DropIndex() {
    super("dropIndex");
  }

  public DropIndex(JsonObject json) {
    super(json);
    name = Matcher.create(json.getJsonObject("name"));
  }

  @Override
  protected Void parseResponse(Object jsonValue) {
    return null;
  }

  @Override
  public boolean matches(Command cmd) {
    if (!super.matches(cmd)) {
      return false;
    }
    if (!(cmd instanceof DropIndexCommand)) {
      return false;
    }
    DropIndexCommand c = (DropIndexCommand) cmd;
    return name == null || name.matches(c.getName());
  }

  public DropIndex withName(String name) {
    return withName(equalTo(name));
  }

  public DropIndex withName(Matcher name) {
    this.name = name;
    return self();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy