org.llorllale.youtrack.api.PageUri Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of youtrack-api Show documentation
Show all versions of youtrack-api Show documentation
Fluent, object-oriented Java API for YouTrack.
The newest version!
/*
* Copyright 2017 George Aristy
*
* 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
*
* http://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 org.llorllale.youtrack.api;
import java.util.function.Function;
import java.util.function.Supplier;
import org.apache.http.client.methods.HttpUriRequest;
/**
* Combines a supplier of page numbers and a mapper of these numbers to working
* {@link HttpUriRequest http requests} where each combination belongs to a distinct {@link Page}
* of results.
*
* @author George Aristy ([email protected])
* @see Pagination
* @since 0.7.0
*/
final class PageUri implements Supplier {
private final Supplier pageNum;
private final Function combiner;
/**
* Primary ctor.
*
* @param pageNum the page number supplier
* @param combiner accepts a value from {@code pageNum} and produces a working
* {@link HttpUriRequest} for a {@link Page}
* @since 0.7.0
*/
PageUri(Supplier pageNum, Function combiner) {
this.pageNum = pageNum;
this.combiner = combiner;
}
@Override
public HttpUriRequest get() {
return this.combiner.apply(this.pageNum.get());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy