![JAR search and dependency download from the Maven repository](/logo.png)
com.noenv.wiremongo.mapping.collection.CreateCollectionWithOptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vertx-wiremongo Show documentation
Show all versions of vertx-wiremongo Show documentation
Lightweight mongo mocking for Vert.x
package com.noenv.wiremongo.mapping.collection;
import com.noenv.wiremongo.command.Command;
import com.noenv.wiremongo.command.collection.CreateCollectionWithOptionsCommand;
import com.noenv.wiremongo.matching.JsonMatcher;
import com.noenv.wiremongo.matching.Matcher;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.mongo.CreateCollectionOptions;
public class CreateCollectionWithOptions extends WithCollection {
private Matcher options;
public CreateCollectionWithOptions() {
super("createCollectionWithOptions");
}
public CreateCollectionWithOptions(JsonObject json) {
super(json);
options = Matcher.create(json.getJsonObject("options"), j -> new CreateCollectionOptions((JsonObject) j), CreateCollectionOptions::toJson);
}
@Override
protected Void parseResponse(Object jsonValue) {
return null;
}
@Override
public boolean matches(Command cmd) {
if (!super.matches(cmd)) {
return false;
}
if (!(cmd instanceof CreateCollectionWithOptionsCommand)) {
return false;
}
CreateCollectionWithOptionsCommand c = (CreateCollectionWithOptionsCommand) cmd;
return options == null || options.matches(c.getOptions());
}
public CreateCollectionWithOptions withOptions(CreateCollectionOptions options) {
return withOptions(JsonMatcher.equalToJson(options.toJson(), CreateCollectionOptions::toJson));
}
public CreateCollectionWithOptions withOptions(Matcher options) {
this.options = options;
return self();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy