• 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

50.91
/src/main/java/com/box/sdkgen/schemas/metadataquery/MetadataQuery.java
1
package com.box.sdkgen.schemas.metadataquery;
2

3
import com.box.sdkgen.internal.NullableFieldTracker;
4
import com.box.sdkgen.internal.SerializableObject;
5
import com.fasterxml.jackson.annotation.JsonFilter;
6
import com.fasterxml.jackson.annotation.JsonProperty;
7
import java.util.List;
8
import java.util.Map;
9
import java.util.Objects;
10

11
/** Create a search using SQL-like syntax to return items that match specific metadata. */
12
@JsonFilter("nullablePropertyFilter")
13
public class MetadataQuery extends SerializableObject {
14

15
  /**
16
   * Specifies the template used in the query. Must be in the form `scope.templateKey`. Not all
17
   * templates can be used in this field, most notably the built-in, Box-provided classification
18
   * templates can not be used in a query.
19
   */
20
  protected final String from;
21

22
  /**
23
   * The query to perform. A query is a logical expression that is very similar to a SQL `SELECT`
24
   * statement. Values in the search query can be turned into parameters specified in the
25
   * `query_param` arguments list to prevent having to manually insert search values into the query
26
   * string.
27
   *
28
   * <p>For example, a value of `:amount` would represent the `amount` value in `query_params`
29
   * object.
30
   */
31
  protected String query;
32

33
  /**
34
   * Set of arguments corresponding to the parameters specified in the `query`. The type of each
35
   * parameter used in the `query_params` must match the type of the corresponding metadata template
36
   * field.
37
   */
38
  @JsonProperty("query_params")
39
  protected Map<String, Object> queryParams;
40

41
  /**
42
   * The ID of the folder that you are restricting the query to. A value of zero will return results
43
   * from all folders you have access to. A non-zero value will only return results found in the
44
   * folder corresponding to the ID or in any of its subfolders.
45
   */
46
  @JsonProperty("ancestor_folder_id")
47
  protected final String ancestorFolderId;
48

49
  /**
50
   * A list of template fields and directions to sort the metadata query results by.
51
   *
52
   * <p>The ordering `direction` must be the same for each item in the array.
53
   */
54
  @JsonProperty("order_by")
55
  protected List<MetadataQueryOrderByField> orderBy;
56

57
  /**
58
   * A value between 0 and 100 that indicates the maximum number of results to return for a single
59
   * request. This only specifies a maximum boundary and will not guarantee the minimum number of
60
   * results returned.
61
   */
62
  protected Long limit;
63

64
  /** Marker to use for requesting the next page. */
65
  protected String marker;
66

67
  /**
68
   * By default, this endpoint returns only the most basic info about the items for which the query
69
   * matches. This attribute can be used to specify a list of additional attributes to return for
70
   * any item, including its metadata.
71
   *
72
   * <p>This attribute takes a list of item fields, metadata template identifiers, or metadata
73
   * template field identifiers.
74
   *
75
   * <p>For example:
76
   *
77
   * <p>* `created_by` will add the details of the user who created the item to the response. *
78
   * `metadata.&lt;scope&gt;.&lt;templateKey&gt;` will return the mini-representation of the
79
   * metadata instance identified by the `scope` and `templateKey`. *
80
   * `metadata.&lt;scope&gt;.&lt;templateKey&gt;.&lt;field&gt;` will return all the
81
   * mini-representation of the metadata instance identified by the `scope` and `templateKey` plus
82
   * the field specified by the `field` name. Multiple fields for the same `scope` and `templateKey`
83
   * can be defined.
84
   */
85
  protected List<String> fields;
86

87
  public MetadataQuery(
88
      @JsonProperty("from") String from,
89
      @JsonProperty("ancestor_folder_id") String ancestorFolderId) {
90
    super();
×
91
    this.from = from;
×
92
    this.ancestorFolderId = ancestorFolderId;
×
93
  }
×
94

95
  protected MetadataQuery(Builder builder) {
96
    super();
1✔
97
    this.from = builder.from;
1✔
98
    this.query = builder.query;
1✔
99
    this.queryParams = builder.queryParams;
1✔
100
    this.ancestorFolderId = builder.ancestorFolderId;
1✔
101
    this.orderBy = builder.orderBy;
1✔
102
    this.limit = builder.limit;
1✔
103
    this.marker = builder.marker;
1✔
104
    this.fields = builder.fields;
1✔
105
    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
1✔
106
  }
1✔
107

108
  public String getFrom() {
109
    return from;
1✔
110
  }
111

112
  public String getQuery() {
113
    return query;
1✔
114
  }
115

116
  public Map<String, Object> getQueryParams() {
117
    return queryParams;
1✔
118
  }
119

120
  public String getAncestorFolderId() {
121
    return ancestorFolderId;
1✔
122
  }
123

124
  public List<MetadataQueryOrderByField> getOrderBy() {
125
    return orderBy;
1✔
126
  }
127

128
  public Long getLimit() {
129
    return limit;
1✔
130
  }
131

132
  public String getMarker() {
133
    return marker;
1✔
134
  }
135

136
  public List<String> getFields() {
137
    return fields;
1✔
138
  }
139

140
  @Override
141
  public boolean equals(Object o) {
142
    if (this == o) {
×
143
      return true;
×
144
    }
145
    if (o == null || getClass() != o.getClass()) {
×
146
      return false;
×
147
    }
148
    MetadataQuery casted = (MetadataQuery) o;
×
149
    return Objects.equals(from, casted.from)
×
150
        && Objects.equals(query, casted.query)
×
151
        && Objects.equals(queryParams, casted.queryParams)
×
152
        && Objects.equals(ancestorFolderId, casted.ancestorFolderId)
×
153
        && Objects.equals(orderBy, casted.orderBy)
×
154
        && Objects.equals(limit, casted.limit)
×
155
        && Objects.equals(marker, casted.marker)
×
156
        && Objects.equals(fields, casted.fields);
×
157
  }
158

159
  @Override
160
  public int hashCode() {
161
    return Objects.hash(from, query, queryParams, ancestorFolderId, orderBy, limit, marker, fields);
×
162
  }
163

164
  @Override
165
  public String toString() {
166
    return "MetadataQuery{"
×
167
        + "from='"
168
        + from
169
        + '\''
170
        + ", "
171
        + "query='"
172
        + query
173
        + '\''
174
        + ", "
175
        + "queryParams='"
176
        + queryParams
177
        + '\''
178
        + ", "
179
        + "ancestorFolderId='"
180
        + ancestorFolderId
181
        + '\''
182
        + ", "
183
        + "orderBy='"
184
        + orderBy
185
        + '\''
186
        + ", "
187
        + "limit='"
188
        + limit
189
        + '\''
190
        + ", "
191
        + "marker='"
192
        + marker
193
        + '\''
194
        + ", "
195
        + "fields='"
196
        + fields
197
        + '\''
198
        + "}";
199
  }
200

201
  public static class Builder extends NullableFieldTracker {
202

203
    protected final String from;
204

205
    protected String query;
206

207
    protected Map<String, Object> queryParams;
208

209
    protected final String ancestorFolderId;
210

211
    protected List<MetadataQueryOrderByField> orderBy;
212

213
    protected Long limit;
214

215
    protected String marker;
216

217
    protected List<String> fields;
218

219
    public Builder(String from, String ancestorFolderId) {
220
      super();
1✔
221
      this.from = from;
1✔
222
      this.ancestorFolderId = ancestorFolderId;
1✔
223
    }
1✔
224

225
    public Builder query(String query) {
226
      this.query = query;
1✔
227
      return this;
1✔
228
    }
229

230
    public Builder queryParams(Map<String, Object> queryParams) {
231
      this.queryParams = queryParams;
1✔
232
      return this;
1✔
233
    }
234

235
    public Builder orderBy(List<MetadataQueryOrderByField> orderBy) {
236
      this.orderBy = orderBy;
×
237
      return this;
×
238
    }
239

240
    public Builder limit(Long limit) {
241
      this.limit = limit;
×
242
      return this;
×
243
    }
244

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

250
    public Builder fields(List<String> fields) {
251
      this.fields = fields;
×
252
      return this;
×
253
    }
254

255
    public MetadataQuery build() {
256
      return new MetadataQuery(this);
1✔
257
    }
258
  }
259
}
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