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

com.yahoo.bard.webservice.util.Pagination Maven / Gradle / Ivy

Go to download

Fili web service library provides core capabilities for RESTful aggregation navigation, query planning and metadata

There is a newer version: 1.1.13
Show newest version
// Copyright 2016 Yahoo Inc.
// Licensed under the terms of the Apache license. Please see LICENSE.md file distributed with this work for terms.
package com.yahoo.bard.webservice.util;

import java.io.Serializable;
import java.util.List;
import java.util.OptionalInt;

/**
 * Interface for pagination.
 *
 * @param  Type of things being paginated
 */
public interface Pagination extends Serializable {

    long serialVersionUID = 1L;
    int FIRST_PAGE = 1;

    /**
     * Gets the number of the current page.
     *
     * @return The current page
     */
    int getPage();

    /**
     * Gets the maximum size of a page.
     *
     * @return The maximum page size
     */
    int getPerPage();

    /**
     * Gets the number of the first page if this is not the current page.
     *
     * @return The first page
     */
    OptionalInt getFirstPage();

    /**
     * Gets the number of the last page if this is not the current page.
     *
     * @return The last page
     */
    OptionalInt getLastPage();

    /**
     * Gets next page if it exists.
     *
     * @return The next page
     */
    OptionalInt getNextPage();

    /**
     * Gets previous page if it exists.
     *
     * @return The previous page
     */
    OptionalInt getPreviousPage();

    /**
     * Get a list of results corresponding to the current page of data.
     *
     * @return The List of paginated results
     */
    List getPageOfData();

    /**
     * Get the size of all the data.
     *
     * @return The data size
     */
    int getNumResults();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy