• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

smartsheet / smartsheet-java-sdk / #55

02 Oct 2024 07:40PM UTC coverage: 60.548% (+0.7%) from 59.836%
#55

push

github

web-flow
Release prep for 3.2.1 (#103)

4156 of 6864 relevant lines covered (60.55%)

0.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.5
/src/main/java/com/smartsheet/api/models/PaginationParameters.java
1
/*
2
 * Copyright (C) 2024 Smartsheet
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.smartsheet.api.models;
18

19
import com.smartsheet.api.internal.util.QueryUtil;
20

21
import java.util.HashMap;
22
import java.util.Map;
23

24
public class PaginationParameters {
25
    /**
26
     * Represents the includeAll option
27
     */
28
    private boolean includeAll;
29

30
    /**
31
     * Represents the page size
32
     */
33
    private Integer pageSize;
34

35
    /**
36
     * Represents the page
37
     */
38
    private Integer page;
39

40
    public PaginationParameters() {
1✔
41
    }
1✔
42

43
    /**
44
     * Constructor
45
     */
46
    public PaginationParameters(boolean includeAll, Integer pageSize, Integer page) {
1✔
47
        this.includeAll = includeAll;
1✔
48
        this.pageSize = pageSize;
1✔
49
        this.page = page;
1✔
50
    }
1✔
51

52
    /**
53
     * Gets includeAll
54
     *
55
     * @return includeAll
56
     */
57
    public boolean isIncludeAll() {
58
        return includeAll;
1✔
59
    }
60

61
    /**
62
     * Sets includeAll
63
     *
64
     * @param includeAll include all parameter
65
     */
66
    public PaginationParameters setIncludeAll(boolean includeAll) {
67
        this.includeAll = includeAll;
1✔
68
        return this;
1✔
69
    }
70

71
    /**
72
     * Gets the page size
73
     *
74
     * @return page size
75
     */
76
    public Integer getPageSize() {
77
        return pageSize;
1✔
78
    }
79

80
    /**
81
     * Sets the page size
82
     *
83
     * @param pageSize the page size
84
     */
85
    public PaginationParameters setPageSize(Integer pageSize) {
86
        this.pageSize = pageSize;
1✔
87
        return this;
1✔
88
    }
89

90
    /**
91
     * Gets the page
92
     *
93
     * @return page the page number
94
     */
95
    public Integer getPage() {
96
        return page;
1✔
97
    }
98

99
    /**
100
     * Sets the page
101
     *
102
     * @param page the page number
103
     */
104
    public PaginationParameters setPage(Integer page) {
105
        this.page = page;
1✔
106
        return this;
1✔
107
    }
108

109
    /**
110
     * Convert to a query string
111
     */
112
    public String toQueryString() {
113
        Map<String, Object> parameters = toHashMap();
1✔
114
        return QueryUtil.generateUrl(null, parameters);
1✔
115
    }
116

117
    /**
118
     * Convert to a hash map
119
     */
120
    public Map<String, Object> toHashMap() {
121
        Map<String, Object> parameters = new HashMap<>();
1✔
122

123
        parameters.put("includeAll", Boolean.toString(includeAll));
1✔
124
        if (includeAll) {
1✔
125
            return parameters;
1✔
126
        } else {
127
            parameters.put("pageSize", pageSize);
1✔
128
            parameters.put("page", page);
1✔
129
            return parameters;
1✔
130
        }
131
    }
132

133
    /**
134
     * A convenience class for creating a PaginationParameters object
135
     */
136
    public static class PaginationParametersBuilder {
1✔
137
        private boolean includeAll;
138
        private Integer pageSize;
139
        private Integer page;
140

141
        /**
142
         * Gets the include all flag
143
         *
144
         * @return the include all flag
145
         */
146
        public boolean isIncludeAll() {
147
            return includeAll;
×
148
        }
149

150
        /**
151
         * Sets the include All Flag
152
         *
153
         * @param includeAll the include all flag
154
         * @return the builder
155
         */
156
        public PaginationParametersBuilder setIncludeAll(boolean includeAll) {
157
            this.includeAll = includeAll;
1✔
158
            return this;
1✔
159
        }
160

161
        /**
162
         * Gets the page
163
         *
164
         * @return the page
165
         */
166
        public Integer getPage() {
167
            return page;
×
168
        }
169

170
        /**
171
         * Sets the page
172
         *
173
         * @param page the page
174
         * @return the builder
175
         */
176
        public PaginationParametersBuilder setPage(Integer page) {
177
            this.page = page;
1✔
178
            return this;
1✔
179
        }
180

181
        /**
182
         * Gets the page size
183
         *
184
         * @return the page size
185
         */
186
        public Integer getPageSize() {
187
            return pageSize;
×
188
        }
189

190
        /**
191
         * Sets the page size
192
         *
193
         * @param pageSize the page size
194
         * @return the builder
195
         */
196
        public PaginationParametersBuilder setPageSize(Integer pageSize) {
197
            this.pageSize = pageSize;
1✔
198
            return this;
1✔
199
        }
200

201
        /**
202
         * Builds the PaginationParameters object
203
         *
204
         * @return pagination parameter object
205
         */
206
        public PaginationParameters build() {
207
            PaginationParameters pagination = new PaginationParameters();
1✔
208
            pagination.setIncludeAll(includeAll);
1✔
209
            pagination.setPageSize(pageSize);
1✔
210
            pagination.setPage(page);
1✔
211

212
            return pagination;
1✔
213
        }
214
    }
215
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc