com.rabbitmq.http.client.domain.QueryParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http-client Show documentation
Show all versions of http-client Show documentation
Java client for the RabbitMQ HTTP API
The newest version!
/*
* Copyright 2021-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rabbitmq.http.client.domain;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.BiFunction;
public class QueryParameters {
private final Map parameters;
private final Pagination pagination = new Pagination();
private final Columns columns = new Columns();
public QueryParameters() {
this(new HashMap<>());
}
QueryParameters(Map parameters) {
this.parameters = parameters;
}
public Pagination pagination() {
return pagination;
}
public QueryParameters name(String name) {
name(name, false);
return this;
}
public QueryParameters name(String name, boolean usesRegex) {
parameters.put("name", name);
parameters.put("use_regex", usesRegex);
this.pagination.setFirstPageIfNotSet();
return this;
}
public Columns columns() {
return columns;
}
public QueryParameters clear() {
parameters.clear();
return this;
}
public boolean isEmpty() {
return parameters.isEmpty();
}
public Map parameters() {
return parameters.entrySet().stream().reduce(new LinkedHashMap<>(),
(BiFunction
© 2015 - 2024 Weber Informatics LLC | Privacy Policy