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

de.otto.flummi.query.HasChildQueryBuilder Maven / Gradle / Ivy

The newest version!
package de.otto.flummi.query;

import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;

import static de.otto.flummi.request.GsonHelper.object;

public class HasChildQueryBuilder implements QueryBuilder {
    private final String type;
    private final QueryBuilder query;

    public HasChildQueryBuilder(String type, QueryBuilder query) {
        this.type = type;
        this.query = query;
    }

    @Override
    public JsonObject build() {
        JsonObject hasChild = new JsonObject();
        hasChild.add("type", new JsonPrimitive(type));
        hasChild.add("query", query.build());
        return object(
                "has_child",
                hasChild);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy