View Javadoc
1   package net.sumaris.core.dao.technical;
2   
3   /*-
4    * #%L
5    * SUMARiS:: Core shared
6    * %%
7    * Copyright (C) 2018 - 2019 SUMARiS Consortium
8    * %%
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   * 
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   * 
19   * You should have received a copy of the GNU General Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/gpl-3.0.html>.
22   * #L%
23   */
24  
25  import java.io.Serializable;
26  
27  /**
28   * @author Benoit Lavenier <benoit.lavenier@e-is.pro>*
29   */
30  public class Pageable implements Serializable {
31  
32      public static final Builder builder() {
33          return new Builder();
34      }
35  
36      public static class Builder {
37  
38          private Pageablel/Pageable.html#Pageable">Pageable pageable = new Pageable();
39  
40          public Builder setOffset(int offset) {
41              pageable.setOffset(offset);
42              return this;
43          }
44          public Builder setSize(int size) {
45              pageable.setSize(size);
46              return this;
47          }
48          public Builder setSortAttribute(String sortAttribute) {
49              pageable.setSortAttribute(sortAttribute);
50              return this;
51          }
52          public Builder setSortDirection(SortDirection sortDirection) {
53              pageable.setSortDirection(sortDirection);
54              return this;
55          }
56  
57          public Pageable build() {
58              return pageable;
59          }
60      }
61  
62  
63      private int offset;
64  
65      private int size;
66  
67      private String sortAttribute;
68  
69      private SortDirection sortDirection;
70  
71      public int getOffset() {
72          return offset;
73      }
74  
75      public void setOffset(int offset) {
76          this.offset = offset;
77      }
78  
79      public int getSize() {
80          return size;
81      }
82  
83      public void setSize(int size) {
84          this.size = size;
85      }
86  
87      public String getSortAttribute() {
88          return sortAttribute;
89      }
90  
91      public void setSortAttribute(String sortAttribute) {
92          this.sortAttribute = sortAttribute;
93      }
94  
95      public SortDirection getSortDirection() {
96          return sortDirection;
97      }
98  
99      public void setSortDirection(SortDirection sortDirection) {
100         this.sortDirection = sortDirection;
101     }
102 }
103