org.cloudfoundry.uaa.users.VerifyUserResponse Maven / Gradle / Ivy
package org.cloudfoundry.uaa.users;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.cloudfoundry.Nullable;
import org.immutables.value.Generated;
/**
* The response from the verify user request
*/
@Generated(from = "_VerifyUserResponse", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class VerifyUserResponse extends org.cloudfoundry.uaa.users._VerifyUserResponse {
private final String id;
private final String origin;
private final String userName;
private final Boolean active;
private final List email;
private final @Nullable Long lastLogonTime;
private final Meta meta;
private final Name name;
private final String passwordLastModified;
private final List phoneNumbers;
private final @Nullable Long previousLoginTime;
private final List schemas;
private final Boolean verified;
private final String zoneId;
private VerifyUserResponse(VerifyUserResponse.Builder builder) {
this.id = builder.id;
this.origin = builder.origin;
this.userName = builder.userName;
this.active = builder.active;
this.email = createUnmodifiableList(true, builder.email);
this.lastLogonTime = builder.lastLogonTime;
this.meta = builder.meta;
this.name = builder.name;
this.passwordLastModified = builder.passwordLastModified;
this.phoneNumbers = createUnmodifiableList(true, builder.phoneNumbers);
this.previousLoginTime = builder.previousLoginTime;
this.schemas = createUnmodifiableList(true, builder.schemas);
this.verified = builder.verified;
this.zoneId = builder.zoneId;
}
/**
* The id
*/
@JsonProperty("id")
@Override
public String getId() {
return id;
}
/**
* The identity provider that authenticated this user
*/
@JsonProperty("origin")
@Override
public String getOrigin() {
return origin;
}
/**
* The user name
*/
@JsonProperty("userName")
@Override
public String getUserName() {
return userName;
}
/**
* Whether the user is active
*/
@JsonProperty("active")
@Override
public Boolean getActive() {
return active;
}
/**
* The emails for the user
*/
@JsonProperty("emails")
@Override
public List getEmail() {
return email;
}
/**
* The unix epoch timestamp of when the user last authenticated
*/
@JsonProperty("lastLogonTime")
@Override
public @Nullable Long getLastLogonTime() {
return lastLogonTime;
}
/**
* Metadata for the result
*/
@JsonProperty("meta")
@Override
public Meta getMeta() {
return meta;
}
/**
* The user's name
*/
@JsonProperty("name")
@Override
public Name getName() {
return name;
}
/**
* The timestamp when the user's password was last modified
*/
@JsonProperty("passwordLastModified")
@Override
public String getPasswordLastModified() {
return passwordLastModified;
}
/**
* The phone numbers for the user
*/
@JsonProperty("phoneNumbers")
@Override
public List getPhoneNumbers() {
return phoneNumbers;
}
/**
* The unix epoch timestamp of when the user last authenticated
*/
@JsonProperty("previousLogonTime")
@Override
public @Nullable Long getPreviousLoginTime() {
return previousLoginTime;
}
/**
* The schemas
*/
@JsonProperty("schemas")
@Override
public List getSchemas() {
return schemas;
}
/**
* Whether the user's email is verified
*/
@JsonProperty("verified")
@Override
public Boolean getVerified() {
return verified;
}
/**
* The zone id the user belongs to
*/
@JsonProperty("zoneId")
@Override
public String getZoneId() {
return zoneId;
}
/**
* This instance is equal to all instances of {@code VerifyUserResponse} that have equal attribute values.
* @return {@code true} if {@code this} is equal to {@code another} instance
*/
@Override
public boolean equals(Object another) {
if (this == another) return true;
return another instanceof VerifyUserResponse
&& equalTo(0, (VerifyUserResponse) another);
}
private boolean equalTo(int synthetic, VerifyUserResponse another) {
return id.equals(another.id)
&& origin.equals(another.origin)
&& userName.equals(another.userName)
&& active.equals(another.active)
&& email.equals(another.email)
&& Objects.equals(lastLogonTime, another.lastLogonTime)
&& meta.equals(another.meta)
&& name.equals(another.name)
&& passwordLastModified.equals(another.passwordLastModified)
&& phoneNumbers.equals(another.phoneNumbers)
&& Objects.equals(previousLoginTime, another.previousLoginTime)
&& schemas.equals(another.schemas)
&& verified.equals(another.verified)
&& zoneId.equals(another.zoneId);
}
/**
* Computes a hash code from attributes: {@code id}, {@code origin}, {@code userName}, {@code active}, {@code email}, {@code lastLogonTime}, {@code meta}, {@code name}, {@code passwordLastModified}, {@code phoneNumbers}, {@code previousLoginTime}, {@code schemas}, {@code verified}, {@code zoneId}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + id.hashCode();
h += (h << 5) + origin.hashCode();
h += (h << 5) + userName.hashCode();
h += (h << 5) + active.hashCode();
h += (h << 5) + email.hashCode();
h += (h << 5) + Objects.hashCode(lastLogonTime);
h += (h << 5) + meta.hashCode();
h += (h << 5) + name.hashCode();
h += (h << 5) + passwordLastModified.hashCode();
h += (h << 5) + phoneNumbers.hashCode();
h += (h << 5) + Objects.hashCode(previousLoginTime);
h += (h << 5) + schemas.hashCode();
h += (h << 5) + verified.hashCode();
h += (h << 5) + zoneId.hashCode();
return h;
}
/**
* Prints the immutable value {@code VerifyUserResponse} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "VerifyUserResponse{"
+ "id=" + id
+ ", origin=" + origin
+ ", userName=" + userName
+ ", active=" + active
+ ", email=" + email
+ ", lastLogonTime=" + lastLogonTime
+ ", meta=" + meta
+ ", name=" + name
+ ", passwordLastModified=" + passwordLastModified
+ ", phoneNumbers=" + phoneNumbers
+ ", previousLoginTime=" + previousLoginTime
+ ", schemas=" + schemas
+ ", verified=" + verified
+ ", zoneId=" + zoneId
+ "}";
}
/**
* Utility type used to correctly read immutable object from JSON representation.
* @deprecated Do not use this type directly, it exists only for the Jackson-binding infrastructure
*/
@Generated(from = "_VerifyUserResponse", generator = "Immutables")
@Deprecated
@JsonDeserialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json extends org.cloudfoundry.uaa.users._VerifyUserResponse {
String id;
String origin;
String userName;
Boolean active;
List email = Collections.emptyList();
Long lastLogonTime;
Meta meta;
Name name;
String passwordLastModified;
List phoneNumbers = Collections.emptyList();
Long previousLoginTime;
List schemas = Collections.emptyList();
Boolean verified;
String zoneId;
@JsonProperty("id")
public void setId(String id) {
this.id = id;
}
@JsonProperty("origin")
public void setOrigin(String origin) {
this.origin = origin;
}
@JsonProperty("userName")
public void setUserName(String userName) {
this.userName = userName;
}
@JsonProperty("active")
public void setActive(Boolean active) {
this.active = active;
}
@JsonProperty("emails")
public void setEmail(List email) {
this.email = email;
}
@JsonProperty("lastLogonTime")
public void setLastLogonTime(@Nullable Long lastLogonTime) {
this.lastLogonTime = lastLogonTime;
}
@JsonProperty("meta")
public void setMeta(Meta meta) {
this.meta = meta;
}
@JsonProperty("name")
public void setName(Name name) {
this.name = name;
}
@JsonProperty("passwordLastModified")
public void setPasswordLastModified(String passwordLastModified) {
this.passwordLastModified = passwordLastModified;
}
@JsonProperty("phoneNumbers")
public void setPhoneNumbers(List phoneNumbers) {
this.phoneNumbers = phoneNumbers;
}
@JsonProperty("previousLogonTime")
public void setPreviousLoginTime(@Nullable Long previousLoginTime) {
this.previousLoginTime = previousLoginTime;
}
@JsonProperty("schemas")
public void setSchemas(List schemas) {
this.schemas = schemas;
}
@JsonProperty("verified")
public void setVerified(Boolean verified) {
this.verified = verified;
}
@JsonProperty("zoneId")
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
@Override
public String getId() { throw new UnsupportedOperationException(); }
@Override
public String getOrigin() { throw new UnsupportedOperationException(); }
@Override
public String getUserName() { throw new UnsupportedOperationException(); }
@Override
public Boolean getActive() { throw new UnsupportedOperationException(); }
@Override
public List getEmail() { throw new UnsupportedOperationException(); }
@Override
public Long getLastLogonTime() { throw new UnsupportedOperationException(); }
@Override
public Meta getMeta() { throw new UnsupportedOperationException(); }
@Override
public Name getName() { throw new UnsupportedOperationException(); }
@Override
public String getPasswordLastModified() { throw new UnsupportedOperationException(); }
@Override
public List getPhoneNumbers() { throw new UnsupportedOperationException(); }
@Override
public Long getPreviousLoginTime() { throw new UnsupportedOperationException(); }
@Override
public List getSchemas() { throw new UnsupportedOperationException(); }
@Override
public Boolean getVerified() { throw new UnsupportedOperationException(); }
@Override
public String getZoneId() { throw new UnsupportedOperationException(); }
}
/**
* @param json A JSON-bindable data structure
* @return An immutable value type
* @deprecated Do not use this method directly, it exists only for the Jackson-binding infrastructure
*/
@Deprecated
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
static VerifyUserResponse fromJson(Json json) {
VerifyUserResponse.Builder builder = VerifyUserResponse.builder();
if (json.id != null) {
builder.id(json.id);
}
if (json.origin != null) {
builder.origin(json.origin);
}
if (json.userName != null) {
builder.userName(json.userName);
}
if (json.active != null) {
builder.active(json.active);
}
if (json.email != null) {
builder.addAllEmail(json.email);
}
if (json.lastLogonTime != null) {
builder.lastLogonTime(json.lastLogonTime);
}
if (json.meta != null) {
builder.meta(json.meta);
}
if (json.name != null) {
builder.name(json.name);
}
if (json.passwordLastModified != null) {
builder.passwordLastModified(json.passwordLastModified);
}
if (json.phoneNumbers != null) {
builder.addAllPhoneNumbers(json.phoneNumbers);
}
if (json.previousLoginTime != null) {
builder.previousLoginTime(json.previousLoginTime);
}
if (json.schemas != null) {
builder.addAllSchemas(json.schemas);
}
if (json.verified != null) {
builder.verified(json.verified);
}
if (json.zoneId != null) {
builder.zoneId(json.zoneId);
}
return builder.build();
}
/**
* Creates a builder for {@link VerifyUserResponse VerifyUserResponse}.
*
* VerifyUserResponse.builder()
* .id(String) // required {@link VerifyUserResponse#getId() id}
* .origin(String) // required {@link VerifyUserResponse#getOrigin() origin}
* .userName(String) // required {@link VerifyUserResponse#getUserName() userName}
* .active(Boolean) // required {@link VerifyUserResponse#getActive() active}
* .email|addAllEmail(Email) // {@link VerifyUserResponse#getEmail() email} elements
* .lastLogonTime(Long | null) // nullable {@link VerifyUserResponse#getLastLogonTime() lastLogonTime}
* .meta(org.cloudfoundry.uaa.users.Meta) // required {@link VerifyUserResponse#getMeta() meta}
* .name(org.cloudfoundry.uaa.users.Name) // required {@link VerifyUserResponse#getName() name}
* .passwordLastModified(String) // required {@link VerifyUserResponse#getPasswordLastModified() passwordLastModified}
* .phoneNumber|addAllPhoneNumbers(PhoneNumber) // {@link VerifyUserResponse#getPhoneNumbers() phoneNumbers} elements
* .previousLoginTime(Long | null) // nullable {@link VerifyUserResponse#getPreviousLoginTime() previousLoginTime}
* .schema|addAllSchemas(String) // {@link VerifyUserResponse#getSchemas() schemas} elements
* .verified(Boolean) // required {@link VerifyUserResponse#getVerified() verified}
* .zoneId(String) // required {@link VerifyUserResponse#getZoneId() zoneId}
* .build();
*
* @return A new VerifyUserResponse builder
*/
public static VerifyUserResponse.Builder builder() {
return new VerifyUserResponse.Builder();
}
/**
* Builds instances of type {@link VerifyUserResponse VerifyUserResponse}.
* Initialize attributes and then invoke the {@link #build()} method to create an
* immutable instance.
* {@code Builder} is not thread-safe and generally should not be stored in a field or collection,
* but instead used immediately to create instances.
*/
@Generated(from = "_VerifyUserResponse", generator = "Immutables")
public static final class Builder {
private static final long INIT_BIT_ID = 0x1L;
private static final long INIT_BIT_ORIGIN = 0x2L;
private static final long INIT_BIT_USER_NAME = 0x4L;
private static final long INIT_BIT_ACTIVE = 0x8L;
private static final long INIT_BIT_META = 0x10L;
private static final long INIT_BIT_NAME = 0x20L;
private static final long INIT_BIT_PASSWORD_LAST_MODIFIED = 0x40L;
private static final long INIT_BIT_VERIFIED = 0x80L;
private static final long INIT_BIT_ZONE_ID = 0x100L;
private long initBits = 0x1ffL;
private String id;
private String origin;
private String userName;
private Boolean active;
private List email = new ArrayList();
private Long lastLogonTime;
private Meta meta;
private Name name;
private String passwordLastModified;
private List phoneNumbers = new ArrayList();
private Long previousLoginTime;
private List schemas = new ArrayList();
private Boolean verified;
private String zoneId;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code org.cloudfoundry.uaa.users.AbstractUserSummary} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(AbstractUserSummary instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code org.cloudfoundry.uaa.users.AbstractUserId} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(AbstractUserId instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code VerifyUserResponse} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(VerifyUserResponse instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
/**
* Copy abstract value type {@code _VerifyUserResponse} instance into builder.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(_VerifyUserResponse instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
private void from(short _unused, Object object) {
long bits = 0;
if (object instanceof AbstractUserSummary) {
AbstractUserSummary instance = (AbstractUserSummary) object;
if ((bits & 0x1L) == 0) {
origin(instance.getOrigin());
bits |= 0x1L;
}
if ((bits & 0x2L) == 0) {
verified(instance.getVerified());
bits |= 0x2L;
}
if ((bits & 0x4L) == 0) {
active(instance.getActive());
bits |= 0x4L;
}
if ((bits & 0x8L) == 0) {
userName(instance.getUserName());
bits |= 0x8L;
}
if ((bits & 0x10L) == 0) {
addAllPhoneNumbers(instance.getPhoneNumbers());
bits |= 0x10L;
}
if ((bits & 0x20L) == 0) {
Long previousLoginTimeValue = instance.getPreviousLoginTime();
if (previousLoginTimeValue != null) {
previousLoginTime(previousLoginTimeValue);
}
bits |= 0x20L;
}
if ((bits & 0x40L) == 0) {
Long lastLogonTimeValue = instance.getLastLogonTime();
if (lastLogonTimeValue != null) {
lastLogonTime(lastLogonTimeValue);
}
bits |= 0x40L;
}
if ((bits & 0x80L) == 0) {
meta(instance.getMeta());
bits |= 0x80L;
}
if ((bits & 0x100L) == 0) {
addAllSchemas(instance.getSchemas());
bits |= 0x100L;
}
if ((bits & 0x200L) == 0) {
name(instance.getName());
bits |= 0x200L;
}
if ((bits & 0x400L) == 0) {
zoneId(instance.getZoneId());
bits |= 0x400L;
}
if ((bits & 0x800L) == 0) {
id(instance.getId());
bits |= 0x800L;
}
if ((bits & 0x1000L) == 0) {
passwordLastModified(instance.getPasswordLastModified());
bits |= 0x1000L;
}
if ((bits & 0x2000L) == 0) {
addAllEmail(instance.getEmail());
bits |= 0x2000L;
}
}
if (object instanceof AbstractUserId) {
AbstractUserId instance = (AbstractUserId) object;
if ((bits & 0x8L) == 0) {
userName(instance.getUserName());
bits |= 0x8L;
}
if ((bits & 0x1L) == 0) {
origin(instance.getOrigin());
bits |= 0x1L;
}
if ((bits & 0x800L) == 0) {
id(instance.getId());
bits |= 0x800L;
}
}
if (object instanceof org.cloudfoundry.uaa.users._VerifyUserResponse) {
org.cloudfoundry.uaa.users._VerifyUserResponse instance = (org.cloudfoundry.uaa.users._VerifyUserResponse) object;
if ((bits & 0x40L) == 0) {
Long lastLogonTimeValue = instance.getLastLogonTime();
if (lastLogonTimeValue != null) {
lastLogonTime(lastLogonTimeValue);
}
bits |= 0x40L;
}
if ((bits & 0x80L) == 0) {
meta(instance.getMeta());
bits |= 0x80L;
}
if ((bits & 0x100L) == 0) {
addAllSchemas(instance.getSchemas());
bits |= 0x100L;
}
if ((bits & 0x2L) == 0) {
verified(instance.getVerified());
bits |= 0x2L;
}
if ((bits & 0x200L) == 0) {
name(instance.getName());
bits |= 0x200L;
}
if ((bits & 0x4L) == 0) {
active(instance.getActive());
bits |= 0x4L;
}
if ((bits & 0x400L) == 0) {
zoneId(instance.getZoneId());
bits |= 0x400L;
}
if ((bits & 0x1000L) == 0) {
passwordLastModified(instance.getPasswordLastModified());
bits |= 0x1000L;
}
if ((bits & 0x10L) == 0) {
addAllPhoneNumbers(instance.getPhoneNumbers());
bits |= 0x10L;
}
if ((bits & 0x20L) == 0) {
Long previousLoginTimeValue = instance.getPreviousLoginTime();
if (previousLoginTimeValue != null) {
previousLoginTime(previousLoginTimeValue);
}
bits |= 0x20L;
}
if ((bits & 0x2000L) == 0) {
addAllEmail(instance.getEmail());
bits |= 0x2000L;
}
}
}
/**
* Initializes the value for the {@link VerifyUserResponse#getId() id} attribute.
* @param id The value for id
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("id")
public final Builder id(String id) {
this.id = Objects.requireNonNull(id, "id");
initBits &= ~INIT_BIT_ID;
return this;
}
/**
* Initializes the value for the {@link VerifyUserResponse#getOrigin() origin} attribute.
* @param origin The value for origin
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("origin")
public final Builder origin(String origin) {
this.origin = Objects.requireNonNull(origin, "origin");
initBits &= ~INIT_BIT_ORIGIN;
return this;
}
/**
* Initializes the value for the {@link VerifyUserResponse#getUserName() userName} attribute.
* @param userName The value for userName
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("userName")
public final Builder userName(String userName) {
this.userName = Objects.requireNonNull(userName, "userName");
initBits &= ~INIT_BIT_USER_NAME;
return this;
}
/**
* Initializes the value for the {@link VerifyUserResponse#getActive() active} attribute.
* @param active The value for active
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("active")
public final Builder active(Boolean active) {
this.active = Objects.requireNonNull(active, "active");
initBits &= ~INIT_BIT_ACTIVE;
return this;
}
/**
* Adds one element to {@link VerifyUserResponse#getEmail() email} list.
* @param element A email element
* @return {@code this} builder for use in a chained invocation
*/
public final Builder email(Email element) {
this.email.add(Objects.requireNonNull(element, "email element"));
return this;
}
/**
* Adds elements to {@link VerifyUserResponse#getEmail() email} list.
* @param elements An array of email elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder email(Email... elements) {
for (Email element : elements) {
this.email.add(Objects.requireNonNull(element, "email element"));
}
return this;
}
/**
* Sets or replaces all elements for {@link VerifyUserResponse#getEmail() email} list.
* @param elements An iterable of email elements
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("emails")
public final Builder email(Iterable extends Email> elements) {
this.email.clear();
return addAllEmail(elements);
}
/**
* Adds elements to {@link VerifyUserResponse#getEmail() email} list.
* @param elements An iterable of email elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addAllEmail(Iterable extends Email> elements) {
for (Email element : elements) {
this.email.add(Objects.requireNonNull(element, "email element"));
}
return this;
}
/**
* Initializes the value for the {@link VerifyUserResponse#getLastLogonTime() lastLogonTime} attribute.
* @param lastLogonTime The value for lastLogonTime (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("lastLogonTime")
public final Builder lastLogonTime(@Nullable Long lastLogonTime) {
this.lastLogonTime = lastLogonTime;
return this;
}
/**
* Initializes the value for the {@link VerifyUserResponse#getMeta() meta} attribute.
* @param meta The value for meta
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("meta")
public final Builder meta(Meta meta) {
this.meta = Objects.requireNonNull(meta, "meta");
initBits &= ~INIT_BIT_META;
return this;
}
/**
* Initializes the value for the {@link VerifyUserResponse#getName() name} attribute.
* @param name The value for name
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("name")
public final Builder name(Name name) {
this.name = Objects.requireNonNull(name, "name");
initBits &= ~INIT_BIT_NAME;
return this;
}
/**
* Initializes the value for the {@link VerifyUserResponse#getPasswordLastModified() passwordLastModified} attribute.
* @param passwordLastModified The value for passwordLastModified
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("passwordLastModified")
public final Builder passwordLastModified(String passwordLastModified) {
this.passwordLastModified = Objects.requireNonNull(passwordLastModified, "passwordLastModified");
initBits &= ~INIT_BIT_PASSWORD_LAST_MODIFIED;
return this;
}
/**
* Adds one element to {@link VerifyUserResponse#getPhoneNumbers() phoneNumbers} list.
* @param element A phoneNumbers element
* @return {@code this} builder for use in a chained invocation
*/
public final Builder phoneNumber(PhoneNumber element) {
this.phoneNumbers.add(Objects.requireNonNull(element, "phoneNumbers element"));
return this;
}
/**
* Adds elements to {@link VerifyUserResponse#getPhoneNumbers() phoneNumbers} list.
* @param elements An array of phoneNumbers elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder phoneNumbers(PhoneNumber... elements) {
for (PhoneNumber element : elements) {
this.phoneNumbers.add(Objects.requireNonNull(element, "phoneNumbers element"));
}
return this;
}
/**
* Sets or replaces all elements for {@link VerifyUserResponse#getPhoneNumbers() phoneNumbers} list.
* @param elements An iterable of phoneNumbers elements
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("phoneNumbers")
public final Builder phoneNumbers(Iterable extends PhoneNumber> elements) {
this.phoneNumbers.clear();
return addAllPhoneNumbers(elements);
}
/**
* Adds elements to {@link VerifyUserResponse#getPhoneNumbers() phoneNumbers} list.
* @param elements An iterable of phoneNumbers elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addAllPhoneNumbers(Iterable extends PhoneNumber> elements) {
for (PhoneNumber element : elements) {
this.phoneNumbers.add(Objects.requireNonNull(element, "phoneNumbers element"));
}
return this;
}
/**
* Initializes the value for the {@link VerifyUserResponse#getPreviousLoginTime() previousLoginTime} attribute.
* @param previousLoginTime The value for previousLoginTime (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("previousLogonTime")
public final Builder previousLoginTime(@Nullable Long previousLoginTime) {
this.previousLoginTime = previousLoginTime;
return this;
}
/**
* Adds one element to {@link VerifyUserResponse#getSchemas() schemas} list.
* @param element A schemas element
* @return {@code this} builder for use in a chained invocation
*/
public final Builder schema(String element) {
this.schemas.add(Objects.requireNonNull(element, "schemas element"));
return this;
}
/**
* Adds elements to {@link VerifyUserResponse#getSchemas() schemas} list.
* @param elements An array of schemas elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder schemas(String... elements) {
for (String element : elements) {
this.schemas.add(Objects.requireNonNull(element, "schemas element"));
}
return this;
}
/**
* Sets or replaces all elements for {@link VerifyUserResponse#getSchemas() schemas} list.
* @param elements An iterable of schemas elements
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("schemas")
public final Builder schemas(Iterable elements) {
this.schemas.clear();
return addAllSchemas(elements);
}
/**
* Adds elements to {@link VerifyUserResponse#getSchemas() schemas} list.
* @param elements An iterable of schemas elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addAllSchemas(Iterable elements) {
for (String element : elements) {
this.schemas.add(Objects.requireNonNull(element, "schemas element"));
}
return this;
}
/**
* Initializes the value for the {@link VerifyUserResponse#getVerified() verified} attribute.
* @param verified The value for verified
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("verified")
public final Builder verified(Boolean verified) {
this.verified = Objects.requireNonNull(verified, "verified");
initBits &= ~INIT_BIT_VERIFIED;
return this;
}
/**
* Initializes the value for the {@link VerifyUserResponse#getZoneId() zoneId} attribute.
* @param zoneId The value for zoneId
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("zoneId")
public final Builder zoneId(String zoneId) {
this.zoneId = Objects.requireNonNull(zoneId, "zoneId");
initBits &= ~INIT_BIT_ZONE_ID;
return this;
}
/**
* Builds a new {@link VerifyUserResponse VerifyUserResponse}.
* @return An immutable instance of VerifyUserResponse
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public VerifyUserResponse build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new VerifyUserResponse(this);
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList<>();
if ((initBits & INIT_BIT_ID) != 0) attributes.add("id");
if ((initBits & INIT_BIT_ORIGIN) != 0) attributes.add("origin");
if ((initBits & INIT_BIT_USER_NAME) != 0) attributes.add("userName");
if ((initBits & INIT_BIT_ACTIVE) != 0) attributes.add("active");
if ((initBits & INIT_BIT_META) != 0) attributes.add("meta");
if ((initBits & INIT_BIT_NAME) != 0) attributes.add("name");
if ((initBits & INIT_BIT_PASSWORD_LAST_MODIFIED) != 0) attributes.add("passwordLastModified");
if ((initBits & INIT_BIT_VERIFIED) != 0) attributes.add("verified");
if ((initBits & INIT_BIT_ZONE_ID) != 0) attributes.add("zoneId");
return "Cannot build VerifyUserResponse, some of required attributes are not set " + attributes;
}
}
private static List createSafeList(Iterable extends T> iterable, boolean checkNulls, boolean skipNulls) {
ArrayList list;
if (iterable instanceof Collection>) {
int size = ((Collection>) iterable).size();
if (size == 0) return Collections.emptyList();
list = new ArrayList<>(size);
} else {
list = new ArrayList<>();
}
for (T element : iterable) {
if (skipNulls && element == null) continue;
if (checkNulls) Objects.requireNonNull(element, "element");
list.add(element);
}
return list;
}
private static List createUnmodifiableList(boolean clone, List list) {
switch(list.size()) {
case 0: return Collections.emptyList();
case 1: return Collections.singletonList(list.get(0));
default:
if (clone) {
return Collections.unmodifiableList(new ArrayList<>(list));
} else {
if (list instanceof ArrayList>) {
((ArrayList>) list).trimToSize();
}
return Collections.unmodifiableList(list);
}
}
}
}