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

box / box-java-sdk / #6618

08 Apr 2026 09:28AM UTC coverage: 12.682% (-0.001%) from 12.683%
#6618

push

github

web-flow
fix(boxsdkgen)!: Update `retentionLength` field to accept both string and integer (box/box-codegen#932) (#1775)

0 of 46 new or added lines in 4 files covered. (0.0%)

17 existing lines in 10 files now uncovered.

8374 of 66031 relevant lines covered (12.68%)

0.13 hits per line

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

0.0
/src/main/java/com/box/sdkgen/managers/retentionpolicies/CreateRetentionPolicyRequestBody.java
1
package com.box.sdkgen.managers.retentionpolicies;
2

3
import com.box.sdkgen.internal.NullableFieldTracker;
4
import com.box.sdkgen.internal.SerializableObject;
5
import com.box.sdkgen.schemas.usermini.UserMini;
6
import com.box.sdkgen.serialization.json.EnumWrapper;
7
import com.fasterxml.jackson.annotation.JsonFilter;
8
import com.fasterxml.jackson.annotation.JsonProperty;
9
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
10
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
11
import java.util.List;
12
import java.util.Objects;
13

14
@JsonFilter("nullablePropertyFilter")
15
public class CreateRetentionPolicyRequestBody extends SerializableObject {
16

17
  /** The name for the retention policy. */
18
  @JsonProperty("policy_name")
19
  protected final String policyName;
20

21
  /** The additional text description of the retention policy. */
22
  protected String description;
23

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

40
  /**
41
   * The disposition action of the retention policy. `permanently_delete` deletes the content
42
   * retained by the policy permanently. `remove_retention` lifts retention policy from the content,
43
   * allowing it to be deleted by users once the retention policy has expired.
44
   */
45
  @JsonDeserialize(
46
      using =
47
          CreateRetentionPolicyRequestBodyDispositionActionField
48
              .CreateRetentionPolicyRequestBodyDispositionActionFieldDeserializer.class)
49
  @JsonSerialize(
50
      using =
51
          CreateRetentionPolicyRequestBodyDispositionActionField
52
              .CreateRetentionPolicyRequestBodyDispositionActionFieldSerializer.class)
53
  @JsonProperty("disposition_action")
54
  protected final EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField>
55
      dispositionAction;
56

57
  /**
58
   * The length of the retention policy. This value specifies the duration in days that the
59
   * retention policy will be active for after being assigned to content. If the policy has a
60
   * `policy_type` of `indefinite`, the `retention_length` will also be `indefinite`.
61
   */
62
  @JsonProperty("retention_length")
63
  protected CreateRetentionPolicyRequestBodyRetentionLengthField retentionLength;
64

65
  /**
66
   * Specifies the retention type:
67
   *
68
   * <p>* `modifiable`: You can modify the retention policy. For example, you can add or remove
69
   * folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if
70
   * your retention policy is not related to any regulatory purposes.
71
   *
72
   * <p>* `non_modifiable`: You can modify the retention policy only in a limited way: add a folder,
73
   * lengthen the duration, retire the policy, change the disposition action or notification
74
   * settings. You cannot perform other actions, such as deleting the assignment or shortening the
75
   * policy duration. Use this type to ensure compliance with regulatory retention policies.
76
   */
77
  @JsonDeserialize(
78
      using =
79
          CreateRetentionPolicyRequestBodyRetentionTypeField
80
              .CreateRetentionPolicyRequestBodyRetentionTypeFieldDeserializer.class)
81
  @JsonSerialize(
82
      using =
83
          CreateRetentionPolicyRequestBodyRetentionTypeField
84
              .CreateRetentionPolicyRequestBodyRetentionTypeFieldSerializer.class)
85
  @JsonProperty("retention_type")
86
  protected EnumWrapper<CreateRetentionPolicyRequestBodyRetentionTypeField> retentionType;
87

88
  /** Whether the owner of a file will be allowed to extend the retention. */
89
  @JsonProperty("can_owner_extend_retention")
90
  protected Boolean canOwnerExtendRetention;
91

92
  /** Whether owner and co-owners of a file are notified when the policy nears expiration. */
93
  @JsonProperty("are_owners_notified")
94
  protected Boolean areOwnersNotified;
95

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

100
  public CreateRetentionPolicyRequestBody(
101
      String policyName,
102
      CreateRetentionPolicyRequestBodyPolicyTypeField policyType,
103
      CreateRetentionPolicyRequestBodyDispositionActionField dispositionAction) {
104
    super();
×
105
    this.policyName = policyName;
×
106
    this.policyType = new EnumWrapper<CreateRetentionPolicyRequestBodyPolicyTypeField>(policyType);
×
107
    this.dispositionAction =
×
108
        new EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField>(dispositionAction);
109
  }
×
110

111
  public CreateRetentionPolicyRequestBody(
112
      String policyName,
113
      CreateRetentionPolicyRequestBodyPolicyTypeField policyType,
114
      EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField> dispositionAction) {
115
    super();
×
116
    this.policyName = policyName;
×
117
    this.policyType = new EnumWrapper<CreateRetentionPolicyRequestBodyPolicyTypeField>(policyType);
×
118
    this.dispositionAction = dispositionAction;
×
119
  }
×
120

121
  public CreateRetentionPolicyRequestBody(
122
      String policyName,
123
      EnumWrapper<CreateRetentionPolicyRequestBodyPolicyTypeField> policyType,
124
      CreateRetentionPolicyRequestBodyDispositionActionField dispositionAction) {
125
    super();
×
126
    this.policyName = policyName;
×
127
    this.policyType = policyType;
×
128
    this.dispositionAction =
×
129
        new EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField>(dispositionAction);
130
  }
×
131

132
  public CreateRetentionPolicyRequestBody(
133
      @JsonProperty("policy_name") String policyName,
134
      @JsonProperty("policy_type")
135
          EnumWrapper<CreateRetentionPolicyRequestBodyPolicyTypeField> policyType,
136
      @JsonProperty("disposition_action")
137
          EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField> dispositionAction) {
138
    super();
×
139
    this.policyName = policyName;
×
140
    this.policyType = policyType;
×
141
    this.dispositionAction = dispositionAction;
×
142
  }
×
143

144
  protected CreateRetentionPolicyRequestBody(Builder builder) {
145
    super();
×
146
    this.policyName = builder.policyName;
×
147
    this.description = builder.description;
×
148
    this.policyType = builder.policyType;
×
149
    this.dispositionAction = builder.dispositionAction;
×
150
    this.retentionLength = builder.retentionLength;
×
151
    this.retentionType = builder.retentionType;
×
152
    this.canOwnerExtendRetention = builder.canOwnerExtendRetention;
×
153
    this.areOwnersNotified = builder.areOwnersNotified;
×
154
    this.customNotificationRecipients = builder.customNotificationRecipients;
×
155
    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
×
156
  }
×
157

158
  public String getPolicyName() {
159
    return policyName;
×
160
  }
161

162
  public String getDescription() {
163
    return description;
×
164
  }
165

166
  public EnumWrapper<CreateRetentionPolicyRequestBodyPolicyTypeField> getPolicyType() {
167
    return policyType;
×
168
  }
169

170
  public EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField>
171
      getDispositionAction() {
172
    return dispositionAction;
×
173
  }
174

175
  public CreateRetentionPolicyRequestBodyRetentionLengthField getRetentionLength() {
176
    return retentionLength;
×
177
  }
178

179
  public EnumWrapper<CreateRetentionPolicyRequestBodyRetentionTypeField> getRetentionType() {
180
    return retentionType;
×
181
  }
182

183
  public Boolean getCanOwnerExtendRetention() {
184
    return canOwnerExtendRetention;
×
185
  }
186

187
  public Boolean getAreOwnersNotified() {
188
    return areOwnersNotified;
×
189
  }
190

191
  public List<UserMini> getCustomNotificationRecipients() {
192
    return customNotificationRecipients;
×
193
  }
194

195
  @Override
196
  public boolean equals(Object o) {
197
    if (this == o) {
×
198
      return true;
×
199
    }
200
    if (o == null || getClass() != o.getClass()) {
×
201
      return false;
×
202
    }
203
    CreateRetentionPolicyRequestBody casted = (CreateRetentionPolicyRequestBody) o;
×
204
    return Objects.equals(policyName, casted.policyName)
×
205
        && Objects.equals(description, casted.description)
×
206
        && Objects.equals(policyType, casted.policyType)
×
207
        && Objects.equals(dispositionAction, casted.dispositionAction)
×
208
        && Objects.equals(retentionLength, casted.retentionLength)
×
209
        && Objects.equals(retentionType, casted.retentionType)
×
210
        && Objects.equals(canOwnerExtendRetention, casted.canOwnerExtendRetention)
×
211
        && Objects.equals(areOwnersNotified, casted.areOwnersNotified)
×
212
        && Objects.equals(customNotificationRecipients, casted.customNotificationRecipients);
×
213
  }
214

215
  @Override
216
  public int hashCode() {
217
    return Objects.hash(
×
218
        policyName,
219
        description,
220
        policyType,
221
        dispositionAction,
222
        retentionLength,
223
        retentionType,
224
        canOwnerExtendRetention,
225
        areOwnersNotified,
226
        customNotificationRecipients);
227
  }
228

229
  @Override
230
  public String toString() {
231
    return "CreateRetentionPolicyRequestBody{"
×
232
        + "policyName='"
233
        + policyName
234
        + '\''
235
        + ", "
236
        + "description='"
237
        + description
238
        + '\''
239
        + ", "
240
        + "policyType='"
241
        + policyType
242
        + '\''
243
        + ", "
244
        + "dispositionAction='"
245
        + dispositionAction
246
        + '\''
247
        + ", "
248
        + "retentionLength='"
249
        + retentionLength
250
        + '\''
251
        + ", "
252
        + "retentionType='"
253
        + retentionType
254
        + '\''
255
        + ", "
256
        + "canOwnerExtendRetention='"
257
        + canOwnerExtendRetention
258
        + '\''
259
        + ", "
260
        + "areOwnersNotified='"
261
        + areOwnersNotified
262
        + '\''
263
        + ", "
264
        + "customNotificationRecipients='"
265
        + customNotificationRecipients
266
        + '\''
267
        + "}";
268
  }
269

270
  public static class Builder extends NullableFieldTracker {
271

272
    protected final String policyName;
273

274
    protected String description;
275

276
    protected final EnumWrapper<CreateRetentionPolicyRequestBodyPolicyTypeField> policyType;
277

278
    protected final EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField>
279
        dispositionAction;
280

281
    protected CreateRetentionPolicyRequestBodyRetentionLengthField retentionLength;
282

283
    protected EnumWrapper<CreateRetentionPolicyRequestBodyRetentionTypeField> retentionType;
284

285
    protected Boolean canOwnerExtendRetention;
286

287
    protected Boolean areOwnersNotified;
288

289
    protected List<UserMini> customNotificationRecipients;
290

291
    public Builder(
292
        String policyName,
293
        CreateRetentionPolicyRequestBodyPolicyTypeField policyType,
294
        CreateRetentionPolicyRequestBodyDispositionActionField dispositionAction) {
295
      super();
×
296
      this.policyName = policyName;
×
297
      this.policyType =
×
298
          new EnumWrapper<CreateRetentionPolicyRequestBodyPolicyTypeField>(policyType);
299
      this.dispositionAction =
×
300
          new EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField>(
301
              dispositionAction);
302
    }
×
303

304
    public Builder(
305
        String policyName,
306
        CreateRetentionPolicyRequestBodyPolicyTypeField policyType,
307
        EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField> dispositionAction) {
308
      super();
×
309
      this.policyName = policyName;
×
310
      this.policyType =
×
311
          new EnumWrapper<CreateRetentionPolicyRequestBodyPolicyTypeField>(policyType);
312
      this.dispositionAction = dispositionAction;
×
313
    }
×
314

315
    public Builder(
316
        String policyName,
317
        EnumWrapper<CreateRetentionPolicyRequestBodyPolicyTypeField> policyType,
318
        CreateRetentionPolicyRequestBodyDispositionActionField dispositionAction) {
319
      super();
×
320
      this.policyName = policyName;
×
321
      this.policyType = policyType;
×
322
      this.dispositionAction =
×
323
          new EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField>(
324
              dispositionAction);
325
    }
×
326

327
    public Builder(
328
        String policyName,
329
        EnumWrapper<CreateRetentionPolicyRequestBodyPolicyTypeField> policyType,
330
        EnumWrapper<CreateRetentionPolicyRequestBodyDispositionActionField> dispositionAction) {
331
      super();
×
332
      this.policyName = policyName;
×
333
      this.policyType = policyType;
×
334
      this.dispositionAction = dispositionAction;
×
335
    }
×
336

337
    public Builder description(String description) {
338
      this.description = description;
×
339
      return this;
×
340
    }
341

342
    public Builder retentionLength(String retentionLength) {
NEW
343
      this.retentionLength =
×
344
          new CreateRetentionPolicyRequestBodyRetentionLengthField(retentionLength);
NEW
345
      return this;
×
346
    }
347

348
    public Builder retentionLength(int retentionLength) {
NEW
349
      this.retentionLength =
×
NEW
350
          new CreateRetentionPolicyRequestBodyRetentionLengthField(retentionLength);
×
NEW
351
      return this;
×
352
    }
353

354
    public Builder retentionLength(
355
        CreateRetentionPolicyRequestBodyRetentionLengthField retentionLength) {
356
      this.retentionLength = retentionLength;
×
357
      return this;
×
358
    }
359

360
    public Builder retentionType(CreateRetentionPolicyRequestBodyRetentionTypeField retentionType) {
361
      this.retentionType =
×
362
          new EnumWrapper<CreateRetentionPolicyRequestBodyRetentionTypeField>(retentionType);
363
      return this;
×
364
    }
365

366
    public Builder retentionType(
367
        EnumWrapper<CreateRetentionPolicyRequestBodyRetentionTypeField> retentionType) {
368
      this.retentionType = retentionType;
×
369
      return this;
×
370
    }
371

372
    public Builder canOwnerExtendRetention(Boolean canOwnerExtendRetention) {
373
      this.canOwnerExtendRetention = canOwnerExtendRetention;
×
374
      return this;
×
375
    }
376

377
    public Builder areOwnersNotified(Boolean areOwnersNotified) {
378
      this.areOwnersNotified = areOwnersNotified;
×
379
      return this;
×
380
    }
381

382
    public Builder customNotificationRecipients(List<UserMini> customNotificationRecipients) {
383
      this.customNotificationRecipients = customNotificationRecipients;
×
384
      return this;
×
385
    }
386

387
    public CreateRetentionPolicyRequestBody build() {
388
      return new CreateRetentionPolicyRequestBody(this);
×
389
    }
390
  }
391
}
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