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

com.noenv.wiremongo.mapping.collection.GetCollections Maven / Gradle / Ivy

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

import com.noenv.wiremongo.command.collection.GetCollectionsCommand;
import com.noenv.wiremongo.mapping.MappingBase;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class GetCollections extends MappingBase, GetCollectionsCommand, GetCollections> {

  public GetCollections() {
    super("getCollections");
  }

  public GetCollections(JsonObject json) {
    super(json);
  }

  @Override
  public GetCollections returns(final List response) {
    return stub(c -> null == response ? null : new ArrayList<>(response));
  }

  @Override
  protected List parseResponse(Object jsonValue) {
    return ((JsonArray) jsonValue).stream()
      .map(o -> (String) o)
      .collect(Collectors.toList());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy