• 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/metadatatemplate/MetadataTemplate.java
1
package com.box.sdkgen.schemas.metadatatemplate;
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.List;
11
import java.util.Objects;
12

13
/** A template for metadata that can be applied to files and folders. */
14
@JsonFilter("nullablePropertyFilter")
15
public class MetadataTemplate extends SerializableObject {
16

17
  /** The ID of the metadata template. */
18
  protected final String id;
19

20
  /** The value will always be `metadata_template`. */
21
  @JsonDeserialize(using = MetadataTemplateTypeField.MetadataTemplateTypeFieldDeserializer.class)
22
  @JsonSerialize(using = MetadataTemplateTypeField.MetadataTemplateTypeFieldSerializer.class)
23
  protected EnumWrapper<MetadataTemplateTypeField> type;
24

25
  /**
26
   * The scope of the metadata template can either be `global` or `enterprise_*`. The `global` scope
27
   * is used for templates that are available to any Box enterprise. The `enterprise_*` scope
28
   * represents templates that have been created within a specific enterprise, where `*` will be the
29
   * ID of that enterprise.
30
   */
31
  protected String scope;
32

33
  /**
34
   * A unique identifier for the template. This identifier is unique across the `scope` of the
35
   * enterprise to which the metadata template is being applied, yet is not necessarily unique
36
   * across different enterprises.
37
   */
38
  protected String templateKey;
39

40
  /** The display name of the template. This can be seen in the Box web app and mobile apps. */
41
  protected String displayName;
42

43
  /**
44
   * Defines if this template is visible in the Box web app UI, or if it is purely intended for
45
   * usage through the API.
46
   */
47
  protected Boolean hidden;
48

49
  /**
50
   * An ordered list of template fields which are part of the template. Each field can be a regular
51
   * text field, date field, number field, as well as a single or multi-select list.
52
   */
53
  protected List<MetadataTemplateFieldsField> fields;
54

55
  /** Whether or not to include the metadata when a file or folder is copied. */
56
  protected Boolean copyInstanceOnItemCopy;
57

58
  public MetadataTemplate(@JsonProperty("id") String id) {
59
    super();
×
60
    this.id = id;
×
61
    this.type =
×
62
        new EnumWrapper<MetadataTemplateTypeField>(MetadataTemplateTypeField.METADATA_TEMPLATE);
63
  }
×
64

65
  protected MetadataTemplate(Builder builder) {
66
    super();
×
67
    this.id = builder.id;
×
68
    this.type = builder.type;
×
69
    this.scope = builder.scope;
×
70
    this.templateKey = builder.templateKey;
×
71
    this.displayName = builder.displayName;
×
72
    this.hidden = builder.hidden;
×
73
    this.fields = builder.fields;
×
74
    this.copyInstanceOnItemCopy = builder.copyInstanceOnItemCopy;
×
75
    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
×
76
  }
×
77

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

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

86
  public String getScope() {
87
    return scope;
×
88
  }
89

90
  public String getTemplateKey() {
91
    return templateKey;
×
92
  }
93

94
  public String getDisplayName() {
95
    return displayName;
×
96
  }
97

98
  public Boolean getHidden() {
99
    return hidden;
×
100
  }
101

102
  public List<MetadataTemplateFieldsField> getFields() {
103
    return fields;
×
104
  }
105

106
  public Boolean getCopyInstanceOnItemCopy() {
107
    return copyInstanceOnItemCopy;
×
108
  }
109

110
  @Override
111
  public boolean equals(Object o) {
112
    if (this == o) {
×
113
      return true;
×
114
    }
115
    if (o == null || getClass() != o.getClass()) {
×
116
      return false;
×
117
    }
118
    MetadataTemplate casted = (MetadataTemplate) o;
×
119
    return Objects.equals(id, casted.id)
×
120
        && Objects.equals(type, casted.type)
×
121
        && Objects.equals(scope, casted.scope)
×
122
        && Objects.equals(templateKey, casted.templateKey)
×
123
        && Objects.equals(displayName, casted.displayName)
×
124
        && Objects.equals(hidden, casted.hidden)
×
125
        && Objects.equals(fields, casted.fields)
×
126
        && Objects.equals(copyInstanceOnItemCopy, casted.copyInstanceOnItemCopy);
×
127
  }
128

129
  @Override
130
  public int hashCode() {
131
    return Objects.hash(
×
132
        id, type, scope, templateKey, displayName, hidden, fields, copyInstanceOnItemCopy);
133
  }
134

135
  @Override
136
  public String toString() {
137
    return "MetadataTemplate{"
×
138
        + "id='"
139
        + id
140
        + '\''
141
        + ", "
142
        + "type='"
143
        + type
144
        + '\''
145
        + ", "
146
        + "scope='"
147
        + scope
148
        + '\''
149
        + ", "
150
        + "templateKey='"
151
        + templateKey
152
        + '\''
153
        + ", "
154
        + "displayName='"
155
        + displayName
156
        + '\''
157
        + ", "
158
        + "hidden='"
159
        + hidden
160
        + '\''
161
        + ", "
162
        + "fields='"
163
        + fields
164
        + '\''
165
        + ", "
166
        + "copyInstanceOnItemCopy='"
167
        + copyInstanceOnItemCopy
168
        + '\''
169
        + "}";
170
  }
171

172
  public static class Builder extends NullableFieldTracker {
173

174
    protected final String id;
175

176
    protected EnumWrapper<MetadataTemplateTypeField> type;
177

178
    protected String scope;
179

180
    protected String templateKey;
181

182
    protected String displayName;
183

184
    protected Boolean hidden;
185

186
    protected List<MetadataTemplateFieldsField> fields;
187

188
    protected Boolean copyInstanceOnItemCopy;
189

190
    public Builder(String id) {
191
      super();
×
192
      this.id = id;
×
193
    }
×
194

195
    public Builder type(MetadataTemplateTypeField type) {
UNCOV
196
      this.type = new EnumWrapper<MetadataTemplateTypeField>(type);
×
UNCOV
197
      return this;
×
198
    }
199

200
    public Builder type(EnumWrapper<MetadataTemplateTypeField> type) {
UNCOV
201
      this.type = type;
×
UNCOV
202
      return this;
×
203
    }
204

205
    public Builder scope(String scope) {
UNCOV
206
      this.scope = scope;
×
UNCOV
207
      return this;
×
208
    }
209

210
    public Builder templateKey(String templateKey) {
UNCOV
211
      this.templateKey = templateKey;
×
UNCOV
212
      return this;
×
213
    }
214

215
    public Builder displayName(String displayName) {
UNCOV
216
      this.displayName = displayName;
×
UNCOV
217
      return this;
×
218
    }
219

220
    public Builder hidden(Boolean hidden) {
UNCOV
221
      this.hidden = hidden;
×
UNCOV
222
      return this;
×
223
    }
224

225
    public Builder fields(List<MetadataTemplateFieldsField> fields) {
UNCOV
226
      this.fields = fields;
×
UNCOV
227
      return this;
×
228
    }
229

230
    public Builder copyInstanceOnItemCopy(Boolean copyInstanceOnItemCopy) {
UNCOV
231
      this.copyInstanceOnItemCopy = copyInstanceOnItemCopy;
×
UNCOV
232
      return this;
×
233
    }
234

235
    public MetadataTemplate build() {
NEW
236
      if (this.type == null) {
×
NEW
237
        this.type =
×
238
            new EnumWrapper<MetadataTemplateTypeField>(MetadataTemplateTypeField.METADATA_TEMPLATE);
239
      }
UNCOV
240
      return new MetadataTemplate(this);
×
241
    }
242
  }
243
}
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