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

box / box-java-sdk / #5076

07 Oct 2025 12:35PM UTC coverage: 37.132% (+0.007%) from 37.125%
#5076

push

github

web-flow
test: Change `Event.additionalDetails` field assertion in events test (box/box-codegen#858) (#1491)

18454 of 49699 relevant lines covered (37.13%)

0.37 hits per line

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

13.45
/src/main/java/com/box/sdkgen/schemas/file/File.java
1
package com.box.sdkgen.schemas.file;
2

3
import com.box.sdkgen.internal.Nullable;
4
import com.box.sdkgen.internal.utils.DateTimeUtils;
5
import com.box.sdkgen.schemas.filebase.FileBaseTypeField;
6
import com.box.sdkgen.schemas.filemini.FileMini;
7
import com.box.sdkgen.schemas.fileversionmini.FileVersionMini;
8
import com.box.sdkgen.schemas.foldermini.FolderMini;
9
import com.box.sdkgen.schemas.usermini.UserMini;
10
import com.box.sdkgen.serialization.json.EnumWrapper;
11
import com.fasterxml.jackson.annotation.JsonFilter;
12
import com.fasterxml.jackson.annotation.JsonProperty;
13
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
14
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
15
import java.time.OffsetDateTime;
16
import java.util.Objects;
17

18
/** A standard representation of a file, as returned from any file API endpoints by default. */
19
@JsonFilter("nullablePropertyFilter")
20
public class File extends FileMini {
21

22
  /**
23
   * The optional description of this file. If the description exceeds 255 characters, the first 255
24
   * characters are set as a file description and the rest of it is ignored.
25
   */
26
  protected String description;
27

28
  /**
29
   * The file size in bytes. Be careful parsing this integer as it can get very large and cause an
30
   * integer overflow.
31
   */
32
  protected Long size;
33

34
  @JsonProperty("path_collection")
35
  protected FilePathCollectionField pathCollection;
36

37
  /** The date and time when the file was created on Box. */
38
  @JsonProperty("created_at")
39
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
40
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
41
  protected OffsetDateTime createdAt;
42

43
  /** The date and time when the file was last updated on Box. */
44
  @JsonProperty("modified_at")
45
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
46
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
47
  protected OffsetDateTime modifiedAt;
48

49
  /** The time at which this file was put in the trash. */
50
  @JsonProperty("trashed_at")
51
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
52
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
53
  @Nullable
54
  protected OffsetDateTime trashedAt;
55

56
  /** The time at which this file is expected to be purged from the trash. */
57
  @JsonProperty("purged_at")
58
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
59
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
60
  @Nullable
61
  protected OffsetDateTime purgedAt;
62

63
  /**
64
   * The date and time at which this file was originally created, which might be before it was
65
   * uploaded to Box.
66
   */
67
  @JsonProperty("content_created_at")
68
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
69
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
70
  @Nullable
71
  protected OffsetDateTime contentCreatedAt;
72

73
  /**
74
   * The date and time at which this file was last updated, which might be before it was uploaded to
75
   * Box.
76
   */
77
  @JsonProperty("content_modified_at")
78
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
79
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
80
  @Nullable
81
  protected OffsetDateTime contentModifiedAt;
82

83
  @JsonProperty("created_by")
84
  protected UserMini createdBy;
85

86
  @JsonProperty("modified_by")
87
  protected UserMini modifiedBy;
88

89
  @JsonProperty("owned_by")
90
  protected UserMini ownedBy;
91

92
  @JsonProperty("shared_link")
93
  protected FileSharedLinkField sharedLink;
94

95
  @Nullable protected FolderMini parent;
96

97
  /**
98
   * Defines if this item has been deleted or not.
99
   *
100
   * <p>* `active` when the item has is not in the trash * `trashed` when the item has been moved to
101
   * the trash but not deleted * `deleted` when the item has been permanently deleted.
102
   */
103
  @JsonDeserialize(using = FileItemStatusField.FileItemStatusFieldDeserializer.class)
104
  @JsonSerialize(using = FileItemStatusField.FileItemStatusFieldSerializer.class)
105
  @JsonProperty("item_status")
106
  protected EnumWrapper<FileItemStatusField> itemStatus;
107

108
  public File(@JsonProperty("id") String id) {
109
    super(id);
1✔
110
  }
1✔
111

112
  protected File(Builder builder) {
113
    super(builder);
×
114
    this.description = builder.description;
×
115
    this.size = builder.size;
×
116
    this.pathCollection = builder.pathCollection;
×
117
    this.createdAt = builder.createdAt;
×
118
    this.modifiedAt = builder.modifiedAt;
×
119
    this.trashedAt = builder.trashedAt;
×
120
    this.purgedAt = builder.purgedAt;
×
121
    this.contentCreatedAt = builder.contentCreatedAt;
×
122
    this.contentModifiedAt = builder.contentModifiedAt;
×
123
    this.createdBy = builder.createdBy;
×
124
    this.modifiedBy = builder.modifiedBy;
×
125
    this.ownedBy = builder.ownedBy;
×
126
    this.sharedLink = builder.sharedLink;
×
127
    this.parent = builder.parent;
×
128
    this.itemStatus = builder.itemStatus;
×
129
    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
×
130
  }
×
131

132
  public String getDescription() {
133
    return description;
1✔
134
  }
135

136
  public Long getSize() {
137
    return size;
1✔
138
  }
139

140
  public FilePathCollectionField getPathCollection() {
141
    return pathCollection;
×
142
  }
143

144
  public OffsetDateTime getCreatedAt() {
145
    return createdAt;
1✔
146
  }
147

148
  public OffsetDateTime getModifiedAt() {
149
    return modifiedAt;
1✔
150
  }
151

152
  public OffsetDateTime getTrashedAt() {
153
    return trashedAt;
1✔
154
  }
155

156
  public OffsetDateTime getPurgedAt() {
157
    return purgedAt;
1✔
158
  }
159

160
  public OffsetDateTime getContentCreatedAt() {
161
    return contentCreatedAt;
1✔
162
  }
163

164
  public OffsetDateTime getContentModifiedAt() {
165
    return contentModifiedAt;
1✔
166
  }
167

168
  public UserMini getCreatedBy() {
169
    return createdBy;
1✔
170
  }
171

172
  public UserMini getModifiedBy() {
173
    return modifiedBy;
1✔
174
  }
175

176
  public UserMini getOwnedBy() {
177
    return ownedBy;
1✔
178
  }
179

180
  public FileSharedLinkField getSharedLink() {
181
    return sharedLink;
1✔
182
  }
183

184
  public FolderMini getParent() {
185
    return parent;
1✔
186
  }
187

188
  public EnumWrapper<FileItemStatusField> getItemStatus() {
189
    return itemStatus;
1✔
190
  }
191

192
  @Override
193
  public boolean equals(Object o) {
194
    if (this == o) {
×
195
      return true;
×
196
    }
197
    if (o == null || getClass() != o.getClass()) {
×
198
      return false;
×
199
    }
200
    File casted = (File) o;
×
201
    return Objects.equals(id, casted.id)
×
202
        && Objects.equals(etag, casted.etag)
×
203
        && Objects.equals(type, casted.type)
×
204
        && Objects.equals(sequenceId, casted.sequenceId)
×
205
        && Objects.equals(name, casted.name)
×
206
        && Objects.equals(sha1, casted.sha1)
×
207
        && Objects.equals(fileVersion, casted.fileVersion)
×
208
        && Objects.equals(description, casted.description)
×
209
        && Objects.equals(size, casted.size)
×
210
        && Objects.equals(pathCollection, casted.pathCollection)
×
211
        && Objects.equals(createdAt, casted.createdAt)
×
212
        && Objects.equals(modifiedAt, casted.modifiedAt)
×
213
        && Objects.equals(trashedAt, casted.trashedAt)
×
214
        && Objects.equals(purgedAt, casted.purgedAt)
×
215
        && Objects.equals(contentCreatedAt, casted.contentCreatedAt)
×
216
        && Objects.equals(contentModifiedAt, casted.contentModifiedAt)
×
217
        && Objects.equals(createdBy, casted.createdBy)
×
218
        && Objects.equals(modifiedBy, casted.modifiedBy)
×
219
        && Objects.equals(ownedBy, casted.ownedBy)
×
220
        && Objects.equals(sharedLink, casted.sharedLink)
×
221
        && Objects.equals(parent, casted.parent)
×
222
        && Objects.equals(itemStatus, casted.itemStatus);
×
223
  }
224

225
  @Override
226
  public int hashCode() {
227
    return Objects.hash(
×
228
        id,
229
        etag,
230
        type,
231
        sequenceId,
232
        name,
233
        sha1,
234
        fileVersion,
235
        description,
236
        size,
237
        pathCollection,
238
        createdAt,
239
        modifiedAt,
240
        trashedAt,
241
        purgedAt,
242
        contentCreatedAt,
243
        contentModifiedAt,
244
        createdBy,
245
        modifiedBy,
246
        ownedBy,
247
        sharedLink,
248
        parent,
249
        itemStatus);
250
  }
251

252
  @Override
253
  public String toString() {
254
    return "File{"
×
255
        + "id='"
256
        + id
257
        + '\''
258
        + ", "
259
        + "etag='"
260
        + etag
261
        + '\''
262
        + ", "
263
        + "type='"
264
        + type
265
        + '\''
266
        + ", "
267
        + "sequenceId='"
268
        + sequenceId
269
        + '\''
270
        + ", "
271
        + "name='"
272
        + name
273
        + '\''
274
        + ", "
275
        + "sha1='"
276
        + sha1
277
        + '\''
278
        + ", "
279
        + "fileVersion='"
280
        + fileVersion
281
        + '\''
282
        + ", "
283
        + "description='"
284
        + description
285
        + '\''
286
        + ", "
287
        + "size='"
288
        + size
289
        + '\''
290
        + ", "
291
        + "pathCollection='"
292
        + pathCollection
293
        + '\''
294
        + ", "
295
        + "createdAt='"
296
        + createdAt
297
        + '\''
298
        + ", "
299
        + "modifiedAt='"
300
        + modifiedAt
301
        + '\''
302
        + ", "
303
        + "trashedAt='"
304
        + trashedAt
305
        + '\''
306
        + ", "
307
        + "purgedAt='"
308
        + purgedAt
309
        + '\''
310
        + ", "
311
        + "contentCreatedAt='"
312
        + contentCreatedAt
313
        + '\''
314
        + ", "
315
        + "contentModifiedAt='"
316
        + contentModifiedAt
317
        + '\''
318
        + ", "
319
        + "createdBy='"
320
        + createdBy
321
        + '\''
322
        + ", "
323
        + "modifiedBy='"
324
        + modifiedBy
325
        + '\''
326
        + ", "
327
        + "ownedBy='"
328
        + ownedBy
329
        + '\''
330
        + ", "
331
        + "sharedLink='"
332
        + sharedLink
333
        + '\''
334
        + ", "
335
        + "parent='"
336
        + parent
337
        + '\''
338
        + ", "
339
        + "itemStatus='"
340
        + itemStatus
341
        + '\''
342
        + "}";
343
  }
344

345
  public static class Builder extends FileMini.Builder {
346

347
    protected String description;
348

349
    protected Long size;
350

351
    protected FilePathCollectionField pathCollection;
352

353
    protected OffsetDateTime createdAt;
354

355
    protected OffsetDateTime modifiedAt;
356

357
    protected OffsetDateTime trashedAt;
358

359
    protected OffsetDateTime purgedAt;
360

361
    protected OffsetDateTime contentCreatedAt;
362

363
    protected OffsetDateTime contentModifiedAt;
364

365
    protected UserMini createdBy;
366

367
    protected UserMini modifiedBy;
368

369
    protected UserMini ownedBy;
370

371
    protected FileSharedLinkField sharedLink;
372

373
    protected FolderMini parent;
374

375
    protected EnumWrapper<FileItemStatusField> itemStatus;
376

377
    public Builder(String id) {
378
      super(id);
×
379
    }
×
380

381
    public Builder description(String description) {
382
      this.description = description;
×
383
      return this;
×
384
    }
385

386
    public Builder size(Long size) {
387
      this.size = size;
×
388
      return this;
×
389
    }
390

391
    public Builder pathCollection(FilePathCollectionField pathCollection) {
392
      this.pathCollection = pathCollection;
×
393
      return this;
×
394
    }
395

396
    public Builder createdAt(OffsetDateTime createdAt) {
397
      this.createdAt = createdAt;
×
398
      return this;
×
399
    }
400

401
    public Builder modifiedAt(OffsetDateTime modifiedAt) {
402
      this.modifiedAt = modifiedAt;
×
403
      return this;
×
404
    }
405

406
    public Builder trashedAt(OffsetDateTime trashedAt) {
407
      this.trashedAt = trashedAt;
×
408
      this.markNullableFieldAsSet("trashed_at");
×
409
      return this;
×
410
    }
411

412
    public Builder purgedAt(OffsetDateTime purgedAt) {
413
      this.purgedAt = purgedAt;
×
414
      this.markNullableFieldAsSet("purged_at");
×
415
      return this;
×
416
    }
417

418
    public Builder contentCreatedAt(OffsetDateTime contentCreatedAt) {
419
      this.contentCreatedAt = contentCreatedAt;
×
420
      this.markNullableFieldAsSet("content_created_at");
×
421
      return this;
×
422
    }
423

424
    public Builder contentModifiedAt(OffsetDateTime contentModifiedAt) {
425
      this.contentModifiedAt = contentModifiedAt;
×
426
      this.markNullableFieldAsSet("content_modified_at");
×
427
      return this;
×
428
    }
429

430
    public Builder createdBy(UserMini createdBy) {
431
      this.createdBy = createdBy;
×
432
      return this;
×
433
    }
434

435
    public Builder modifiedBy(UserMini modifiedBy) {
436
      this.modifiedBy = modifiedBy;
×
437
      return this;
×
438
    }
439

440
    public Builder ownedBy(UserMini ownedBy) {
441
      this.ownedBy = ownedBy;
×
442
      return this;
×
443
    }
444

445
    public Builder sharedLink(FileSharedLinkField sharedLink) {
446
      this.sharedLink = sharedLink;
×
447
      return this;
×
448
    }
449

450
    public Builder parent(FolderMini parent) {
451
      this.parent = parent;
×
452
      this.markNullableFieldAsSet("parent");
×
453
      return this;
×
454
    }
455

456
    public Builder itemStatus(FileItemStatusField itemStatus) {
457
      this.itemStatus = new EnumWrapper<FileItemStatusField>(itemStatus);
×
458
      return this;
×
459
    }
460

461
    public Builder itemStatus(EnumWrapper<FileItemStatusField> itemStatus) {
462
      this.itemStatus = itemStatus;
×
463
      return this;
×
464
    }
465

466
    @Override
467
    public Builder etag(String etag) {
468
      this.etag = etag;
×
469
      this.markNullableFieldAsSet("etag");
×
470
      return this;
×
471
    }
472

473
    @Override
474
    public Builder type(FileBaseTypeField type) {
475
      this.type = new EnumWrapper<FileBaseTypeField>(type);
×
476
      return this;
×
477
    }
478

479
    @Override
480
    public Builder type(EnumWrapper<FileBaseTypeField> type) {
481
      this.type = type;
×
482
      return this;
×
483
    }
484

485
    @Override
486
    public Builder sequenceId(String sequenceId) {
487
      this.sequenceId = sequenceId;
×
488
      return this;
×
489
    }
490

491
    @Override
492
    public Builder name(String name) {
493
      this.name = name;
×
494
      return this;
×
495
    }
496

497
    @Override
498
    public Builder sha1(String sha1) {
499
      this.sha1 = sha1;
×
500
      return this;
×
501
    }
502

503
    @Override
504
    public Builder fileVersion(FileVersionMini fileVersion) {
505
      this.fileVersion = fileVersion;
×
506
      return this;
×
507
    }
508

509
    public File build() {
510
      return new File(this);
×
511
    }
512
  }
513
}
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