View Javadoc
1   /*
2    * Copyright (c) 2023. Roland T. Lichti, Kaiserpfalz EDV-Service.
3    *
4    * This program is free software: you can redistribute it and/or modify
5    * it under the terms of the GNU General Public License as published by
6    * the Free Software Foundation, either version 3 of the License, or
7    * (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16   */
17  
18  package de.kaiserpfalzedv.commons.api.resources;
19  
20  import com.fasterxml.jackson.annotation.JsonIgnore;
21  import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
22  import org.eclipse.microprofile.openapi.annotations.media.Schema;
23  
24  import jakarta.validation.constraints.Max;
25  import jakarta.validation.constraints.Min;
26  import jakarta.validation.constraints.NotNull;
27  import java.io.Serializable;
28  
29  /**
30   * <p>Paging -- .</p>
31   *
32   * @author rlichti {@literal <rlichti@kaiserpfalz-edv.de>}
33   * @since 1.0.0  2023-01-19
34   */
35  public interface Paging extends Serializable {
36      @JsonIgnore
37      @Schema(hidden = true)
38      @NotNull
39      Paging firstPage();
40  
41      @JsonIgnore
42      @Schema(hidden = true)
43      @NotNull
44      Paging previousPage();
45  
46      @JsonIgnore
47      @Schema(hidden = true)
48      @NotNull
49      Paging nextPage();
50  
51      @JsonIgnore
52      @Schema(hidden = true)
53      @NotNull
54      Paging lastPage();
55  
56      @Schema(description = "First element of total result set.", type = SchemaType.NUMBER, minimum = "0", maximum = "9223372036854775807", required = true)
57      @NotNull @Min(0) @Max(Long.MAX_VALUE)
58      long getStart();
59  
60      @Schema(description = "Number of requested elements of the total result set.", type = SchemaType.NUMBER, minimum = "0", maximum = "9223372036854775807", required = true)
61      @NotNull @Min(0) @Max(Long.MAX_VALUE)
62      long getSize();
63  
64      @Schema(description = "Count of elements in current page (may differ from size).", type = SchemaType.NUMBER, minimum = "0", maximum = "9223372036854775807", required = true)
65      @NotNull @Min(0) @Max(Long.MAX_VALUE)
66      long getCount();
67  
68      @Schema(description = "Count of elements in total result set.", type = SchemaType.NUMBER, minimum = "0", maximum = "9223372036854775807", required = true)
69      @NotNull @Min(0) @Max(Long.MAX_VALUE)
70      long getTotal();
71  }