org.cloudfoundry.client.v2.organizations.UserOrganizationRoleEntity Maven / Gradle / Ivy
package org.cloudfoundry.client.v2.organizations;
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.cloudfoundry.client.v2.users.AbstractUserEntity;
import org.immutables.value.Generated;
/**
* The entity response payload for the Route resource
*/
@Generated(from = "_UserOrganizationRoleEntity", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class UserOrganizationRoleEntity
extends org.cloudfoundry.client.v2.organizations._UserOrganizationRoleEntity {
private final @Nullable Boolean active;
private final @Nullable Boolean admin;
private final @Nullable String auditedOrganizationsUrl;
private final @Nullable String auditedSpacesUrl;
private final @Nullable String billingManagedOrganizationsUrl;
private final @Nullable String defaultSpaceId;
private final @Nullable String defaultSpaceUrl;
private final @Nullable String managedOrganizationsUrl;
private final @Nullable String managedSpacesUrl;
private final @Nullable String organizationsUrl;
private final @Nullable String spacesUrl;
private final @Nullable String username;
private final @Nullable List organizationRoles;
private UserOrganizationRoleEntity(UserOrganizationRoleEntity.Builder builder) {
this.active = builder.active;
this.admin = builder.admin;
this.auditedOrganizationsUrl = builder.auditedOrganizationsUrl;
this.auditedSpacesUrl = builder.auditedSpacesUrl;
this.billingManagedOrganizationsUrl = builder.billingManagedOrganizationsUrl;
this.defaultSpaceId = builder.defaultSpaceId;
this.defaultSpaceUrl = builder.defaultSpaceUrl;
this.managedOrganizationsUrl = builder.managedOrganizationsUrl;
this.managedSpacesUrl = builder.managedSpacesUrl;
this.organizationsUrl = builder.organizationsUrl;
this.spacesUrl = builder.spacesUrl;
this.username = builder.username;
this.organizationRoles = builder.organizationRoles == null ? null : createUnmodifiableList(true, builder.organizationRoles);
}
/**
* The active property
*/
@JsonProperty("active")
@Override
public @Nullable Boolean getActive() {
return active;
}
/**
* The admin property
*/
@JsonProperty("admin")
@Override
public @Nullable Boolean getAdmin() {
return admin;
}
/**
* The audited organizations url
*/
@JsonProperty("audited_organizations_url")
@Override
public @Nullable String getAuditedOrganizationsUrl() {
return auditedOrganizationsUrl;
}
/**
* The audited spaces url
*/
@JsonProperty("audited_spaces_url")
@Override
public @Nullable String getAuditedSpacesUrl() {
return auditedSpacesUrl;
}
/**
* The billing managed organizations url
*/
@JsonProperty("billing_managed_organizations_url")
@Override
public @Nullable String getBillingManagedOrganizationsUrl() {
return billingManagedOrganizationsUrl;
}
/**
* The default space id
*/
@JsonProperty("default_space_guid")
@Override
public @Nullable String getDefaultSpaceId() {
return defaultSpaceId;
}
/**
* The default space url
*/
@JsonProperty("default_space_url")
@Override
public @Nullable String getDefaultSpaceUrl() {
return defaultSpaceUrl;
}
/**
* The managed organizations url
*/
@JsonProperty("managed_organizations_url")
@Override
public @Nullable String getManagedOrganizationsUrl() {
return managedOrganizationsUrl;
}
/**
* The managed spaces url
*/
@JsonProperty("managed_spaces_url")
@Override
public @Nullable String getManagedSpacesUrl() {
return managedSpacesUrl;
}
/**
* The organizations url
*/
@JsonProperty("organizations_url")
@Override
public @Nullable String getOrganizationsUrl() {
return organizationsUrl;
}
/**
* The spaces url
*/
@JsonProperty("spaces_url")
@Override
public @Nullable String getSpacesUrl() {
return spacesUrl;
}
/**
* The username
*/
@JsonProperty("username")
@Override
public @Nullable String getUsername() {
return username;
}
/**
* The organization roles
*/
@JsonProperty("organization_roles")
@Override
public @Nullable List getOrganizationRoles() {
return organizationRoles;
}
/**
* This instance is equal to all instances of {@code UserOrganizationRoleEntity} 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 UserOrganizationRoleEntity
&& equalTo(0, (UserOrganizationRoleEntity) another);
}
private boolean equalTo(int synthetic, UserOrganizationRoleEntity another) {
return Objects.equals(active, another.active)
&& Objects.equals(admin, another.admin)
&& Objects.equals(auditedOrganizationsUrl, another.auditedOrganizationsUrl)
&& Objects.equals(auditedSpacesUrl, another.auditedSpacesUrl)
&& Objects.equals(billingManagedOrganizationsUrl, another.billingManagedOrganizationsUrl)
&& Objects.equals(defaultSpaceId, another.defaultSpaceId)
&& Objects.equals(defaultSpaceUrl, another.defaultSpaceUrl)
&& Objects.equals(managedOrganizationsUrl, another.managedOrganizationsUrl)
&& Objects.equals(managedSpacesUrl, another.managedSpacesUrl)
&& Objects.equals(organizationsUrl, another.organizationsUrl)
&& Objects.equals(spacesUrl, another.spacesUrl)
&& Objects.equals(username, another.username)
&& Objects.equals(organizationRoles, another.organizationRoles);
}
/**
* Computes a hash code from attributes: {@code active}, {@code admin}, {@code auditedOrganizationsUrl}, {@code auditedSpacesUrl}, {@code billingManagedOrganizationsUrl}, {@code defaultSpaceId}, {@code defaultSpaceUrl}, {@code managedOrganizationsUrl}, {@code managedSpacesUrl}, {@code organizationsUrl}, {@code spacesUrl}, {@code username}, {@code organizationRoles}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + Objects.hashCode(active);
h += (h << 5) + Objects.hashCode(admin);
h += (h << 5) + Objects.hashCode(auditedOrganizationsUrl);
h += (h << 5) + Objects.hashCode(auditedSpacesUrl);
h += (h << 5) + Objects.hashCode(billingManagedOrganizationsUrl);
h += (h << 5) + Objects.hashCode(defaultSpaceId);
h += (h << 5) + Objects.hashCode(defaultSpaceUrl);
h += (h << 5) + Objects.hashCode(managedOrganizationsUrl);
h += (h << 5) + Objects.hashCode(managedSpacesUrl);
h += (h << 5) + Objects.hashCode(organizationsUrl);
h += (h << 5) + Objects.hashCode(spacesUrl);
h += (h << 5) + Objects.hashCode(username);
h += (h << 5) + Objects.hashCode(organizationRoles);
return h;
}
/**
* Prints the immutable value {@code UserOrganizationRoleEntity} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "UserOrganizationRoleEntity{"
+ "active=" + active
+ ", admin=" + admin
+ ", auditedOrganizationsUrl=" + auditedOrganizationsUrl
+ ", auditedSpacesUrl=" + auditedSpacesUrl
+ ", billingManagedOrganizationsUrl=" + billingManagedOrganizationsUrl
+ ", defaultSpaceId=" + defaultSpaceId
+ ", defaultSpaceUrl=" + defaultSpaceUrl
+ ", managedOrganizationsUrl=" + managedOrganizationsUrl
+ ", managedSpacesUrl=" + managedSpacesUrl
+ ", organizationsUrl=" + organizationsUrl
+ ", spacesUrl=" + spacesUrl
+ ", username=" + username
+ ", organizationRoles=" + organizationRoles
+ "}";
}
/**
* 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 = "_UserOrganizationRoleEntity", generator = "Immutables")
@Deprecated
@JsonDeserialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json extends org.cloudfoundry.client.v2.organizations._UserOrganizationRoleEntity {
Boolean active;
Boolean admin;
String auditedOrganizationsUrl;
String auditedSpacesUrl;
String billingManagedOrganizationsUrl;
String defaultSpaceId;
String defaultSpaceUrl;
String managedOrganizationsUrl;
String managedSpacesUrl;
String organizationsUrl;
String spacesUrl;
String username;
List organizationRoles = null;
@JsonProperty("active")
public void setActive(@Nullable Boolean active) {
this.active = active;
}
@JsonProperty("admin")
public void setAdmin(@Nullable Boolean admin) {
this.admin = admin;
}
@JsonProperty("audited_organizations_url")
public void setAuditedOrganizationsUrl(@Nullable String auditedOrganizationsUrl) {
this.auditedOrganizationsUrl = auditedOrganizationsUrl;
}
@JsonProperty("audited_spaces_url")
public void setAuditedSpacesUrl(@Nullable String auditedSpacesUrl) {
this.auditedSpacesUrl = auditedSpacesUrl;
}
@JsonProperty("billing_managed_organizations_url")
public void setBillingManagedOrganizationsUrl(@Nullable String billingManagedOrganizationsUrl) {
this.billingManagedOrganizationsUrl = billingManagedOrganizationsUrl;
}
@JsonProperty("default_space_guid")
public void setDefaultSpaceId(@Nullable String defaultSpaceId) {
this.defaultSpaceId = defaultSpaceId;
}
@JsonProperty("default_space_url")
public void setDefaultSpaceUrl(@Nullable String defaultSpaceUrl) {
this.defaultSpaceUrl = defaultSpaceUrl;
}
@JsonProperty("managed_organizations_url")
public void setManagedOrganizationsUrl(@Nullable String managedOrganizationsUrl) {
this.managedOrganizationsUrl = managedOrganizationsUrl;
}
@JsonProperty("managed_spaces_url")
public void setManagedSpacesUrl(@Nullable String managedSpacesUrl) {
this.managedSpacesUrl = managedSpacesUrl;
}
@JsonProperty("organizations_url")
public void setOrganizationsUrl(@Nullable String organizationsUrl) {
this.organizationsUrl = organizationsUrl;
}
@JsonProperty("spaces_url")
public void setSpacesUrl(@Nullable String spacesUrl) {
this.spacesUrl = spacesUrl;
}
@JsonProperty("username")
public void setUsername(@Nullable String username) {
this.username = username;
}
@JsonProperty("organization_roles")
public void setOrganizationRoles(@Nullable List organizationRoles) {
this.organizationRoles = organizationRoles;
}
@Override
public Boolean getActive() { throw new UnsupportedOperationException(); }
@Override
public Boolean getAdmin() { throw new UnsupportedOperationException(); }
@Override
public String getAuditedOrganizationsUrl() { throw new UnsupportedOperationException(); }
@Override
public String getAuditedSpacesUrl() { throw new UnsupportedOperationException(); }
@Override
public String getBillingManagedOrganizationsUrl() { throw new UnsupportedOperationException(); }
@Override
public String getDefaultSpaceId() { throw new UnsupportedOperationException(); }
@Override
public String getDefaultSpaceUrl() { throw new UnsupportedOperationException(); }
@Override
public String getManagedOrganizationsUrl() { throw new UnsupportedOperationException(); }
@Override
public String getManagedSpacesUrl() { throw new UnsupportedOperationException(); }
@Override
public String getOrganizationsUrl() { throw new UnsupportedOperationException(); }
@Override
public String getSpacesUrl() { throw new UnsupportedOperationException(); }
@Override
public String getUsername() { throw new UnsupportedOperationException(); }
@Override
public List getOrganizationRoles() { 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 UserOrganizationRoleEntity fromJson(Json json) {
UserOrganizationRoleEntity.Builder builder = UserOrganizationRoleEntity.builder();
if (json.active != null) {
builder.active(json.active);
}
if (json.admin != null) {
builder.admin(json.admin);
}
if (json.auditedOrganizationsUrl != null) {
builder.auditedOrganizationsUrl(json.auditedOrganizationsUrl);
}
if (json.auditedSpacesUrl != null) {
builder.auditedSpacesUrl(json.auditedSpacesUrl);
}
if (json.billingManagedOrganizationsUrl != null) {
builder.billingManagedOrganizationsUrl(json.billingManagedOrganizationsUrl);
}
if (json.defaultSpaceId != null) {
builder.defaultSpaceId(json.defaultSpaceId);
}
if (json.defaultSpaceUrl != null) {
builder.defaultSpaceUrl(json.defaultSpaceUrl);
}
if (json.managedOrganizationsUrl != null) {
builder.managedOrganizationsUrl(json.managedOrganizationsUrl);
}
if (json.managedSpacesUrl != null) {
builder.managedSpacesUrl(json.managedSpacesUrl);
}
if (json.organizationsUrl != null) {
builder.organizationsUrl(json.organizationsUrl);
}
if (json.spacesUrl != null) {
builder.spacesUrl(json.spacesUrl);
}
if (json.username != null) {
builder.username(json.username);
}
if (json.organizationRoles != null) {
builder.addAllOrganizationRoles(json.organizationRoles);
}
return builder.build();
}
/**
* Creates a builder for {@link UserOrganizationRoleEntity UserOrganizationRoleEntity}.
*
* UserOrganizationRoleEntity.builder()
* .active(Boolean | null) // nullable {@link UserOrganizationRoleEntity#getActive() active}
* .admin(Boolean | null) // nullable {@link UserOrganizationRoleEntity#getAdmin() admin}
* .auditedOrganizationsUrl(String | null) // nullable {@link UserOrganizationRoleEntity#getAuditedOrganizationsUrl() auditedOrganizationsUrl}
* .auditedSpacesUrl(String | null) // nullable {@link UserOrganizationRoleEntity#getAuditedSpacesUrl() auditedSpacesUrl}
* .billingManagedOrganizationsUrl(String | null) // nullable {@link UserOrganizationRoleEntity#getBillingManagedOrganizationsUrl() billingManagedOrganizationsUrl}
* .defaultSpaceId(String | null) // nullable {@link UserOrganizationRoleEntity#getDefaultSpaceId() defaultSpaceId}
* .defaultSpaceUrl(String | null) // nullable {@link UserOrganizationRoleEntity#getDefaultSpaceUrl() defaultSpaceUrl}
* .managedOrganizationsUrl(String | null) // nullable {@link UserOrganizationRoleEntity#getManagedOrganizationsUrl() managedOrganizationsUrl}
* .managedSpacesUrl(String | null) // nullable {@link UserOrganizationRoleEntity#getManagedSpacesUrl() managedSpacesUrl}
* .organizationsUrl(String | null) // nullable {@link UserOrganizationRoleEntity#getOrganizationsUrl() organizationsUrl}
* .spacesUrl(String | null) // nullable {@link UserOrganizationRoleEntity#getSpacesUrl() spacesUrl}
* .username(String | null) // nullable {@link UserOrganizationRoleEntity#getUsername() username}
* .organizationRoles(List<String> | null) // nullable {@link UserOrganizationRoleEntity#getOrganizationRoles() organizationRoles}
* .build();
*
* @return A new UserOrganizationRoleEntity builder
*/
public static UserOrganizationRoleEntity.Builder builder() {
return new UserOrganizationRoleEntity.Builder();
}
/**
* Builds instances of type {@link UserOrganizationRoleEntity UserOrganizationRoleEntity}.
* 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 = "_UserOrganizationRoleEntity", generator = "Immutables")
public static final class Builder {
private Boolean active;
private Boolean admin;
private String auditedOrganizationsUrl;
private String auditedSpacesUrl;
private String billingManagedOrganizationsUrl;
private String defaultSpaceId;
private String defaultSpaceUrl;
private String managedOrganizationsUrl;
private String managedSpacesUrl;
private String organizationsUrl;
private String spacesUrl;
private String username;
private List organizationRoles = null;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code org.cloudfoundry.client.v2.users.AbstractUserEntity} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(AbstractUserEntity instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code UserOrganizationRoleEntity} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(UserOrganizationRoleEntity instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
/**
* Copy abstract value type {@code _UserOrganizationRoleEntity} 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(_UserOrganizationRoleEntity instance) {
Objects.requireNonNull(instance, "instance");
from((short) 0, (Object) instance);
return this;
}
private void from(short _unused, Object object) {
if (object instanceof AbstractUserEntity) {
AbstractUserEntity instance = (AbstractUserEntity) object;
String spacesUrlValue = instance.getSpacesUrl();
if (spacesUrlValue != null) {
spacesUrl(spacesUrlValue);
}
String auditedSpacesUrlValue = instance.getAuditedSpacesUrl();
if (auditedSpacesUrlValue != null) {
auditedSpacesUrl(auditedSpacesUrlValue);
}
String managedOrganizationsUrlValue = instance.getManagedOrganizationsUrl();
if (managedOrganizationsUrlValue != null) {
managedOrganizationsUrl(managedOrganizationsUrlValue);
}
String defaultSpaceIdValue = instance.getDefaultSpaceId();
if (defaultSpaceIdValue != null) {
defaultSpaceId(defaultSpaceIdValue);
}
String organizationsUrlValue = instance.getOrganizationsUrl();
if (organizationsUrlValue != null) {
organizationsUrl(organizationsUrlValue);
}
Boolean activeValue = instance.getActive();
if (activeValue != null) {
active(activeValue);
}
Boolean adminValue = instance.getAdmin();
if (adminValue != null) {
admin(adminValue);
}
String managedSpacesUrlValue = instance.getManagedSpacesUrl();
if (managedSpacesUrlValue != null) {
managedSpacesUrl(managedSpacesUrlValue);
}
String defaultSpaceUrlValue = instance.getDefaultSpaceUrl();
if (defaultSpaceUrlValue != null) {
defaultSpaceUrl(defaultSpaceUrlValue);
}
String billingManagedOrganizationsUrlValue = instance.getBillingManagedOrganizationsUrl();
if (billingManagedOrganizationsUrlValue != null) {
billingManagedOrganizationsUrl(billingManagedOrganizationsUrlValue);
}
String auditedOrganizationsUrlValue = instance.getAuditedOrganizationsUrl();
if (auditedOrganizationsUrlValue != null) {
auditedOrganizationsUrl(auditedOrganizationsUrlValue);
}
String usernameValue = instance.getUsername();
if (usernameValue != null) {
username(usernameValue);
}
}
if (object instanceof org.cloudfoundry.client.v2.organizations._UserOrganizationRoleEntity) {
org.cloudfoundry.client.v2.organizations._UserOrganizationRoleEntity instance = (org.cloudfoundry.client.v2.organizations._UserOrganizationRoleEntity) object;
List organizationRolesValue = instance.getOrganizationRoles();
if (organizationRolesValue != null) {
addAllOrganizationRoles(organizationRolesValue);
}
}
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getActive() active} attribute.
* @param active The value for active (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("active")
public final Builder active(@Nullable Boolean active) {
this.active = active;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getAdmin() admin} attribute.
* @param admin The value for admin (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("admin")
public final Builder admin(@Nullable Boolean admin) {
this.admin = admin;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getAuditedOrganizationsUrl() auditedOrganizationsUrl} attribute.
* @param auditedOrganizationsUrl The value for auditedOrganizationsUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("audited_organizations_url")
public final Builder auditedOrganizationsUrl(@Nullable String auditedOrganizationsUrl) {
this.auditedOrganizationsUrl = auditedOrganizationsUrl;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getAuditedSpacesUrl() auditedSpacesUrl} attribute.
* @param auditedSpacesUrl The value for auditedSpacesUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("audited_spaces_url")
public final Builder auditedSpacesUrl(@Nullable String auditedSpacesUrl) {
this.auditedSpacesUrl = auditedSpacesUrl;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getBillingManagedOrganizationsUrl() billingManagedOrganizationsUrl} attribute.
* @param billingManagedOrganizationsUrl The value for billingManagedOrganizationsUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("billing_managed_organizations_url")
public final Builder billingManagedOrganizationsUrl(@Nullable String billingManagedOrganizationsUrl) {
this.billingManagedOrganizationsUrl = billingManagedOrganizationsUrl;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getDefaultSpaceId() defaultSpaceId} attribute.
* @param defaultSpaceId The value for defaultSpaceId (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("default_space_guid")
public final Builder defaultSpaceId(@Nullable String defaultSpaceId) {
this.defaultSpaceId = defaultSpaceId;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getDefaultSpaceUrl() defaultSpaceUrl} attribute.
* @param defaultSpaceUrl The value for defaultSpaceUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("default_space_url")
public final Builder defaultSpaceUrl(@Nullable String defaultSpaceUrl) {
this.defaultSpaceUrl = defaultSpaceUrl;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getManagedOrganizationsUrl() managedOrganizationsUrl} attribute.
* @param managedOrganizationsUrl The value for managedOrganizationsUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("managed_organizations_url")
public final Builder managedOrganizationsUrl(@Nullable String managedOrganizationsUrl) {
this.managedOrganizationsUrl = managedOrganizationsUrl;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getManagedSpacesUrl() managedSpacesUrl} attribute.
* @param managedSpacesUrl The value for managedSpacesUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("managed_spaces_url")
public final Builder managedSpacesUrl(@Nullable String managedSpacesUrl) {
this.managedSpacesUrl = managedSpacesUrl;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getOrganizationsUrl() organizationsUrl} attribute.
* @param organizationsUrl The value for organizationsUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("organizations_url")
public final Builder organizationsUrl(@Nullable String organizationsUrl) {
this.organizationsUrl = organizationsUrl;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getSpacesUrl() spacesUrl} attribute.
* @param spacesUrl The value for spacesUrl (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("spaces_url")
public final Builder spacesUrl(@Nullable String spacesUrl) {
this.spacesUrl = spacesUrl;
return this;
}
/**
* Initializes the value for the {@link UserOrganizationRoleEntity#getUsername() username} attribute.
* @param username The value for username (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("username")
public final Builder username(@Nullable String username) {
this.username = username;
return this;
}
/**
* Adds one element to {@link UserOrganizationRoleEntity#getOrganizationRoles() organizationRoles} list.
* @param element A organizationRoles element
* @return {@code this} builder for use in a chained invocation
*/
public final Builder organizationRole(String element) {
if (this.organizationRoles == null) {
this.organizationRoles = new ArrayList();
}
this.organizationRoles.add(Objects.requireNonNull(element, "organizationRoles element"));
return this;
}
/**
* Adds elements to {@link UserOrganizationRoleEntity#getOrganizationRoles() organizationRoles} list.
* @param elements An array of organizationRoles elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder organizationRoles(String... elements) {
if (this.organizationRoles == null) {
this.organizationRoles = new ArrayList();
}
for (String element : elements) {
this.organizationRoles.add(Objects.requireNonNull(element, "organizationRoles element"));
}
return this;
}
/**
* Sets or replaces all elements for {@link UserOrganizationRoleEntity#getOrganizationRoles() organizationRoles} list.
* @param elements An iterable of organizationRoles elements
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("organization_roles")
public final Builder organizationRoles(@Nullable Iterable elements) {
if (elements == null) {
this.organizationRoles = null;
return this;
}
this.organizationRoles = new ArrayList();
return addAllOrganizationRoles(elements);
}
/**
* Adds elements to {@link UserOrganizationRoleEntity#getOrganizationRoles() organizationRoles} list.
* @param elements An iterable of organizationRoles elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addAllOrganizationRoles(Iterable elements) {
Objects.requireNonNull(elements, "organizationRoles element");
if (this.organizationRoles == null) {
this.organizationRoles = new ArrayList();
}
for (String element : elements) {
this.organizationRoles.add(Objects.requireNonNull(element, "organizationRoles element"));
}
return this;
}
/**
* Builds a new {@link UserOrganizationRoleEntity UserOrganizationRoleEntity}.
* @return An immutable instance of UserOrganizationRoleEntity
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public UserOrganizationRoleEntity build() {
return new UserOrganizationRoleEntity(this);
}
}
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);
}
}
}
}