• 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

11.67
/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();
1✔
73
    this.id = id;
1✔
74
    this.type =
1✔
75
        new EnumWrapper<RetentionPolicyAssignmentTypeField>(
76
            RetentionPolicyAssignmentTypeField.RETENTION_POLICY_ASSIGNMENT);
77
  }
1✔
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;
1✔
94
  }
95

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

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

104
  public RetentionPolicyAssignmentAssignedToField getAssignedTo() {
105
    return assignedTo;
1✔
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
      this.type =
×
215
          new EnumWrapper<RetentionPolicyAssignmentTypeField>(
216
              RetentionPolicyAssignmentTypeField.RETENTION_POLICY_ASSIGNMENT);
217
    }
×
218

219
    public Builder type(RetentionPolicyAssignmentTypeField type) {
220
      this.type = new EnumWrapper<RetentionPolicyAssignmentTypeField>(type);
×
221
      return this;
×
222
    }
223

224
    public Builder type(EnumWrapper<RetentionPolicyAssignmentTypeField> type) {
225
      this.type = type;
×
226
      return this;
×
227
    }
228

229
    public Builder retentionPolicy(RetentionPolicyMini retentionPolicy) {
230
      this.retentionPolicy = retentionPolicy;
×
231
      return this;
×
232
    }
233

234
    public Builder assignedTo(RetentionPolicyAssignmentAssignedToField assignedTo) {
235
      this.assignedTo = assignedTo;
×
236
      return this;
×
237
    }
238

239
    public Builder filterFields(List<RetentionPolicyAssignmentFilterFieldsField> filterFields) {
240
      this.filterFields = filterFields;
×
241
      this.markNullableFieldAsSet("filter_fields");
×
242
      return this;
×
243
    }
244

245
    public Builder assignedBy(UserMini assignedBy) {
246
      this.assignedBy = assignedBy;
×
247
      return this;
×
248
    }
249

250
    public Builder assignedAt(OffsetDateTime assignedAt) {
251
      this.assignedAt = assignedAt;
×
252
      return this;
×
253
    }
254

255
    public Builder startDateField(String startDateField) {
256
      this.startDateField = startDateField;
×
257
      return this;
×
258
    }
259

260
    public RetentionPolicyAssignment build() {
261
      return new RetentionPolicyAssignment(this);
×
262
    }
263
  }
264
}
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