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

smartsheet / smartsheet-java-sdk / #56

06 Jun 2025 04:28PM UTC coverage: 60.611% (+0.06%) from 60.548%
#56

push

github

web-flow
chore: Added pull request template (#121)

* Initial commit: Added pull request template

* Updated wording and grammar

* Added relevant links and removed style guide requirement

* chore: Updated pull request template and added codeowners file

* chore: Removed redundant checklist point and codeowners file

---------

Co-authored-by: Priyanka Lakhe <priyankalakhe@gmail.com>

4164 of 6870 relevant lines covered (60.61%)

0.61 hits per line

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

85.71
/src/main/java/com/smartsheet/api/models/Comment.java
1
/*
2
 * Copyright (C) 2025 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 java.util.Date;
20
import java.util.List;
21

22
/**
23
 * Represents the Comment object.
24
 */
25
public class Comment extends IdentifiableModel<Long> {
26

27
    /**
28
     * Represents the text for the comment.
29
     */
30
    private String text;
31

32
    /**
33
     * Represents the user that created the comment.
34
     */
35
    private User createdBy;
36

37
    /**
38
     * Represents the date the comment was modified.
39
     *
40
     * @deprecated use modifiedAt instead.
41
     */
42
    @Deprecated(since = "3.2.3", forRemoval = true)
43
    private Date modifiedDate;
44

45
    /**
46
     * Represents the attachments for the comment.
47
     */
48
    private List<Attachment> attachments;
49

50
    /**
51
     * Represents the discussion ID.
52
     */
53
    private Long discussionId;
54

55
    /**
56
     * The date the comment was created.
57
     */
58
    private Date createdAt;
59

60
    /**
61
     * The date the comment was last modified.
62
     */
63
    private Date modifiedAt;
64

65
    /**
66
     * Constructors
67
     */
68
    public Comment() {
1✔
69
    }
1✔
70

71
    public Comment(String text) {
×
72
        setText(text);
×
73
    }
×
74

75
    /**
76
     * Gets the text for the comment.
77
     *
78
     * @return the text
79
     */
80
    public String getText() {
81
        return text;
1✔
82
    }
83

84
    /**
85
     * Sets the text for the comment.
86
     *
87
     * @param text the new text
88
     */
89
    public Comment setText(String text) {
90
        this.text = text;
1✔
91
        return this;
1✔
92
    }
93

94
    /**
95
     * Gets user that created the comment.
96
     *
97
     * @return the created by
98
     */
99
    public User getCreatedBy() {
100
        return createdBy;
1✔
101
    }
102

103
    /**
104
     * Sets the user that created the comment.
105
     *
106
     * @param createdBy the new created by
107
     */
108
    public Comment setCreatedBy(User createdBy) {
109
        this.createdBy = createdBy;
1✔
110
        return this;
1✔
111
    }
112

113
    /**
114
     * Gets the date the comment was last modified.
115
     *
116
     * @return the modified date
117
     * @deprecated use getModifiedAt instead.
118
     */
119
    @Deprecated(since = "3.2.3", forRemoval = true)
120
    public Date getModifiedDate() {
121
        return modifiedDate;
1✔
122
    }
123

124
    /**
125
     * Sets the date the comment was last modified.
126
     *
127
     * @param modifiedDate the new modified date
128
     * @deprecated use setModifiedAt instead.
129
     */
130
    @Deprecated(since = "3.2.3", forRemoval = true)
131
    public Comment setModifiedDate(Date modifiedDate) {
132
        this.modifiedDate = modifiedDate;
1✔
133
        return this;
1✔
134
    }
135

136
    /**
137
     * Gets the comment attachments.
138
     *
139
     * @return the attachments
140
     */
141
    public List<Attachment> getAttachments() {
142
        return attachments;
1✔
143
    }
144

145
    /**
146
     * Sets the comment attachments.
147
     *
148
     * @param attachments the new attachments
149
     */
150
    public Comment setAttachments(List<Attachment> attachments) {
151
        this.attachments = attachments;
1✔
152
        return this;
1✔
153
    }
154

155
    /**
156
     * Gets the discussion id.
157
     *
158
     * @return the discussion id
159
     */
160
    public Long getDiscussionId() {
161
        return discussionId;
1✔
162
    }
163

164
    /**
165
     * Sets the discussion id.
166
     *
167
     * @param discussionId the new discussion id
168
     */
169
    public Comment setDiscussionId(Long discussionId) {
170
        this.discussionId = discussionId;
1✔
171
        return this;
1✔
172
    }
173

174
    /**
175
     * Gets the date the comment was created.
176
     *
177
     * @return the created at
178
     */
179
    public Date getCreatedAt() {
180
        return createdAt;
1✔
181
    }
182

183
    /**
184
     * Sets the date the comment was created.
185
     *
186
     * @param createdAt the new created at
187
     */
188
    public Comment setCreatedAt(Date createdAt) {
189
        this.createdAt = createdAt;
1✔
190
        return this;
1✔
191
    }
192

193
    /**
194
     * Gets the date the comment was modified.
195
     *
196
     * @return the modified at
197
     */
198
    public Date getModifiedAt() {
199
        return modifiedAt;
1✔
200
    }
201

202
    /**
203
     * Sets the date the comment was modified.
204
     *
205
     * @param modifiedAt the new modified at
206
     */
207
    public Comment setModifiedAt(Date modifiedAt) {
208
        this.modifiedAt = modifiedAt;
1✔
209
        return this;
1✔
210
    }
211

212
    /**
213
     * A convenience class to generate a comment with the appropriate fields for adding it to a sheet.
214
     */
215
    public static class AddCommentBuilder {
1✔
216

217
        /**
218
         * The text.
219
         */
220
        private String text;
221

222
        /**
223
         * The text for the comment.
224
         *
225
         * @param text the text
226
         * @return the adds the comment builder
227
         */
228
        public AddCommentBuilder setText(String text) {
229
            this.text = text;
1✔
230
            return this;
1✔
231
        }
232

233
        /**
234
         * Gets the text for the comment.
235
         *
236
         * @return the text
237
         */
238
        public String getText() {
239
            return text;
×
240
        }
241

242
        /**
243
         * Builds the comment.
244
         *
245
         * @return the comment
246
         */
247
        public Comment build() {
248
            if (text == null) {
1✔
249
                throw new InstantiationError("The comment text is required.");
×
250
            }
251

252
            Comment comment = new Comment();
1✔
253
            comment.text = text;
1✔
254
            return comment;
1✔
255
        }
256
    }
257
}
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