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

com.banxa.model.request.PaginatedGetRequest Maven / Gradle / Ivy

The newest version!
package com.banxa.model.request;

public abstract class PaginatedGetRequest extends GetRequest {
    private final Integer perPage;
    private Integer page;

    public PaginatedGetRequest(Builder builder) {
        this.perPage = builder.perPage;
        this.page = builder.page;
    }

    public Integer getPerPage() {
        return perPage;
    }

    public Integer getPage() {
        return page;
    }

    public void nextPage() {
        page = page + 1;
    }

    public void previousPage() {
        page = page - 1;
    }

    public static abstract class Builder > {
        private Integer perPage;
        private Integer page = 1;

        public Builder() {
        }

        public T withPerPage(Integer perPage) {
            this.perPage = perPage;
            return (T) this;
        }

        public T withPage(Integer page) {
            this.page = page;
            return (T) this;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy