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

smartsheet / smartsheet-java-sdk / #43

24 Aug 2023 10:26PM UTC coverage: 50.427% (-0.02%) from 50.442%
#43

push

github-actions

web-flow
Fix Checkstyle violations in api/models Classes (#57)

This will fix ~900 violations

189 of 189 new or added lines in 59 files covered. (100.0%)

3423 of 6788 relevant lines covered (50.43%)

0.5 hits per line

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

0.0
/src/main/java/com/smartsheet/api/models/RowWrapper.java
1
package com.smartsheet.api.models;
2

3
/*
4
 * #[license]
5
 * Smartsheet SDK for Java
6
 * %%
7
 * Copyright (C) 2023 Smartsheet
8
 * %%
9
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12
 *
13
 *      http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20
 * %[license]
21
 */
22

23
import java.util.List;
24

25
/**
26
 * Represents the RowWrapper object that is used to specify the location for a {@link Row} or set of Rows.
27
 */
28
public class RowWrapper {
×
29
    /**
30
     * Represents to-top flag that puts the row at the top of the sheet.
31
     */
32
    private Boolean toTop;
33

34
    /**
35
     * Represents to-bottom flag that puts the row at the bottom of the sheet.
36
     */
37
    private Boolean toBottom;
38

39
    /**
40
     * Represents the parent ID that puts the row as the first child of the specified id.
41
     */
42
    private Long parentId;
43

44
    /**
45
     * Represents the sibling ID that puts the row as the next row at the same hierarchical level of this row.
46
     */
47
    private Long siblingId;
48

49
    /**
50
     * Represents the rows.
51
     */
52
    private List<Row> rows;
53

54
    /**
55
     * Gets the to top flag that puts the row at the top of the sheet.
56
     *
57
     * @return the to top
58
     */
59
    public Boolean getToTop() {
60
        return toTop;
×
61
    }
62

63
    /**
64
     * Sets the to top flag that puts the row at the top of the sheet.
65
     *
66
     * @param toTop the new to top
67
     */
68
    public RowWrapper setToTop(Boolean toTop) {
69
        this.toTop = toTop;
×
70
        return this;
×
71
    }
72

73
    /**
74
     * Gets the to bottom flag that puts the row at the bottom of the sheet.
75
     *
76
     * @return the to bottom
77
     */
78
    public Boolean getToBottom() {
79
        return toBottom;
×
80
    }
81

82
    /**
83
     * Sets the to bottom flag that puts the row at the bottom of the sheet.
84
     *
85
     * @param toBottom the new to bottom
86
     */
87
    public RowWrapper setToBottom(Boolean toBottom) {
88
        this.toBottom = toBottom;
×
89
        return this;
×
90
    }
91

92
    /**
93
     * Gets the parent id that puts the row as the first child of the specified id.
94
     *
95
     * @return the parent id
96
     */
97
    public Long getParentId() {
98
        return parentId;
×
99
    }
100

101
    /**
102
     * Sets the parent id that puts the row as the first child of the specified id.
103
     *
104
     * @param parentId the new parent id
105
     */
106
    public RowWrapper setParentId(Long parentId) {
107
        this.parentId = parentId;
×
108
        return this;
×
109
    }
110

111
    /**
112
     * Gets the sibling id that puts the row as the next row at the same hierarchical level of this row.
113
     *
114
     * @return the sibling id
115
     */
116
    public Long getSiblingId() {
117
        return siblingId;
×
118
    }
119

120
    /**
121
     * Sets the sibling id that puts the row as the next row at the same hierarchical level of this row.
122
     *
123
     * @param siblingId the new sibling id
124
     */
125
    public RowWrapper setSiblingId(Long siblingId) {
126
        this.siblingId = siblingId;
×
127
        return this;
×
128
    }
129

130
    /**
131
     * Gets the rows.
132
     *
133
     * @return the rows
134
     */
135
    public List<Row> getRows() {
136
        return rows;
×
137
    }
138

139
    /**
140
     * Sets the rows.
141
     *
142
     * @param rows the new rows
143
     */
144
    public RowWrapper setRows(List<Row> rows) {
145
        this.rows = rows;
×
146
        return this;
×
147
    }
148

149
    /**
150
     * A convenience class for creating a {@link RowWrapper} with the necessary fields for inserting a {@link Row} or
151
     * set of rows.
152
     */
153
    public static class InsertRowsBuilder {
×
154
        private Boolean toTop;
155
        private Boolean toBottom;
156
        private Long parentId;
157
        private Long siblingId;
158
        private List<Row> rows;
159

160
        /**
161
         * Sets the to top flag that puts the row at the top of the sheet.
162
         *
163
         * @param toTop the to top flag
164
         * @return the insert rows builder
165
         */
166
        public InsertRowsBuilder setToTop(Boolean toTop) {
167
            this.toTop = toTop;
×
168
            return this;
×
169
        }
170

171
        /**
172
         * Sets the to bottom flag that puts the row at the bottom of the sheet.
173
         *
174
         * @param toBottom the to bottom
175
         * @return the insert rows builder
176
         */
177
        public InsertRowsBuilder setToBottom(Boolean toBottom) {
178
            this.toBottom = toBottom;
×
179
            return this;
×
180
        }
181

182
        /**
183
         * Sets the parent id that puts the row as the first child of the specified id.
184
         *
185
         * @param parentId the parent id
186
         * @return the insert rows builder
187
         */
188
        public InsertRowsBuilder setParentId(Long parentId) {
189
            this.parentId = parentId;
×
190
            return this;
×
191
        }
192

193
        /**
194
         * Sets the sibling id that puts the row as the next row at the same hierarchical level of this row.
195
         *
196
         * @param siblingId the sibling id
197
         * @return the insert rows builder
198
         */
199
        public InsertRowsBuilder setSiblingId(Long siblingId) {
200
            this.siblingId = siblingId;
×
201
            return this;
×
202
        }
203

204
        /**
205
         * Sets the rows.
206
         *
207
         * @param rows the rows
208
         * @return the insert rows builder
209
         */
210
        public InsertRowsBuilder setRows(List<Row> rows) {
211
            this.rows = rows;
×
212
            return this;
×
213
        }
214

215
        /**
216
         * Gets the to top.
217
         *
218
         * @return the to top
219
         */
220
        public Boolean getToTop() {
221
            return toTop;
×
222
        }
223

224
        /**
225
         * Gets the to bottom.
226
         *
227
         * @return the to bottom
228
         */
229
        public Boolean getToBottom() {
230
            return toBottom;
×
231
        }
232

233
        /**
234
         * Gets the parent id.
235
         *
236
         * @return the parent id
237
         */
238
        public Long getParentId() {
239
            return parentId;
×
240
        }
241

242
        /**
243
         * Gets the sibling id.
244
         *
245
         * @return the sibling id
246
         */
247
        public Long getSiblingId() {
248
            return siblingId;
×
249
        }
250

251
        /**
252
         * Gets the rows.
253
         *
254
         * @return the rows
255
         */
256
        public List<Row> getRows() {
257
            return rows;
×
258
        }
259

260
        /**
261
         * Builds the RowWrapper.
262
         *
263
         * @return the row wrapper
264
         */
265
        public RowWrapper build() throws InstantiationException {
266
            if (toTop == null && toBottom == null && parentId == null && siblingId == null) {
×
267
                throw new InstantiationException(
×
268
                        "One of the following fields must be set toTop, toBottom, parentId or sibling Id"
269
                );
270
            }
271

272
            RowWrapper rowWrapper = new RowWrapper();
×
273
            rowWrapper.toTop = toTop;
×
274
            rowWrapper.toBottom = toBottom;
×
275
            rowWrapper.parentId = parentId;
×
276
            rowWrapper.siblingId = siblingId;
×
277
            rowWrapper.rows = rows;
×
278
            return rowWrapper;
×
279
        }
280
    }
281

282
    /**
283
     * A convenience class for creating a {@link RowWrapper} with the necessary fields for moving a {@link Row} or set
284
     * of rows.
285
     */
286
    public static class MoveRowBuilder {
×
287
        private Boolean toTop;
288
        private Boolean toBottom;
289
        private Long parentId;
290
        private Long siblingId;
291

292
        /**
293
         * Sets the to top flag that puts the row at the top of the sheet.
294
         *
295
         * @param toTop the to top
296
         * @return the move row builder
297
         */
298
        public MoveRowBuilder setToTop(Boolean toTop) {
299
            this.toTop = toTop;
×
300
            return this;
×
301
        }
302

303
        /**
304
         * Sets the to bottom flag that puts the row at the bottom of the sheet.
305
         *
306
         * @param toBottom the to bottom
307
         * @return the move row builder
308
         */
309
        public MoveRowBuilder setToBottom(Boolean toBottom) {
310
            this.toBottom = toBottom;
×
311
            return this;
×
312
        }
313

314
        /**
315
         * Sets the parent id that puts the row as the first child of the specified id.
316
         *
317
         * @param parentId the parent id
318
         * @return the move row builder
319
         */
320
        public MoveRowBuilder setParentId(Long parentId) {
321
            this.parentId = parentId;
×
322
            return this;
×
323
        }
324

325
        /**
326
         * Sets the sibling id that puts the row as the next row at the same hierarchical level of this row.
327
         *
328
         * @param siblingId the sibling id
329
         * @return the move row builder
330
         */
331
        public MoveRowBuilder setSiblingId(Long siblingId) {
332
            this.siblingId = siblingId;
×
333
            return this;
×
334
        }
335

336
        /**
337
         * Gets the to top.
338
         *
339
         * @return the to top
340
         */
341
        public Boolean getToTop() {
342
            return toTop;
×
343
        }
344

345
        /**
346
         * Gets the to bottom.
347
         *
348
         * @return the to bottom
349
         */
350
        public Boolean getToBottom() {
351
            return toBottom;
×
352
        }
353

354
        /**
355
         * Gets the parent id.
356
         *
357
         * @return the parent id
358
         */
359
        public Long getParentId() {
360
            return parentId;
×
361
        }
362

363
        /**
364
         * Gets the sibling id.
365
         *
366
         * @return the sibling id
367
         */
368
        public Long getSiblingId() {
369
            return siblingId;
×
370
        }
371

372
        /**
373
         * Builds the RowWrapper.
374
         *
375
         * @return the row wrapper
376
         */
377
        public RowWrapper build() {
378
            if (toTop == null && toBottom == null && parentId == null && siblingId == null) {
×
379
                throw new InstantiationError(
×
380
                        "One of the following must be defined to move a row: toTop, toBottom, parentId, siblingId."
381
                );
382
            }
383

384
            RowWrapper rowWrapper = new RowWrapper();
×
385
            rowWrapper.toTop = toTop;
×
386
            rowWrapper.toBottom = toBottom;
×
387
            rowWrapper.parentId = parentId;
×
388
            rowWrapper.siblingId = siblingId;
×
389
            return rowWrapper;
×
390
        }
391
    }
392
}
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

© 2026 Coveralls, Inc