io.camunda.search.clients.query.SearchBoolQuery Maven / Gradle / Ivy
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
* one or more contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright ownership.
* Licensed under the Camunda License 1.0. You may not use this file
* except in compliance with the Camunda License 1.0.
*/
package io.camunda.search.clients.query;
import static io.camunda.util.CollectionUtil.addValuesToList;
import io.camunda.util.ObjectBuilder;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public record SearchBoolQuery(
List filter,
List must,
List mustNot,
List should)
implements SearchQueryOption {
public static final class Builder implements ObjectBuilder {
private List filter;
private List must;
private List mustNot;
private List should;
public Builder filter(final List queries) {
filter = addValuesToList(filter, queries);
return this;
}
public Builder must(final List queries) {
must = addValuesToList(must, queries);
return this;
}
public Builder mustNot(final List queries) {
mustNot = addValuesToList(mustNot, queries);
return this;
}
public Builder should(final List queries) {
should = addValuesToList(should, queries);
return this;
}
@Override
public SearchBoolQuery build() {
return new SearchBoolQuery(
Objects.requireNonNullElse(filter, Collections.emptyList()),
Objects.requireNonNullElse(must, Collections.emptyList()),
Objects.requireNonNullElse(mustNot, Collections.emptyList()),
Objects.requireNonNullElse(should, Collections.emptyList()));
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy