• 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

9.76
/src/main/java/com/box/sdkgen/schemas/trashfile/TrashFile.java
1
package com.box.sdkgen.schemas.trashfile;
2

3
import com.box.sdkgen.internal.Nullable;
4
import com.box.sdkgen.internal.NullableFieldTracker;
5
import com.box.sdkgen.internal.SerializableObject;
6
import com.box.sdkgen.internal.utils.DateTimeUtils;
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
/** Represents a trashed file. */
19
@JsonFilter("nullablePropertyFilter")
20
public class TrashFile extends SerializableObject {
21

22
  /**
23
   * The unique identifier that represent a file.
24
   *
25
   * <p>The ID for any file can be determined by visiting a file in the web application and copying
26
   * the ID from the URL. For example, for the URL `https://*.app.box.com/files/123` the `file_id`
27
   * is `123`.
28
   */
29
  protected final String id;
30

31
  /**
32
   * The HTTP `etag` of this file. This can be used within some API endpoints in the `If-Match` and
33
   * `If-None-Match` headers to only perform changes on the file if (no) changes have happened.
34
   */
35
  @Nullable protected String etag;
36

37
  /** The value will always be `file`. */
38
  @JsonDeserialize(using = TrashFileTypeField.TrashFileTypeFieldDeserializer.class)
39
  @JsonSerialize(using = TrashFileTypeField.TrashFileTypeFieldSerializer.class)
40
  protected EnumWrapper<TrashFileTypeField> type;
41

42
  @JsonProperty("sequence_id")
43
  protected final String sequenceId;
44

45
  /** The name of the file. */
46
  protected String name;
47

48
  /**
49
   * The SHA1 hash of the file. This can be used to compare the contents of a file on Box with a
50
   * local file.
51
   */
52
  protected final String sha1;
53

54
  @JsonProperty("file_version")
55
  protected FileVersionMini fileVersion;
56

57
  /** The optional description of this file. */
58
  protected final String description;
59

60
  /**
61
   * The file size in bytes. Be careful parsing this integer as it can get very large and cause an
62
   * integer overflow.
63
   */
64
  protected final long size;
65

66
  @JsonProperty("path_collection")
67
  protected final TrashFilePathCollectionField pathCollection;
68

69
  /** The date and time when the file was created on Box. */
70
  @JsonProperty("created_at")
71
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
72
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
73
  protected final OffsetDateTime createdAt;
74

75
  /** The date and time when the file was last updated on Box. */
76
  @JsonProperty("modified_at")
77
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
78
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
79
  protected final OffsetDateTime modifiedAt;
80

81
  /** The time at which this file was put in the trash. */
82
  @JsonProperty("trashed_at")
83
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
84
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
85
  @Nullable
86
  protected OffsetDateTime trashedAt;
87

88
  /** The time at which this file is expected to be purged from the trash. */
89
  @JsonProperty("purged_at")
90
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
91
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
92
  @Nullable
93
  protected OffsetDateTime purgedAt;
94

95
  /**
96
   * The date and time at which this file was originally created, which might be before it was
97
   * uploaded to Box.
98
   */
99
  @JsonProperty("content_created_at")
100
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
101
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
102
  @Nullable
103
  protected OffsetDateTime contentCreatedAt;
104

105
  /**
106
   * The date and time at which this file was last updated, which might be before it was uploaded to
107
   * Box.
108
   */
109
  @JsonProperty("content_modified_at")
110
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
111
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
112
  @Nullable
113
  protected OffsetDateTime contentModifiedAt;
114

115
  @JsonProperty("created_by")
116
  protected UserMini createdBy;
117

118
  @JsonProperty("modified_by")
119
  protected final UserMini modifiedBy;
120

121
  @JsonProperty("owned_by")
122
  protected final UserMini ownedBy;
123

124
  /**
125
   * The shared link for this file. This will be `null` if a file has been trashed, since the link
126
   * will no longer be active.
127
   */
128
  @JsonProperty("shared_link")
129
  @Nullable
130
  protected String sharedLink;
131

132
  protected FolderMini parent;
133

134
  /**
135
   * Defines if this item has been deleted or not.
136
   *
137
   * <p>* `active` when the item has is not in the trash * `trashed` when the item has been moved to
138
   * the trash but not deleted * `deleted` when the item has been permanently deleted.
139
   */
140
  @JsonDeserialize(using = TrashFileItemStatusField.TrashFileItemStatusFieldDeserializer.class)
141
  @JsonSerialize(using = TrashFileItemStatusField.TrashFileItemStatusFieldSerializer.class)
142
  @JsonProperty("item_status")
143
  protected final EnumWrapper<TrashFileItemStatusField> itemStatus;
144

145
  public TrashFile(
146
      String id,
147
      String sequenceId,
148
      String sha1,
149
      String description,
150
      long size,
151
      TrashFilePathCollectionField pathCollection,
152
      OffsetDateTime createdAt,
153
      OffsetDateTime modifiedAt,
154
      UserMini modifiedBy,
155
      UserMini ownedBy,
156
      TrashFileItemStatusField itemStatus) {
157
    super();
×
158
    this.id = id;
×
159
    this.sequenceId = sequenceId;
×
160
    this.sha1 = sha1;
×
161
    this.description = description;
×
162
    this.size = size;
×
163
    this.pathCollection = pathCollection;
×
164
    this.createdAt = createdAt;
×
165
    this.modifiedAt = modifiedAt;
×
166
    this.modifiedBy = modifiedBy;
×
167
    this.ownedBy = ownedBy;
×
168
    this.itemStatus = new EnumWrapper<TrashFileItemStatusField>(itemStatus);
×
169
    this.type = new EnumWrapper<TrashFileTypeField>(TrashFileTypeField.FILE);
×
170
  }
×
171

172
  public TrashFile(
173
      @JsonProperty("id") String id,
174
      @JsonProperty("sequence_id") String sequenceId,
175
      @JsonProperty("sha1") String sha1,
176
      @JsonProperty("description") String description,
177
      @JsonProperty("size") long size,
178
      @JsonProperty("path_collection") TrashFilePathCollectionField pathCollection,
179
      @JsonProperty("created_at") OffsetDateTime createdAt,
180
      @JsonProperty("modified_at") OffsetDateTime modifiedAt,
181
      @JsonProperty("modified_by") UserMini modifiedBy,
182
      @JsonProperty("owned_by") UserMini ownedBy,
183
      @JsonProperty("item_status") EnumWrapper<TrashFileItemStatusField> itemStatus) {
184
    super();
1✔
185
    this.id = id;
1✔
186
    this.sequenceId = sequenceId;
1✔
187
    this.sha1 = sha1;
1✔
188
    this.description = description;
1✔
189
    this.size = size;
1✔
190
    this.pathCollection = pathCollection;
1✔
191
    this.createdAt = createdAt;
1✔
192
    this.modifiedAt = modifiedAt;
1✔
193
    this.modifiedBy = modifiedBy;
1✔
194
    this.ownedBy = ownedBy;
1✔
195
    this.itemStatus = itemStatus;
1✔
196
    this.type = new EnumWrapper<TrashFileTypeField>(TrashFileTypeField.FILE);
1✔
197
  }
1✔
198

199
  protected TrashFile(Builder builder) {
200
    super();
×
201
    this.id = builder.id;
×
202
    this.etag = builder.etag;
×
203
    this.type = builder.type;
×
204
    this.sequenceId = builder.sequenceId;
×
205
    this.name = builder.name;
×
206
    this.sha1 = builder.sha1;
×
207
    this.fileVersion = builder.fileVersion;
×
208
    this.description = builder.description;
×
209
    this.size = builder.size;
×
210
    this.pathCollection = builder.pathCollection;
×
211
    this.createdAt = builder.createdAt;
×
212
    this.modifiedAt = builder.modifiedAt;
×
213
    this.trashedAt = builder.trashedAt;
×
214
    this.purgedAt = builder.purgedAt;
×
215
    this.contentCreatedAt = builder.contentCreatedAt;
×
216
    this.contentModifiedAt = builder.contentModifiedAt;
×
217
    this.createdBy = builder.createdBy;
×
218
    this.modifiedBy = builder.modifiedBy;
×
219
    this.ownedBy = builder.ownedBy;
×
220
    this.sharedLink = builder.sharedLink;
×
221
    this.parent = builder.parent;
×
222
    this.itemStatus = builder.itemStatus;
×
223
    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
×
224
  }
×
225

226
  public String getId() {
227
    return id;
1✔
228
  }
229

230
  public String getEtag() {
231
    return etag;
×
232
  }
233

234
  public EnumWrapper<TrashFileTypeField> getType() {
235
    return type;
×
236
  }
237

238
  public String getSequenceId() {
239
    return sequenceId;
×
240
  }
241

242
  public String getName() {
243
    return name;
1✔
244
  }
245

246
  public String getSha1() {
247
    return sha1;
×
248
  }
249

250
  public FileVersionMini getFileVersion() {
251
    return fileVersion;
×
252
  }
253

254
  public String getDescription() {
255
    return description;
×
256
  }
257

258
  public long getSize() {
259
    return size;
×
260
  }
261

262
  public TrashFilePathCollectionField getPathCollection() {
263
    return pathCollection;
×
264
  }
265

266
  public OffsetDateTime getCreatedAt() {
267
    return createdAt;
×
268
  }
269

270
  public OffsetDateTime getModifiedAt() {
271
    return modifiedAt;
×
272
  }
273

274
  public OffsetDateTime getTrashedAt() {
275
    return trashedAt;
×
276
  }
277

278
  public OffsetDateTime getPurgedAt() {
279
    return purgedAt;
×
280
  }
281

282
  public OffsetDateTime getContentCreatedAt() {
283
    return contentCreatedAt;
×
284
  }
285

286
  public OffsetDateTime getContentModifiedAt() {
287
    return contentModifiedAt;
×
288
  }
289

290
  public UserMini getCreatedBy() {
291
    return createdBy;
×
292
  }
293

294
  public UserMini getModifiedBy() {
295
    return modifiedBy;
×
296
  }
297

298
  public UserMini getOwnedBy() {
299
    return ownedBy;
×
300
  }
301

302
  public String getSharedLink() {
303
    return sharedLink;
×
304
  }
305

306
  public FolderMini getParent() {
307
    return parent;
×
308
  }
309

310
  public EnumWrapper<TrashFileItemStatusField> getItemStatus() {
311
    return itemStatus;
×
312
  }
313

314
  @Override
315
  public boolean equals(Object o) {
316
    if (this == o) {
×
317
      return true;
×
318
    }
319
    if (o == null || getClass() != o.getClass()) {
×
320
      return false;
×
321
    }
322
    TrashFile casted = (TrashFile) o;
×
323
    return Objects.equals(id, casted.id)
×
324
        && Objects.equals(etag, casted.etag)
×
325
        && Objects.equals(type, casted.type)
×
326
        && Objects.equals(sequenceId, casted.sequenceId)
×
327
        && Objects.equals(name, casted.name)
×
328
        && Objects.equals(sha1, casted.sha1)
×
329
        && Objects.equals(fileVersion, casted.fileVersion)
×
330
        && Objects.equals(description, casted.description)
×
331
        && Objects.equals(size, casted.size)
×
332
        && Objects.equals(pathCollection, casted.pathCollection)
×
333
        && Objects.equals(createdAt, casted.createdAt)
×
334
        && Objects.equals(modifiedAt, casted.modifiedAt)
×
335
        && Objects.equals(trashedAt, casted.trashedAt)
×
336
        && Objects.equals(purgedAt, casted.purgedAt)
×
337
        && Objects.equals(contentCreatedAt, casted.contentCreatedAt)
×
338
        && Objects.equals(contentModifiedAt, casted.contentModifiedAt)
×
339
        && Objects.equals(createdBy, casted.createdBy)
×
340
        && Objects.equals(modifiedBy, casted.modifiedBy)
×
341
        && Objects.equals(ownedBy, casted.ownedBy)
×
342
        && Objects.equals(sharedLink, casted.sharedLink)
×
343
        && Objects.equals(parent, casted.parent)
×
344
        && Objects.equals(itemStatus, casted.itemStatus);
×
345
  }
346

347
  @Override
348
  public int hashCode() {
349
    return Objects.hash(
×
350
        id,
351
        etag,
352
        type,
353
        sequenceId,
354
        name,
355
        sha1,
356
        fileVersion,
357
        description,
358
        size,
×
359
        pathCollection,
360
        createdAt,
361
        modifiedAt,
362
        trashedAt,
363
        purgedAt,
364
        contentCreatedAt,
365
        contentModifiedAt,
366
        createdBy,
367
        modifiedBy,
368
        ownedBy,
369
        sharedLink,
370
        parent,
371
        itemStatus);
372
  }
373

374
  @Override
375
  public String toString() {
376
    return "TrashFile{"
×
377
        + "id='"
378
        + id
379
        + '\''
380
        + ", "
381
        + "etag='"
382
        + etag
383
        + '\''
384
        + ", "
385
        + "type='"
386
        + type
387
        + '\''
388
        + ", "
389
        + "sequenceId='"
390
        + sequenceId
391
        + '\''
392
        + ", "
393
        + "name='"
394
        + name
395
        + '\''
396
        + ", "
397
        + "sha1='"
398
        + sha1
399
        + '\''
400
        + ", "
401
        + "fileVersion='"
402
        + fileVersion
403
        + '\''
404
        + ", "
405
        + "description='"
406
        + description
407
        + '\''
408
        + ", "
409
        + "size='"
410
        + size
411
        + '\''
412
        + ", "
413
        + "pathCollection='"
414
        + pathCollection
415
        + '\''
416
        + ", "
417
        + "createdAt='"
418
        + createdAt
419
        + '\''
420
        + ", "
421
        + "modifiedAt='"
422
        + modifiedAt
423
        + '\''
424
        + ", "
425
        + "trashedAt='"
426
        + trashedAt
427
        + '\''
428
        + ", "
429
        + "purgedAt='"
430
        + purgedAt
431
        + '\''
432
        + ", "
433
        + "contentCreatedAt='"
434
        + contentCreatedAt
435
        + '\''
436
        + ", "
437
        + "contentModifiedAt='"
438
        + contentModifiedAt
439
        + '\''
440
        + ", "
441
        + "createdBy='"
442
        + createdBy
443
        + '\''
444
        + ", "
445
        + "modifiedBy='"
446
        + modifiedBy
447
        + '\''
448
        + ", "
449
        + "ownedBy='"
450
        + ownedBy
451
        + '\''
452
        + ", "
453
        + "sharedLink='"
454
        + sharedLink
455
        + '\''
456
        + ", "
457
        + "parent='"
458
        + parent
459
        + '\''
460
        + ", "
461
        + "itemStatus='"
462
        + itemStatus
463
        + '\''
464
        + "}";
465
  }
466

467
  public static class Builder extends NullableFieldTracker {
468

469
    protected final String id;
470

471
    protected String etag;
472

473
    protected EnumWrapper<TrashFileTypeField> type;
474

475
    protected final String sequenceId;
476

477
    protected String name;
478

479
    protected final String sha1;
480

481
    protected FileVersionMini fileVersion;
482

483
    protected final String description;
484

485
    protected final long size;
486

487
    protected final TrashFilePathCollectionField pathCollection;
488

489
    protected final OffsetDateTime createdAt;
490

491
    protected final OffsetDateTime modifiedAt;
492

493
    protected OffsetDateTime trashedAt;
494

495
    protected OffsetDateTime purgedAt;
496

497
    protected OffsetDateTime contentCreatedAt;
498

499
    protected OffsetDateTime contentModifiedAt;
500

501
    protected UserMini createdBy;
502

503
    protected final UserMini modifiedBy;
504

505
    protected final UserMini ownedBy;
506

507
    protected String sharedLink;
508

509
    protected FolderMini parent;
510

511
    protected final EnumWrapper<TrashFileItemStatusField> itemStatus;
512

513
    public Builder(
514
        String id,
515
        String sequenceId,
516
        String sha1,
517
        String description,
518
        long size,
519
        TrashFilePathCollectionField pathCollection,
520
        OffsetDateTime createdAt,
521
        OffsetDateTime modifiedAt,
522
        UserMini modifiedBy,
523
        UserMini ownedBy,
524
        TrashFileItemStatusField itemStatus) {
525
      super();
×
526
      this.id = id;
×
527
      this.sequenceId = sequenceId;
×
528
      this.sha1 = sha1;
×
529
      this.description = description;
×
530
      this.size = size;
×
531
      this.pathCollection = pathCollection;
×
532
      this.createdAt = createdAt;
×
533
      this.modifiedAt = modifiedAt;
×
534
      this.modifiedBy = modifiedBy;
×
535
      this.ownedBy = ownedBy;
×
536
      this.itemStatus = new EnumWrapper<TrashFileItemStatusField>(itemStatus);
×
537
      this.type = new EnumWrapper<TrashFileTypeField>(TrashFileTypeField.FILE);
×
538
    }
×
539

540
    public Builder(
541
        String id,
542
        String sequenceId,
543
        String sha1,
544
        String description,
545
        long size,
546
        TrashFilePathCollectionField pathCollection,
547
        OffsetDateTime createdAt,
548
        OffsetDateTime modifiedAt,
549
        UserMini modifiedBy,
550
        UserMini ownedBy,
551
        EnumWrapper<TrashFileItemStatusField> itemStatus) {
552
      super();
×
553
      this.id = id;
×
554
      this.sequenceId = sequenceId;
×
555
      this.sha1 = sha1;
×
556
      this.description = description;
×
557
      this.size = size;
×
558
      this.pathCollection = pathCollection;
×
559
      this.createdAt = createdAt;
×
560
      this.modifiedAt = modifiedAt;
×
561
      this.modifiedBy = modifiedBy;
×
562
      this.ownedBy = ownedBy;
×
563
      this.itemStatus = itemStatus;
×
564
      this.type = new EnumWrapper<TrashFileTypeField>(TrashFileTypeField.FILE);
×
565
    }
×
566

567
    public Builder etag(String etag) {
568
      this.etag = etag;
×
569
      this.markNullableFieldAsSet("etag");
×
570
      return this;
×
571
    }
572

573
    public Builder type(TrashFileTypeField type) {
574
      this.type = new EnumWrapper<TrashFileTypeField>(type);
×
575
      return this;
×
576
    }
577

578
    public Builder type(EnumWrapper<TrashFileTypeField> type) {
579
      this.type = type;
×
580
      return this;
×
581
    }
582

583
    public Builder name(String name) {
584
      this.name = name;
×
585
      return this;
×
586
    }
587

588
    public Builder fileVersion(FileVersionMini fileVersion) {
589
      this.fileVersion = fileVersion;
×
590
      return this;
×
591
    }
592

593
    public Builder trashedAt(OffsetDateTime trashedAt) {
594
      this.trashedAt = trashedAt;
×
595
      this.markNullableFieldAsSet("trashed_at");
×
596
      return this;
×
597
    }
598

599
    public Builder purgedAt(OffsetDateTime purgedAt) {
600
      this.purgedAt = purgedAt;
×
601
      this.markNullableFieldAsSet("purged_at");
×
602
      return this;
×
603
    }
604

605
    public Builder contentCreatedAt(OffsetDateTime contentCreatedAt) {
606
      this.contentCreatedAt = contentCreatedAt;
×
607
      this.markNullableFieldAsSet("content_created_at");
×
608
      return this;
×
609
    }
610

611
    public Builder contentModifiedAt(OffsetDateTime contentModifiedAt) {
612
      this.contentModifiedAt = contentModifiedAt;
×
613
      this.markNullableFieldAsSet("content_modified_at");
×
614
      return this;
×
615
    }
616

617
    public Builder createdBy(UserMini createdBy) {
618
      this.createdBy = createdBy;
×
619
      return this;
×
620
    }
621

622
    public Builder sharedLink(String sharedLink) {
623
      this.sharedLink = sharedLink;
×
624
      this.markNullableFieldAsSet("shared_link");
×
625
      return this;
×
626
    }
627

628
    public Builder parent(FolderMini parent) {
629
      this.parent = parent;
×
630
      return this;
×
631
    }
632

633
    public TrashFile build() {
634
      return new TrashFile(this);
×
635
    }
636
  }
637
}
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