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

box / box-java-sdk / #6244

10 Feb 2026 05:27PM UTC coverage: 40.749% (+22.6%) from 18.192%
#6244

push

github

web-flow
fix(boxsdkgen): Move assigning default values from builder constructor to `build()` method (box/box-codegen#922) (#1712)

0 of 1677 new or added lines in 569 files covered. (0.0%)

2146 existing lines in 544 files now uncovered.

7382 of 18116 relevant lines covered (40.75%)

0.46 hits per line

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

0.0
/src/main/java/com/box/sdkgen/schemas/retentionpolicy/RetentionPolicy.java
1
package com.box.sdkgen.schemas.retentionpolicy;
2

3
import com.box.sdkgen.internal.utils.DateTimeUtils;
4
import com.box.sdkgen.schemas.retentionpolicybase.RetentionPolicyBaseTypeField;
5
import com.box.sdkgen.schemas.retentionpolicymini.RetentionPolicyMini;
6
import com.box.sdkgen.schemas.retentionpolicymini.RetentionPolicyMiniDispositionActionField;
7
import com.box.sdkgen.schemas.usermini.UserMini;
8
import com.box.sdkgen.serialization.json.EnumWrapper;
9
import com.fasterxml.jackson.annotation.JsonFilter;
10
import com.fasterxml.jackson.annotation.JsonProperty;
11
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
12
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
13
import java.time.OffsetDateTime;
14
import java.util.List;
15
import java.util.Objects;
16

17
/**
18
 * A retention policy blocks permanent deletion of content for a specified amount of time. Admins
19
 * can create retention policies and then later assign them to specific folders, metadata templates,
20
 * or their entire enterprise. To use this feature, you must have the manage retention policies
21
 * scope enabled for your API key via your application management console.
22
 */
23
@JsonFilter("nullablePropertyFilter")
24
public class RetentionPolicy extends RetentionPolicyMini {
25

26
  /** The additional text description of the retention policy. */
27
  protected String description;
28

29
  /**
30
   * The type of the retention policy. A retention policy type can either be `finite`, where a
31
   * specific amount of time to retain the content is known upfront, or `indefinite`, where the
32
   * amount of time to retain the content is still unknown.
33
   */
34
  @JsonDeserialize(
35
      using = RetentionPolicyPolicyTypeField.RetentionPolicyPolicyTypeFieldDeserializer.class)
36
  @JsonSerialize(
37
      using = RetentionPolicyPolicyTypeField.RetentionPolicyPolicyTypeFieldSerializer.class)
38
  @JsonProperty("policy_type")
39
  protected EnumWrapper<RetentionPolicyPolicyTypeField> policyType;
40

41
  /**
42
   * Specifies the retention type:
43
   *
44
   * <p>* `modifiable`: You can modify the retention policy. For example, you can add or remove
45
   * folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if
46
   * your retention policy is not related to any regulatory purposes.
47
   *
48
   * <p>* `non-modifiable`: You can modify the retention policy only in a limited way: add a folder,
49
   * lengthen the duration, retire the policy, change the disposition action or notification
50
   * settings. You cannot perform other actions, such as deleting the assignment or shortening the
51
   * policy duration. Use this type to ensure compliance with regulatory retention policies.
52
   */
53
  @JsonDeserialize(
54
      using = RetentionPolicyRetentionTypeField.RetentionPolicyRetentionTypeFieldDeserializer.class)
55
  @JsonSerialize(
56
      using = RetentionPolicyRetentionTypeField.RetentionPolicyRetentionTypeFieldSerializer.class)
57
  @JsonProperty("retention_type")
58
  protected EnumWrapper<RetentionPolicyRetentionTypeField> retentionType;
59

60
  /**
61
   * The status of the retention policy. The status of a policy will be `active`, unless explicitly
62
   * retired by an administrator, in which case the status will be `retired`. Once a policy has been
63
   * retired, it cannot become active again.
64
   */
65
  @JsonDeserialize(using = RetentionPolicyStatusField.RetentionPolicyStatusFieldDeserializer.class)
66
  @JsonSerialize(using = RetentionPolicyStatusField.RetentionPolicyStatusFieldSerializer.class)
67
  protected EnumWrapper<RetentionPolicyStatusField> status;
68

69
  @JsonProperty("created_by")
70
  protected UserMini createdBy;
71

72
  /** When the retention policy object was created. */
73
  @JsonProperty("created_at")
74
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
75
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
76
  protected OffsetDateTime createdAt;
77

78
  /** When the retention policy object was last modified. */
79
  @JsonProperty("modified_at")
80
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
81
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
82
  protected OffsetDateTime modifiedAt;
83

84
  /**
85
   * Determines if the owner of items under the policy can extend the retention when the original
86
   * retention duration is about to end.
87
   */
88
  @JsonProperty("can_owner_extend_retention")
89
  protected Boolean canOwnerExtendRetention;
90

91
  /**
92
   * Determines if owners and co-owners of items under the policy are notified when the retention
93
   * duration is about to end.
94
   */
95
  @JsonProperty("are_owners_notified")
96
  protected Boolean areOwnersNotified;
97

98
  /** A list of users notified when the retention policy duration is about to end. */
99
  @JsonProperty("custom_notification_recipients")
100
  protected List<UserMini> customNotificationRecipients;
101

102
  /** Counts the retention policy assignments for each item type. */
103
  @JsonProperty("assignment_counts")
104
  protected RetentionPolicyAssignmentCountsField assignmentCounts;
105

106
  public RetentionPolicy(@JsonProperty("id") String id) {
107
    super(id);
×
108
  }
×
109

110
  protected RetentionPolicy(Builder builder) {
111
    super(builder);
×
112
    this.description = builder.description;
×
113
    this.policyType = builder.policyType;
×
114
    this.retentionType = builder.retentionType;
×
115
    this.status = builder.status;
×
116
    this.createdBy = builder.createdBy;
×
117
    this.createdAt = builder.createdAt;
×
118
    this.modifiedAt = builder.modifiedAt;
×
119
    this.canOwnerExtendRetention = builder.canOwnerExtendRetention;
×
120
    this.areOwnersNotified = builder.areOwnersNotified;
×
121
    this.customNotificationRecipients = builder.customNotificationRecipients;
×
122
    this.assignmentCounts = builder.assignmentCounts;
×
123
    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
×
124
  }
×
125

126
  public String getDescription() {
127
    return description;
×
128
  }
129

130
  public EnumWrapper<RetentionPolicyPolicyTypeField> getPolicyType() {
131
    return policyType;
×
132
  }
133

134
  public EnumWrapper<RetentionPolicyRetentionTypeField> getRetentionType() {
135
    return retentionType;
×
136
  }
137

138
  public EnumWrapper<RetentionPolicyStatusField> getStatus() {
139
    return status;
×
140
  }
141

142
  public UserMini getCreatedBy() {
143
    return createdBy;
×
144
  }
145

146
  public OffsetDateTime getCreatedAt() {
147
    return createdAt;
×
148
  }
149

150
  public OffsetDateTime getModifiedAt() {
151
    return modifiedAt;
×
152
  }
153

154
  public Boolean getCanOwnerExtendRetention() {
155
    return canOwnerExtendRetention;
×
156
  }
157

158
  public Boolean getAreOwnersNotified() {
159
    return areOwnersNotified;
×
160
  }
161

162
  public List<UserMini> getCustomNotificationRecipients() {
163
    return customNotificationRecipients;
×
164
  }
165

166
  public RetentionPolicyAssignmentCountsField getAssignmentCounts() {
167
    return assignmentCounts;
×
168
  }
169

170
  @Override
171
  public boolean equals(Object o) {
172
    if (this == o) {
×
173
      return true;
×
174
    }
175
    if (o == null || getClass() != o.getClass()) {
×
176
      return false;
×
177
    }
178
    RetentionPolicy casted = (RetentionPolicy) o;
×
179
    return Objects.equals(id, casted.id)
×
180
        && Objects.equals(type, casted.type)
×
181
        && Objects.equals(policyName, casted.policyName)
×
182
        && Objects.equals(retentionLength, casted.retentionLength)
×
183
        && Objects.equals(dispositionAction, casted.dispositionAction)
×
184
        && Objects.equals(description, casted.description)
×
185
        && Objects.equals(policyType, casted.policyType)
×
186
        && Objects.equals(retentionType, casted.retentionType)
×
187
        && Objects.equals(status, casted.status)
×
188
        && Objects.equals(createdBy, casted.createdBy)
×
189
        && Objects.equals(createdAt, casted.createdAt)
×
190
        && Objects.equals(modifiedAt, casted.modifiedAt)
×
191
        && Objects.equals(canOwnerExtendRetention, casted.canOwnerExtendRetention)
×
192
        && Objects.equals(areOwnersNotified, casted.areOwnersNotified)
×
193
        && Objects.equals(customNotificationRecipients, casted.customNotificationRecipients)
×
194
        && Objects.equals(assignmentCounts, casted.assignmentCounts);
×
195
  }
196

197
  @Override
198
  public int hashCode() {
199
    return Objects.hash(
×
200
        id,
201
        type,
202
        policyName,
203
        retentionLength,
204
        dispositionAction,
205
        description,
206
        policyType,
207
        retentionType,
208
        status,
209
        createdBy,
210
        createdAt,
211
        modifiedAt,
212
        canOwnerExtendRetention,
213
        areOwnersNotified,
214
        customNotificationRecipients,
215
        assignmentCounts);
216
  }
217

218
  @Override
219
  public String toString() {
220
    return "RetentionPolicy{"
×
221
        + "id='"
222
        + id
223
        + '\''
224
        + ", "
225
        + "type='"
226
        + type
227
        + '\''
228
        + ", "
229
        + "policyName='"
230
        + policyName
231
        + '\''
232
        + ", "
233
        + "retentionLength='"
234
        + retentionLength
235
        + '\''
236
        + ", "
237
        + "dispositionAction='"
238
        + dispositionAction
239
        + '\''
240
        + ", "
241
        + "description='"
242
        + description
243
        + '\''
244
        + ", "
245
        + "policyType='"
246
        + policyType
247
        + '\''
248
        + ", "
249
        + "retentionType='"
250
        + retentionType
251
        + '\''
252
        + ", "
253
        + "status='"
254
        + status
255
        + '\''
256
        + ", "
257
        + "createdBy='"
258
        + createdBy
259
        + '\''
260
        + ", "
261
        + "createdAt='"
262
        + createdAt
263
        + '\''
264
        + ", "
265
        + "modifiedAt='"
266
        + modifiedAt
267
        + '\''
268
        + ", "
269
        + "canOwnerExtendRetention='"
270
        + canOwnerExtendRetention
271
        + '\''
272
        + ", "
273
        + "areOwnersNotified='"
274
        + areOwnersNotified
275
        + '\''
276
        + ", "
277
        + "customNotificationRecipients='"
278
        + customNotificationRecipients
279
        + '\''
280
        + ", "
281
        + "assignmentCounts='"
282
        + assignmentCounts
283
        + '\''
284
        + "}";
285
  }
286

287
  public static class Builder extends RetentionPolicyMini.Builder {
288

289
    protected String description;
290

291
    protected EnumWrapper<RetentionPolicyPolicyTypeField> policyType;
292

293
    protected EnumWrapper<RetentionPolicyRetentionTypeField> retentionType;
294

295
    protected EnumWrapper<RetentionPolicyStatusField> status;
296

297
    protected UserMini createdBy;
298

299
    protected OffsetDateTime createdAt;
300

301
    protected OffsetDateTime modifiedAt;
302

303
    protected Boolean canOwnerExtendRetention;
304

305
    protected Boolean areOwnersNotified;
306

307
    protected List<UserMini> customNotificationRecipients;
308

309
    protected RetentionPolicyAssignmentCountsField assignmentCounts;
310

311
    public Builder(String id) {
312
      super(id);
×
313
    }
×
314

315
    public Builder description(String description) {
316
      this.description = description;
×
317
      return this;
×
318
    }
319

320
    public Builder policyType(RetentionPolicyPolicyTypeField policyType) {
321
      this.policyType = new EnumWrapper<RetentionPolicyPolicyTypeField>(policyType);
×
322
      return this;
×
323
    }
324

325
    public Builder policyType(EnumWrapper<RetentionPolicyPolicyTypeField> policyType) {
326
      this.policyType = policyType;
×
327
      return this;
×
328
    }
329

330
    public Builder retentionType(RetentionPolicyRetentionTypeField retentionType) {
331
      this.retentionType = new EnumWrapper<RetentionPolicyRetentionTypeField>(retentionType);
×
332
      return this;
×
333
    }
334

335
    public Builder retentionType(EnumWrapper<RetentionPolicyRetentionTypeField> retentionType) {
336
      this.retentionType = retentionType;
×
337
      return this;
×
338
    }
339

340
    public Builder status(RetentionPolicyStatusField status) {
341
      this.status = new EnumWrapper<RetentionPolicyStatusField>(status);
×
342
      return this;
×
343
    }
344

345
    public Builder status(EnumWrapper<RetentionPolicyStatusField> status) {
346
      this.status = status;
×
347
      return this;
×
348
    }
349

350
    public Builder createdBy(UserMini createdBy) {
351
      this.createdBy = createdBy;
×
352
      return this;
×
353
    }
354

355
    public Builder createdAt(OffsetDateTime createdAt) {
356
      this.createdAt = createdAt;
×
357
      return this;
×
358
    }
359

360
    public Builder modifiedAt(OffsetDateTime modifiedAt) {
361
      this.modifiedAt = modifiedAt;
×
362
      return this;
×
363
    }
364

365
    public Builder canOwnerExtendRetention(Boolean canOwnerExtendRetention) {
366
      this.canOwnerExtendRetention = canOwnerExtendRetention;
×
367
      return this;
×
368
    }
369

370
    public Builder areOwnersNotified(Boolean areOwnersNotified) {
371
      this.areOwnersNotified = areOwnersNotified;
×
372
      return this;
×
373
    }
374

375
    public Builder customNotificationRecipients(List<UserMini> customNotificationRecipients) {
376
      this.customNotificationRecipients = customNotificationRecipients;
×
377
      return this;
×
378
    }
379

380
    public Builder assignmentCounts(RetentionPolicyAssignmentCountsField assignmentCounts) {
381
      this.assignmentCounts = assignmentCounts;
×
382
      return this;
×
383
    }
384

385
    @Override
386
    public Builder type(RetentionPolicyBaseTypeField type) {
387
      this.type = new EnumWrapper<RetentionPolicyBaseTypeField>(type);
×
388
      return this;
×
389
    }
390

391
    @Override
392
    public Builder type(EnumWrapper<RetentionPolicyBaseTypeField> type) {
393
      this.type = type;
×
394
      return this;
×
395
    }
396

397
    @Override
398
    public Builder policyName(String policyName) {
399
      this.policyName = policyName;
×
400
      return this;
×
401
    }
402

403
    @Override
404
    public Builder retentionLength(String retentionLength) {
405
      this.retentionLength = retentionLength;
×
406
      return this;
×
407
    }
408

409
    @Override
410
    public Builder dispositionAction(RetentionPolicyMiniDispositionActionField dispositionAction) {
411
      this.dispositionAction =
×
412
          new EnumWrapper<RetentionPolicyMiniDispositionActionField>(dispositionAction);
413
      return this;
×
414
    }
415

416
    @Override
417
    public Builder dispositionAction(
418
        EnumWrapper<RetentionPolicyMiniDispositionActionField> dispositionAction) {
419
      this.dispositionAction = dispositionAction;
×
420
      return this;
×
421
    }
422

423
    public RetentionPolicy build() {
NEW
424
      if (this.type == null) {
×
NEW
425
        this.type =
×
426
            new EnumWrapper<RetentionPolicyBaseTypeField>(
427
                RetentionPolicyBaseTypeField.RETENTION_POLICY);
428
      }
429
      return new RetentionPolicy(this);
×
430
    }
431
  }
432
}
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