org.cloudfoundry.client.lib.domain.ImmutableCloudServiceBroker Maven / Gradle / Ivy
Show all versions of cloudfoundry-client-lib Show documentation
package org.cloudfoundry.client.lib.domain;
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.Objects;
import org.cloudfoundry.client.lib.domain.annotation.Nullable;
import org.cloudfoundry.client.v3.Metadata;
import org.immutables.value.Generated;
/**
* Immutable implementation of {@link CloudServiceBroker}.
*
* Use the builder to create immutable instances:
* {@code ImmutableCloudServiceBroker.builder()}.
*/
@Generated(from = "CloudServiceBroker", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableCloudServiceBroker extends CloudServiceBroker {
private final @Nullable String name;
private final @Nullable CloudMetadata metadata;
private final @Nullable Metadata v3Metadata;
private final @Nullable String username;
private final @Nullable String password;
private final @Nullable String url;
private final @Nullable String spaceGuid;
private ImmutableCloudServiceBroker(
@Nullable String name,
@Nullable CloudMetadata metadata,
@Nullable Metadata v3Metadata,
@Nullable String username,
@Nullable String password,
@Nullable String url,
@Nullable String spaceGuid) {
this.name = name;
this.metadata = metadata;
this.v3Metadata = v3Metadata;
this.username = username;
this.password = password;
this.url = url;
this.spaceGuid = spaceGuid;
}
/**
* @return The value of the {@code name} attribute
*/
@JsonProperty("name")
@Override
public @Nullable String getName() {
return name;
}
/**
* @return The value of the {@code metadata} attribute
*/
@JsonProperty("metadata")
@Override
public @Nullable CloudMetadata getMetadata() {
return metadata;
}
/**
* @return The value of the {@code v3Metadata} attribute
*/
@JsonProperty("v3Metadata")
@Override
public @Nullable Metadata getV3Metadata() {
return v3Metadata;
}
/**
* @return The value of the {@code username} attribute
*/
@JsonProperty("username")
@Override
public @Nullable String getUsername() {
return username;
}
/**
* @return The value of the {@code password} attribute
*/
@JsonProperty("password")
@Override
public @Nullable String getPassword() {
return password;
}
/**
* @return The value of the {@code url} attribute
*/
@JsonProperty("url")
@Override
public @Nullable String getUrl() {
return url;
}
/**
* @return The value of the {@code spaceGuid} attribute
*/
@JsonProperty("spaceGuid")
@Override
public @Nullable String getSpaceGuid() {
return spaceGuid;
}
/**
* Copy the current immutable object by setting a value for the {@link CloudServiceBroker#getName() name} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for name (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudServiceBroker withName(@Nullable String value) {
if (Objects.equals(this.name, value)) return this;
return new ImmutableCloudServiceBroker(value, this.metadata, this.v3Metadata, this.username, this.password, this.url, this.spaceGuid);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudServiceBroker#getMetadata() metadata} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for metadata (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudServiceBroker withMetadata(@Nullable CloudMetadata value) {
if (this.metadata == value) return this;
return new ImmutableCloudServiceBroker(this.name, value, this.v3Metadata, this.username, this.password, this.url, this.spaceGuid);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudServiceBroker#getV3Metadata() v3Metadata} attribute.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for v3Metadata (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudServiceBroker withV3Metadata(@Nullable Metadata value) {
if (this.v3Metadata == value) return this;
return new ImmutableCloudServiceBroker(this.name, this.metadata, value, this.username, this.password, this.url, this.spaceGuid);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudServiceBroker#getUsername() username} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for username (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudServiceBroker withUsername(@Nullable String value) {
if (Objects.equals(this.username, value)) return this;
return new ImmutableCloudServiceBroker(this.name, this.metadata, this.v3Metadata, value, this.password, this.url, this.spaceGuid);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudServiceBroker#getPassword() password} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for password (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudServiceBroker withPassword(@Nullable String value) {
if (Objects.equals(this.password, value)) return this;
return new ImmutableCloudServiceBroker(this.name, this.metadata, this.v3Metadata, this.username, value, this.url, this.spaceGuid);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudServiceBroker#getUrl() url} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for url (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudServiceBroker withUrl(@Nullable String value) {
if (Objects.equals(this.url, value)) return this;
return new ImmutableCloudServiceBroker(this.name, this.metadata, this.v3Metadata, this.username, this.password, value, this.spaceGuid);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudServiceBroker#getSpaceGuid() spaceGuid} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for spaceGuid (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudServiceBroker withSpaceGuid(@Nullable String value) {
if (Objects.equals(this.spaceGuid, value)) return this;
return new ImmutableCloudServiceBroker(this.name, this.metadata, this.v3Metadata, this.username, this.password, this.url, value);
}
/**
* This instance is equal to all instances of {@code ImmutableCloudServiceBroker} 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 ImmutableCloudServiceBroker
&& equalTo((ImmutableCloudServiceBroker) another);
}
private boolean equalTo(ImmutableCloudServiceBroker another) {
return Objects.equals(name, another.name)
&& Objects.equals(metadata, another.metadata)
&& Objects.equals(v3Metadata, another.v3Metadata)
&& Objects.equals(username, another.username)
&& Objects.equals(password, another.password)
&& Objects.equals(url, another.url)
&& Objects.equals(spaceGuid, another.spaceGuid);
}
/**
* Computes a hash code from attributes: {@code name}, {@code metadata}, {@code v3Metadata}, {@code username}, {@code password}, {@code url}, {@code spaceGuid}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + Objects.hashCode(name);
h += (h << 5) + Objects.hashCode(metadata);
h += (h << 5) + Objects.hashCode(v3Metadata);
h += (h << 5) + Objects.hashCode(username);
h += (h << 5) + Objects.hashCode(password);
h += (h << 5) + Objects.hashCode(url);
h += (h << 5) + Objects.hashCode(spaceGuid);
return h;
}
/**
* Prints the immutable value {@code CloudServiceBroker} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "CloudServiceBroker{"
+ "name=" + name
+ ", metadata=" + metadata
+ ", v3Metadata=" + v3Metadata
+ ", username=" + username
+ ", password=" + password
+ ", url=" + url
+ ", spaceGuid=" + spaceGuid
+ "}";
}
/**
* 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 = "CloudServiceBroker", generator = "Immutables")
@Deprecated
@JsonDeserialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json extends CloudServiceBroker {
String name;
CloudMetadata metadata;
Metadata v3Metadata;
String username;
String password;
String url;
String spaceGuid;
@JsonProperty("name")
public void setName(@Nullable String name) {
this.name = name;
}
@JsonProperty("metadata")
public void setMetadata(@Nullable CloudMetadata metadata) {
this.metadata = metadata;
}
@JsonProperty("v3Metadata")
public void setV3Metadata(@Nullable Metadata v3Metadata) {
this.v3Metadata = v3Metadata;
}
@JsonProperty("username")
public void setUsername(@Nullable String username) {
this.username = username;
}
@JsonProperty("password")
public void setPassword(@Nullable String password) {
this.password = password;
}
@JsonProperty("url")
public void setUrl(@Nullable String url) {
this.url = url;
}
@JsonProperty("spaceGuid")
public void setSpaceGuid(@Nullable String spaceGuid) {
this.spaceGuid = spaceGuid;
}
@Override
public String getName() { throw new UnsupportedOperationException(); }
@Override
public CloudMetadata getMetadata() { throw new UnsupportedOperationException(); }
@Override
public Metadata getV3Metadata() { throw new UnsupportedOperationException(); }
@Override
public String getUsername() { throw new UnsupportedOperationException(); }
@Override
public String getPassword() { throw new UnsupportedOperationException(); }
@Override
public String getUrl() { throw new UnsupportedOperationException(); }
@Override
public String getSpaceGuid() { 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 ImmutableCloudServiceBroker fromJson(Json json) {
ImmutableCloudServiceBroker.Builder builder = ImmutableCloudServiceBroker.builder();
if (json.name != null) {
builder.name(json.name);
}
if (json.metadata != null) {
builder.metadata(json.metadata);
}
if (json.v3Metadata != null) {
builder.v3Metadata(json.v3Metadata);
}
if (json.username != null) {
builder.username(json.username);
}
if (json.password != null) {
builder.password(json.password);
}
if (json.url != null) {
builder.url(json.url);
}
if (json.spaceGuid != null) {
builder.spaceGuid(json.spaceGuid);
}
return builder.build();
}
/**
* Creates an immutable copy of a {@link CloudServiceBroker} value.
* Uses accessors to get values to initialize the new immutable instance.
* If an instance is already immutable, it is returned as is.
* @param instance The instance to copy
* @return A copied immutable CloudServiceBroker instance
*/
public static ImmutableCloudServiceBroker copyOf(CloudServiceBroker instance) {
if (instance instanceof ImmutableCloudServiceBroker) {
return (ImmutableCloudServiceBroker) instance;
}
return ImmutableCloudServiceBroker.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableCloudServiceBroker ImmutableCloudServiceBroker}.
*
* ImmutableCloudServiceBroker.builder()
* .name(String | null) // nullable {@link CloudServiceBroker#getName() name}
* .metadata(org.cloudfoundry.client.lib.domain.CloudMetadata | null) // nullable {@link CloudServiceBroker#getMetadata() metadata}
* .v3Metadata(org.cloudfoundry.client.v3.Metadata | null) // nullable {@link CloudServiceBroker#getV3Metadata() v3Metadata}
* .username(String | null) // nullable {@link CloudServiceBroker#getUsername() username}
* .password(String | null) // nullable {@link CloudServiceBroker#getPassword() password}
* .url(String | null) // nullable {@link CloudServiceBroker#getUrl() url}
* .spaceGuid(String | null) // nullable {@link CloudServiceBroker#getSpaceGuid() spaceGuid}
* .build();
*
* @return A new ImmutableCloudServiceBroker builder
*/
public static ImmutableCloudServiceBroker.Builder builder() {
return new ImmutableCloudServiceBroker.Builder();
}
/**
* Builds instances of type {@link ImmutableCloudServiceBroker ImmutableCloudServiceBroker}.
* 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 = "CloudServiceBroker", generator = "Immutables")
public static final class Builder {
private String name;
private CloudMetadata metadata;
private Metadata v3Metadata;
private String username;
private String password;
private String url;
private String spaceGuid;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code org.cloudfoundry.client.lib.domain.CloudEntity} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(CloudEntity instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code org.cloudfoundry.client.lib.domain.CloudServiceBroker} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(CloudServiceBroker instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return this;
}
private void from(Object object) {
if (object instanceof CloudEntity) {
CloudEntity instance = (CloudEntity) object;
@Nullable String nameValue = instance.getName();
if (nameValue != null) {
name(nameValue);
}
@Nullable Metadata v3MetadataValue = instance.getV3Metadata();
if (v3MetadataValue != null) {
v3Metadata(v3MetadataValue);
}
@Nullable CloudMetadata metadataValue = instance.getMetadata();
if (metadataValue != null) {
metadata(metadataValue);
}
}
if (object instanceof CloudServiceBroker) {
CloudServiceBroker instance = (CloudServiceBroker) object;
@Nullable String spaceGuidValue = instance.getSpaceGuid();
if (spaceGuidValue != null) {
spaceGuid(spaceGuidValue);
}
@Nullable String passwordValue = instance.getPassword();
if (passwordValue != null) {
password(passwordValue);
}
@Nullable String urlValue = instance.getUrl();
if (urlValue != null) {
url(urlValue);
}
@Nullable String usernameValue = instance.getUsername();
if (usernameValue != null) {
username(usernameValue);
}
}
}
/**
* Initializes the value for the {@link CloudServiceBroker#getName() name} attribute.
* @param name The value for name (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("name")
public final Builder name(@Nullable String name) {
this.name = name;
return this;
}
/**
* Initializes the value for the {@link CloudServiceBroker#getMetadata() metadata} attribute.
* @param metadata The value for metadata (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("metadata")
public final Builder metadata(@Nullable CloudMetadata metadata) {
this.metadata = metadata;
return this;
}
/**
* Initializes the value for the {@link CloudServiceBroker#getV3Metadata() v3Metadata} attribute.
* @param v3Metadata The value for v3Metadata (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("v3Metadata")
public final Builder v3Metadata(@Nullable Metadata v3Metadata) {
this.v3Metadata = v3Metadata;
return this;
}
/**
* Initializes the value for the {@link CloudServiceBroker#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;
}
/**
* Initializes the value for the {@link CloudServiceBroker#getPassword() password} attribute.
* @param password The value for password (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("password")
public final Builder password(@Nullable String password) {
this.password = password;
return this;
}
/**
* Initializes the value for the {@link CloudServiceBroker#getUrl() url} attribute.
* @param url The value for url (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("url")
public final Builder url(@Nullable String url) {
this.url = url;
return this;
}
/**
* Initializes the value for the {@link CloudServiceBroker#getSpaceGuid() spaceGuid} attribute.
* @param spaceGuid The value for spaceGuid (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("spaceGuid")
public final Builder spaceGuid(@Nullable String spaceGuid) {
this.spaceGuid = spaceGuid;
return this;
}
/**
* Builds a new {@link ImmutableCloudServiceBroker ImmutableCloudServiceBroker}.
* @return An immutable instance of CloudServiceBroker
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableCloudServiceBroker build() {
return new ImmutableCloudServiceBroker(name, metadata, v3Metadata, username, password, url, spaceGuid);
}
}
}