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

box / box-java-sdk / #6242

10 Feb 2026 05:27PM UTC coverage: 35.714% (+11.4%) from 24.324%
#6242

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 20670 relevant lines covered (35.71%)

0.4 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/retentionpolicyassignment/RetentionPolicyAssignment.java
1
package com.box.sdkgen.schemas.retentionpolicyassignment;
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.retentionpolicymini.RetentionPolicyMini;
8
import com.box.sdkgen.schemas.usermini.UserMini;
9
import com.box.sdkgen.serialization.json.EnumWrapper;
10
import com.fasterxml.jackson.annotation.JsonFilter;
11
import com.fasterxml.jackson.annotation.JsonProperty;
12
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
13
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
14
import java.time.OffsetDateTime;
15
import java.util.List;
16
import java.util.Objects;
17

18
/**
19
 * A retention assignment represents a rule specifying the files a retention policy retains.
20
 * Assignments can retain files based on their folder or metadata, or hold all files in the
21
 * enterprise.
22
 */
23
@JsonFilter("nullablePropertyFilter")
24
public class RetentionPolicyAssignment extends SerializableObject {
25

26
  /** The unique identifier for a retention policy assignment. */
27
  protected final String id;
28

29
  /** The value will always be `retention_policy_assignment`. */
30
  @JsonDeserialize(
31
      using =
32
          RetentionPolicyAssignmentTypeField.RetentionPolicyAssignmentTypeFieldDeserializer.class)
33
  @JsonSerialize(
34
      using = RetentionPolicyAssignmentTypeField.RetentionPolicyAssignmentTypeFieldSerializer.class)
35
  protected EnumWrapper<RetentionPolicyAssignmentTypeField> type;
36

37
  @JsonProperty("retention_policy")
38
  protected RetentionPolicyMini retentionPolicy;
39

40
  /**
41
   * The `type` and `id` of the content that is under retention. The `type` can either be `folder`
42
   * `enterprise`, or `metadata_template`.
43
   */
44
  @JsonProperty("assigned_to")
45
  protected RetentionPolicyAssignmentAssignedToField assignedTo;
46

47
  /**
48
   * An array of field objects. Values are only returned if the `assigned_to` type is
49
   * `metadata_template`. Otherwise, the array is blank.
50
   */
51
  @JsonProperty("filter_fields")
52
  @Nullable
53
  protected List<RetentionPolicyAssignmentFilterFieldsField> filterFields;
54

55
  @JsonProperty("assigned_by")
56
  protected UserMini assignedBy;
57

58
  /** When the retention policy assignment object was created. */
59
  @JsonProperty("assigned_at")
60
  @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
61
  @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
62
  protected OffsetDateTime assignedAt;
63

64
  /**
65
   * The date the retention policy assignment begins. If the `assigned_to` type is
66
   * `metadata_template`, this field can be a date field's metadata attribute key id.
67
   */
68
  @JsonProperty("start_date_field")
69
  protected String startDateField;
70

71
  public RetentionPolicyAssignment(@JsonProperty("id") String id) {
72
    super();
×
73
    this.id = id;
×
74
    this.type =
×
75
        new EnumWrapper<RetentionPolicyAssignmentTypeField>(
76
            RetentionPolicyAssignmentTypeField.RETENTION_POLICY_ASSIGNMENT);
77
  }
×
78

79
  protected RetentionPolicyAssignment(Builder builder) {
80
    super();
×
81
    this.id = builder.id;
×
82
    this.type = builder.type;
×
83
    this.retentionPolicy = builder.retentionPolicy;
×
84
    this.assignedTo = builder.assignedTo;
×
85
    this.filterFields = builder.filterFields;
×
86
    this.assignedBy = builder.assignedBy;
×
87
    this.assignedAt = builder.assignedAt;
×
88
    this.startDateField = builder.startDateField;
×
89
    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
×
90
  }
×
91

92
  public String getId() {
93
    return id;
×
94
  }
95

96
  public EnumWrapper<RetentionPolicyAssignmentTypeField> getType() {
97
    return type;
×
98
  }
99

100
  public RetentionPolicyMini getRetentionPolicy() {
101
    return retentionPolicy;
×
102
  }
103

104
  public RetentionPolicyAssignmentAssignedToField getAssignedTo() {
105
    return assignedTo;
×
106
  }
107

108
  public List<RetentionPolicyAssignmentFilterFieldsField> getFilterFields() {
109
    return filterFields;
×
110
  }
111

112
  public UserMini getAssignedBy() {
113
    return assignedBy;
×
114
  }
115

116
  public OffsetDateTime getAssignedAt() {
117
    return assignedAt;
×
118
  }
119

120
  public String getStartDateField() {
121
    return startDateField;
×
122
  }
123

124
  @Override
125
  public boolean equals(Object o) {
126
    if (this == o) {
×
127
      return true;
×
128
    }
129
    if (o == null || getClass() != o.getClass()) {
×
130
      return false;
×
131
    }
132
    RetentionPolicyAssignment casted = (RetentionPolicyAssignment) o;
×
133
    return Objects.equals(id, casted.id)
×
134
        && Objects.equals(type, casted.type)
×
135
        && Objects.equals(retentionPolicy, casted.retentionPolicy)
×
136
        && Objects.equals(assignedTo, casted.assignedTo)
×
137
        && Objects.equals(filterFields, casted.filterFields)
×
138
        && Objects.equals(assignedBy, casted.assignedBy)
×
139
        && Objects.equals(assignedAt, casted.assignedAt)
×
140
        && Objects.equals(startDateField, casted.startDateField);
×
141
  }
142

143
  @Override
144
  public int hashCode() {
145
    return Objects.hash(
×
146
        id,
147
        type,
148
        retentionPolicy,
149
        assignedTo,
150
        filterFields,
151
        assignedBy,
152
        assignedAt,
153
        startDateField);
154
  }
155

156
  @Override
157
  public String toString() {
158
    return "RetentionPolicyAssignment{"
×
159
        + "id='"
160
        + id
161
        + '\''
162
        + ", "
163
        + "type='"
164
        + type
165
        + '\''
166
        + ", "
167
        + "retentionPolicy='"
168
        + retentionPolicy
169
        + '\''
170
        + ", "
171
        + "assignedTo='"
172
        + assignedTo
173
        + '\''
174
        + ", "
175
        + "filterFields='"
176
        + filterFields
177
        + '\''
178
        + ", "
179
        + "assignedBy='"
180
        + assignedBy
181
        + '\''
182
        + ", "
183
        + "assignedAt='"
184
        + assignedAt
185
        + '\''
186
        + ", "
187
        + "startDateField='"
188
        + startDateField
189
        + '\''
190
        + "}";
191
  }
192

193
  public static class Builder extends NullableFieldTracker {
194

195
    protected final String id;
196

197
    protected EnumWrapper<RetentionPolicyAssignmentTypeField> type;
198

199
    protected RetentionPolicyMini retentionPolicy;
200

201
    protected RetentionPolicyAssignmentAssignedToField assignedTo;
202

203
    protected List<RetentionPolicyAssignmentFilterFieldsField> filterFields;
204

205
    protected UserMini assignedBy;
206

207
    protected OffsetDateTime assignedAt;
208

209
    protected String startDateField;
210

211
    public Builder(String id) {
212
      super();
×
213
      this.id = id;
×
214
    }
×
215

216
    public Builder type(RetentionPolicyAssignmentTypeField type) {
UNCOV
217
      this.type = new EnumWrapper<RetentionPolicyAssignmentTypeField>(type);
×
UNCOV
218
      return this;
×
219
    }
220

221
    public Builder type(EnumWrapper<RetentionPolicyAssignmentTypeField> type) {
UNCOV
222
      this.type = type;
×
UNCOV
223
      return this;
×
224
    }
225

226
    public Builder retentionPolicy(RetentionPolicyMini retentionPolicy) {
UNCOV
227
      this.retentionPolicy = retentionPolicy;
×
UNCOV
228
      return this;
×
229
    }
230

231
    public Builder assignedTo(RetentionPolicyAssignmentAssignedToField assignedTo) {
UNCOV
232
      this.assignedTo = assignedTo;
×
UNCOV
233
      return this;
×
234
    }
235

236
    public Builder filterFields(List<RetentionPolicyAssignmentFilterFieldsField> filterFields) {
UNCOV
237
      this.filterFields = filterFields;
×
UNCOV
238
      this.markNullableFieldAsSet("filter_fields");
×
UNCOV
239
      return this;
×
240
    }
241

242
    public Builder assignedBy(UserMini assignedBy) {
UNCOV
243
      this.assignedBy = assignedBy;
×
UNCOV
244
      return this;
×
245
    }
246

247
    public Builder assignedAt(OffsetDateTime assignedAt) {
UNCOV
248
      this.assignedAt = assignedAt;
×
UNCOV
249
      return this;
×
250
    }
251

252
    public Builder startDateField(String startDateField) {
UNCOV
253
      this.startDateField = startDateField;
×
UNCOV
254
      return this;
×
255
    }
256

257
    public RetentionPolicyAssignment build() {
NEW
258
      if (this.type == null) {
×
NEW
259
        this.type =
×
260
            new EnumWrapper<RetentionPolicyAssignmentTypeField>(
261
                RetentionPolicyAssignmentTypeField.RETENTION_POLICY_ASSIGNMENT);
262
      }
UNCOV
263
      return new RetentionPolicyAssignment(this);
×
264
    }
265
  }
266
}
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