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

box / box-java-sdk / #6243

10 Feb 2026 05:27PM UTC coverage: 18.192% (-17.5%) from 35.714%
#6243

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%)

2147 existing lines in 545 files now uncovered.

7388 of 40611 relevant lines covered (18.19%)

0.21 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/metadatacascadepolicy/MetadataCascadePolicy.java
1
package com.box.sdkgen.schemas.metadatacascadepolicy;
2

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

12
/**
13
 * A metadata cascade policy automatically applies a metadata template instance to all the files and
14
 * folders within the targeted folder.
15
 */
16
@JsonFilter("nullablePropertyFilter")
17
public class MetadataCascadePolicy extends SerializableObject {
18

19
  /** The ID of the metadata cascade policy object. */
20
  protected final String id;
21

22
  /** The value will always be `metadata_cascade_policy`. */
23
  @JsonDeserialize(
24
      using = MetadataCascadePolicyTypeField.MetadataCascadePolicyTypeFieldDeserializer.class)
25
  @JsonSerialize(
26
      using = MetadataCascadePolicyTypeField.MetadataCascadePolicyTypeFieldSerializer.class)
27
  protected EnumWrapper<MetadataCascadePolicyTypeField> type;
28

29
  /** The enterprise that owns this policy. */
30
  @JsonProperty("owner_enterprise")
31
  protected MetadataCascadePolicyOwnerEnterpriseField ownerEnterprise;
32

33
  /** Represent the folder the policy is applied to. */
34
  protected MetadataCascadePolicyParentField parent;
35

36
  /**
37
   * The scope of the metadata cascade policy can either be `global` or `enterprise_*`. The `global`
38
   * scope is used for policies that are available to any Box enterprise. The `enterprise_*` scope
39
   * represents policies that have been created within a specific enterprise, where `*` will be the
40
   * ID of that enterprise.
41
   */
42
  protected String scope;
43

44
  /**
45
   * The key of the template that is cascaded down to the folder's children.
46
   *
47
   * <p>In many cases the template key is automatically derived of its display name, for example
48
   * `Contract Template` would become `contractTemplate`. In some cases the creator of the template
49
   * will have provided its own template key.
50
   *
51
   * <p>Please [list the templates for an enterprise][list], or get all instances on a [file][file]
52
   * or [folder][folder] to inspect a template's key.
53
   *
54
   * <p>[list]: https://developer.box.com/reference/get-metadata-templates-enterprise [file]:
55
   * https://developer.box.com/reference/get-files-id-metadata [folder]:
56
   * https://developer.box.com/reference/get-folders-id-metadata
57
   */
58
  protected String templateKey;
59

60
  public MetadataCascadePolicy(@JsonProperty("id") String id) {
61
    super();
×
62
    this.id = id;
×
63
    this.type =
×
64
        new EnumWrapper<MetadataCascadePolicyTypeField>(
65
            MetadataCascadePolicyTypeField.METADATA_CASCADE_POLICY);
66
  }
×
67

68
  protected MetadataCascadePolicy(Builder builder) {
69
    super();
×
70
    this.id = builder.id;
×
71
    this.type = builder.type;
×
72
    this.ownerEnterprise = builder.ownerEnterprise;
×
73
    this.parent = builder.parent;
×
74
    this.scope = builder.scope;
×
75
    this.templateKey = builder.templateKey;
×
76
    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
×
77
  }
×
78

79
  public String getId() {
80
    return id;
×
81
  }
82

83
  public EnumWrapper<MetadataCascadePolicyTypeField> getType() {
84
    return type;
×
85
  }
86

87
  public MetadataCascadePolicyOwnerEnterpriseField getOwnerEnterprise() {
88
    return ownerEnterprise;
×
89
  }
90

91
  public MetadataCascadePolicyParentField getParent() {
92
    return parent;
×
93
  }
94

95
  public String getScope() {
96
    return scope;
×
97
  }
98

99
  public String getTemplateKey() {
100
    return templateKey;
×
101
  }
102

103
  @Override
104
  public boolean equals(Object o) {
105
    if (this == o) {
×
106
      return true;
×
107
    }
108
    if (o == null || getClass() != o.getClass()) {
×
109
      return false;
×
110
    }
111
    MetadataCascadePolicy casted = (MetadataCascadePolicy) o;
×
112
    return Objects.equals(id, casted.id)
×
113
        && Objects.equals(type, casted.type)
×
114
        && Objects.equals(ownerEnterprise, casted.ownerEnterprise)
×
115
        && Objects.equals(parent, casted.parent)
×
116
        && Objects.equals(scope, casted.scope)
×
117
        && Objects.equals(templateKey, casted.templateKey);
×
118
  }
119

120
  @Override
121
  public int hashCode() {
122
    return Objects.hash(id, type, ownerEnterprise, parent, scope, templateKey);
×
123
  }
124

125
  @Override
126
  public String toString() {
127
    return "MetadataCascadePolicy{"
×
128
        + "id='"
129
        + id
130
        + '\''
131
        + ", "
132
        + "type='"
133
        + type
134
        + '\''
135
        + ", "
136
        + "ownerEnterprise='"
137
        + ownerEnterprise
138
        + '\''
139
        + ", "
140
        + "parent='"
141
        + parent
142
        + '\''
143
        + ", "
144
        + "scope='"
145
        + scope
146
        + '\''
147
        + ", "
148
        + "templateKey='"
149
        + templateKey
150
        + '\''
151
        + "}";
152
  }
153

154
  public static class Builder extends NullableFieldTracker {
155

156
    protected final String id;
157

158
    protected EnumWrapper<MetadataCascadePolicyTypeField> type;
159

160
    protected MetadataCascadePolicyOwnerEnterpriseField ownerEnterprise;
161

162
    protected MetadataCascadePolicyParentField parent;
163

164
    protected String scope;
165

166
    protected String templateKey;
167

168
    public Builder(String id) {
169
      super();
×
170
      this.id = id;
×
171
    }
×
172

173
    public Builder type(MetadataCascadePolicyTypeField type) {
UNCOV
174
      this.type = new EnumWrapper<MetadataCascadePolicyTypeField>(type);
×
UNCOV
175
      return this;
×
176
    }
177

178
    public Builder type(EnumWrapper<MetadataCascadePolicyTypeField> type) {
UNCOV
179
      this.type = type;
×
UNCOV
180
      return this;
×
181
    }
182

183
    public Builder ownerEnterprise(MetadataCascadePolicyOwnerEnterpriseField ownerEnterprise) {
UNCOV
184
      this.ownerEnterprise = ownerEnterprise;
×
UNCOV
185
      return this;
×
186
    }
187

188
    public Builder parent(MetadataCascadePolicyParentField parent) {
UNCOV
189
      this.parent = parent;
×
UNCOV
190
      return this;
×
191
    }
192

193
    public Builder scope(String scope) {
UNCOV
194
      this.scope = scope;
×
UNCOV
195
      return this;
×
196
    }
197

198
    public Builder templateKey(String templateKey) {
UNCOV
199
      this.templateKey = templateKey;
×
UNCOV
200
      return this;
×
201
    }
202

203
    public MetadataCascadePolicy build() {
NEW
204
      if (this.type == null) {
×
NEW
205
        this.type =
×
206
            new EnumWrapper<MetadataCascadePolicyTypeField>(
207
                MetadataCascadePolicyTypeField.METADATA_CASCADE_POLICY);
208
      }
UNCOV
209
      return new MetadataCascadePolicy(this);
×
210
    }
211
  }
212
}
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