-
Notifications
You must be signed in to change notification settings - Fork 189
Expand file tree
/
Copy pathUser.java
More file actions
408 lines (341 loc) · 9.71 KB
/
User.java
File metadata and controls
408 lines (341 loc) · 9.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
package com.box.sdkgen.schemas.user;
import com.box.sdkgen.internal.Nullable;
import com.box.sdkgen.internal.utils.DateTimeUtils;
import com.box.sdkgen.schemas.userbase.UserBaseTypeField;
import com.box.sdkgen.schemas.usermini.UserMini;
import com.box.sdkgen.serialization.json.EnumWrapper;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.time.OffsetDateTime;
import java.util.Objects;
/** A standard representation of a user, as returned from any user API endpoints by default. */
@JsonFilter("nullablePropertyFilter")
public class User extends UserMini {
/** When the user object was created. */
@JsonProperty("created_at")
@JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
@JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
protected OffsetDateTime createdAt;
/** When the user object was last modified. */
@JsonProperty("modified_at")
@JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class)
@JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class)
protected OffsetDateTime modifiedAt;
/**
* The language of the user, formatted in modified version of the [ISO
* 639-1](https://developer.box.com/guides/api-calls/language-codes) format.
*/
protected String language;
/** The user's timezone. */
protected String timezone;
/** The user’s total available space amount in bytes. */
@JsonProperty("space_amount")
protected Long spaceAmount;
/** The amount of space in use by the user. */
@JsonProperty("space_used")
protected Long spaceUsed;
/** The maximum individual file size in bytes the user can have. */
@JsonProperty("max_upload_size")
protected Long maxUploadSize;
/** The user's account status. */
@JsonDeserialize(using = UserStatusField.UserStatusFieldDeserializer.class)
@JsonSerialize(using = UserStatusField.UserStatusFieldSerializer.class)
protected EnumWrapper<UserStatusField> status;
/** The user’s job title. */
@JsonProperty("job_title")
protected String jobTitle;
/** The user’s phone number. */
protected String phone;
/** The user’s address. */
protected String address;
/** URL of the user’s avatar image. */
@JsonProperty("avatar_url")
protected String avatarUrl;
/**
* An alternate notification email address to which email notifications are sent. When it's
* confirmed, this will be the email address to which notifications are sent instead of to the
* primary email address.
*/
@JsonProperty("notification_email")
@Nullable
protected UserNotificationEmailField notificationEmail;
public User(@JsonProperty("id") String id) {
super(id);
}
protected User(Builder builder) {
super(builder);
this.createdAt = builder.createdAt;
this.modifiedAt = builder.modifiedAt;
this.language = builder.language;
this.timezone = builder.timezone;
this.spaceAmount = builder.spaceAmount;
this.spaceUsed = builder.spaceUsed;
this.maxUploadSize = builder.maxUploadSize;
this.status = builder.status;
this.jobTitle = builder.jobTitle;
this.phone = builder.phone;
this.address = builder.address;
this.avatarUrl = builder.avatarUrl;
this.notificationEmail = builder.notificationEmail;
markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
}
public OffsetDateTime getCreatedAt() {
return createdAt;
}
public OffsetDateTime getModifiedAt() {
return modifiedAt;
}
public String getLanguage() {
return language;
}
public String getTimezone() {
return timezone;
}
public Long getSpaceAmount() {
return spaceAmount;
}
public Long getSpaceUsed() {
return spaceUsed;
}
public Long getMaxUploadSize() {
return maxUploadSize;
}
public EnumWrapper<UserStatusField> getStatus() {
return status;
}
public String getJobTitle() {
return jobTitle;
}
public String getPhone() {
return phone;
}
public String getAddress() {
return address;
}
public String getAvatarUrl() {
return avatarUrl;
}
public UserNotificationEmailField getNotificationEmail() {
return notificationEmail;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
User casted = (User) o;
return Objects.equals(id, casted.id)
&& Objects.equals(type, casted.type)
&& Objects.equals(name, casted.name)
&& Objects.equals(login, casted.login)
&& Objects.equals(createdAt, casted.createdAt)
&& Objects.equals(modifiedAt, casted.modifiedAt)
&& Objects.equals(language, casted.language)
&& Objects.equals(timezone, casted.timezone)
&& Objects.equals(spaceAmount, casted.spaceAmount)
&& Objects.equals(spaceUsed, casted.spaceUsed)
&& Objects.equals(maxUploadSize, casted.maxUploadSize)
&& Objects.equals(status, casted.status)
&& Objects.equals(jobTitle, casted.jobTitle)
&& Objects.equals(phone, casted.phone)
&& Objects.equals(address, casted.address)
&& Objects.equals(avatarUrl, casted.avatarUrl)
&& Objects.equals(notificationEmail, casted.notificationEmail);
}
@Override
public int hashCode() {
return Objects.hash(
id,
type,
name,
login,
createdAt,
modifiedAt,
language,
timezone,
spaceAmount,
spaceUsed,
maxUploadSize,
status,
jobTitle,
phone,
address,
avatarUrl,
notificationEmail);
}
@Override
public String toString() {
return "User{"
+ "id='"
+ id
+ '\''
+ ", "
+ "type='"
+ type
+ '\''
+ ", "
+ "name='"
+ name
+ '\''
+ ", "
+ "login='"
+ login
+ '\''
+ ", "
+ "createdAt='"
+ createdAt
+ '\''
+ ", "
+ "modifiedAt='"
+ modifiedAt
+ '\''
+ ", "
+ "language='"
+ language
+ '\''
+ ", "
+ "timezone='"
+ timezone
+ '\''
+ ", "
+ "spaceAmount='"
+ spaceAmount
+ '\''
+ ", "
+ "spaceUsed='"
+ spaceUsed
+ '\''
+ ", "
+ "maxUploadSize='"
+ maxUploadSize
+ '\''
+ ", "
+ "status='"
+ status
+ '\''
+ ", "
+ "jobTitle='"
+ jobTitle
+ '\''
+ ", "
+ "phone='"
+ phone
+ '\''
+ ", "
+ "address='"
+ address
+ '\''
+ ", "
+ "avatarUrl='"
+ avatarUrl
+ '\''
+ ", "
+ "notificationEmail='"
+ notificationEmail
+ '\''
+ "}";
}
public static class Builder extends UserMini.Builder {
protected OffsetDateTime createdAt;
protected OffsetDateTime modifiedAt;
protected String language;
protected String timezone;
protected Long spaceAmount;
protected Long spaceUsed;
protected Long maxUploadSize;
protected EnumWrapper<UserStatusField> status;
protected String jobTitle;
protected String phone;
protected String address;
protected String avatarUrl;
protected UserNotificationEmailField notificationEmail;
public Builder(String id) {
super(id);
}
public Builder createdAt(OffsetDateTime createdAt) {
this.createdAt = createdAt;
return this;
}
public Builder modifiedAt(OffsetDateTime modifiedAt) {
this.modifiedAt = modifiedAt;
return this;
}
public Builder language(String language) {
this.language = language;
return this;
}
public Builder timezone(String timezone) {
this.timezone = timezone;
return this;
}
public Builder spaceAmount(Long spaceAmount) {
this.spaceAmount = spaceAmount;
return this;
}
public Builder spaceUsed(Long spaceUsed) {
this.spaceUsed = spaceUsed;
return this;
}
public Builder maxUploadSize(Long maxUploadSize) {
this.maxUploadSize = maxUploadSize;
return this;
}
public Builder status(UserStatusField status) {
this.status = new EnumWrapper<UserStatusField>(status);
return this;
}
public Builder status(EnumWrapper<UserStatusField> status) {
this.status = status;
return this;
}
public Builder jobTitle(String jobTitle) {
this.jobTitle = jobTitle;
return this;
}
public Builder phone(String phone) {
this.phone = phone;
return this;
}
public Builder address(String address) {
this.address = address;
return this;
}
public Builder avatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
return this;
}
public Builder notificationEmail(UserNotificationEmailField notificationEmail) {
this.notificationEmail = notificationEmail;
this.markNullableFieldAsSet("notification_email");
return this;
}
@Override
public Builder type(UserBaseTypeField type) {
this.type = new EnumWrapper<UserBaseTypeField>(type);
return this;
}
@Override
public Builder type(EnumWrapper<UserBaseTypeField> type) {
this.type = type;
return this;
}
@Override
public Builder name(String name) {
this.name = name;
return this;
}
@Override
public Builder login(String login) {
this.login = login;
return this;
}
public User build() {
return new User(this);
}
}
}