001/* 002 * Licensed to DuraSpace under one or more contributor license agreements. 003 * See the NOTICE file distributed with this work for additional information 004 * regarding copyright ownership. 005 * 006 * DuraSpace licenses this file to you under the Apache License, 007 * Version 2.0 (the "License"); you may not use this file except in 008 * compliance with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.fcrepo.search.api; 019 020import com.fasterxml.jackson.annotation.JsonProperty; 021 022/** 023 * A data structure representing the pagination information associated with a {@link org.fcrepo.search.api.SearchResult} 024 * 025 * @author dbernstein 026 */ 027public class PaginationInfo { 028 @JsonProperty 029 private int offset = -1; 030 @JsonProperty 031 private int maxResults = -1; 032 @JsonProperty 033 private int totalResults; 034 035 /** 036 * Default constructor 037 */ 038 public PaginationInfo() { } 039 040 /** 041 * Constructor 042 * 043 * @param maxResults max results asked off 044 * @param offset offset of the first result item 045 * @param totalResults The total number of results 046 */ 047 public PaginationInfo(final int maxResults, final int offset, final int totalResults) { 048 this.maxResults = maxResults; 049 this.offset = offset; 050 this.totalResults = totalResults; 051 } 052 053 /** 054 * @return The max results of the original query 055 */ 056 public int getMaxResults() { 057 return maxResults; 058 } 059 060 /** 061 * @return The offset specified by original query 062 */ 063 public int getOffset() { 064 return offset; 065 } 066 067 /** 068 * @return The total number of results for this query. 069 */ 070 public int getTotalResults() { 071 return this.totalResults; 072 } 073}