org.cloudfoundry.client.lib.domain.ImmutableCloudInfo 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.immutables.value.Generated;
/**
* Immutable implementation of {@link CloudInfo}.
*
* Use the builder to create immutable instances:
* {@code ImmutableCloudInfo.builder()}.
*/
@Generated(from = "CloudInfo", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
public final class ImmutableCloudInfo implements CloudInfo {
private final @Nullable String authorizationEndpoint;
private final @Nullable String loggingEndpoint;
private final @Nullable String build;
private final @Nullable String description;
private final @Nullable String name;
private final @Nullable String user;
private final @Nullable String support;
private final @Nullable String version;
private ImmutableCloudInfo(
@Nullable String authorizationEndpoint,
@Nullable String loggingEndpoint,
@Nullable String build,
@Nullable String description,
@Nullable String name,
@Nullable String user,
@Nullable String support,
@Nullable String version) {
this.authorizationEndpoint = authorizationEndpoint;
this.loggingEndpoint = loggingEndpoint;
this.build = build;
this.description = description;
this.name = name;
this.user = user;
this.support = support;
this.version = version;
}
/**
* @return The value of the {@code authorizationEndpoint} attribute
*/
@JsonProperty("authorizationEndpoint")
@Override
public @Nullable String getAuthorizationEndpoint() {
return authorizationEndpoint;
}
/**
* @return The value of the {@code loggingEndpoint} attribute
*/
@JsonProperty("loggingEndpoint")
@Override
public @Nullable String getLoggingEndpoint() {
return loggingEndpoint;
}
/**
* @return The value of the {@code build} attribute
*/
@JsonProperty("build")
@Override
public @Nullable String getBuild() {
return build;
}
/**
* @return The value of the {@code description} attribute
*/
@JsonProperty("description")
@Override
public @Nullable String getDescription() {
return description;
}
/**
* @return The value of the {@code name} attribute
*/
@JsonProperty("name")
@Override
public @Nullable String getName() {
return name;
}
/**
* @return The value of the {@code user} attribute
*/
@JsonProperty("user")
@Override
public @Nullable String getUser() {
return user;
}
/**
* @return The value of the {@code support} attribute
*/
@JsonProperty("support")
@Override
public @Nullable String getSupport() {
return support;
}
/**
* @return The value of the {@code version} attribute
*/
@JsonProperty("version")
@Override
public @Nullable String getVersion() {
return version;
}
/**
* Copy the current immutable object by setting a value for the {@link CloudInfo#getAuthorizationEndpoint() authorizationEndpoint} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for authorizationEndpoint (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudInfo withAuthorizationEndpoint(@Nullable String value) {
if (Objects.equals(this.authorizationEndpoint, value)) return this;
return new ImmutableCloudInfo(
value,
this.loggingEndpoint,
this.build,
this.description,
this.name,
this.user,
this.support,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudInfo#getLoggingEndpoint() loggingEndpoint} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for loggingEndpoint (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudInfo withLoggingEndpoint(@Nullable String value) {
if (Objects.equals(this.loggingEndpoint, value)) return this;
return new ImmutableCloudInfo(
this.authorizationEndpoint,
value,
this.build,
this.description,
this.name,
this.user,
this.support,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudInfo#getBuild() build} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for build (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudInfo withBuild(@Nullable String value) {
if (Objects.equals(this.build, value)) return this;
return new ImmutableCloudInfo(
this.authorizationEndpoint,
this.loggingEndpoint,
value,
this.description,
this.name,
this.user,
this.support,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudInfo#getDescription() description} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for description (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudInfo withDescription(@Nullable String value) {
if (Objects.equals(this.description, value)) return this;
return new ImmutableCloudInfo(
this.authorizationEndpoint,
this.loggingEndpoint,
this.build,
value,
this.name,
this.user,
this.support,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudInfo#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 ImmutableCloudInfo withName(@Nullable String value) {
if (Objects.equals(this.name, value)) return this;
return new ImmutableCloudInfo(
this.authorizationEndpoint,
this.loggingEndpoint,
this.build,
this.description,
value,
this.user,
this.support,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudInfo#getUser() user} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for user (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudInfo withUser(@Nullable String value) {
if (Objects.equals(this.user, value)) return this;
return new ImmutableCloudInfo(
this.authorizationEndpoint,
this.loggingEndpoint,
this.build,
this.description,
this.name,
value,
this.support,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudInfo#getSupport() support} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for support (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudInfo withSupport(@Nullable String value) {
if (Objects.equals(this.support, value)) return this;
return new ImmutableCloudInfo(
this.authorizationEndpoint,
this.loggingEndpoint,
this.build,
this.description,
this.name,
this.user,
value,
this.version);
}
/**
* Copy the current immutable object by setting a value for the {@link CloudInfo#getVersion() version} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for version (can be {@code null})
* @return A modified copy of the {@code this} object
*/
public final ImmutableCloudInfo withVersion(@Nullable String value) {
if (Objects.equals(this.version, value)) return this;
return new ImmutableCloudInfo(
this.authorizationEndpoint,
this.loggingEndpoint,
this.build,
this.description,
this.name,
this.user,
this.support,
value);
}
/**
* This instance is equal to all instances of {@code ImmutableCloudInfo} 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 ImmutableCloudInfo
&& equalTo((ImmutableCloudInfo) another);
}
private boolean equalTo(ImmutableCloudInfo another) {
return Objects.equals(authorizationEndpoint, another.authorizationEndpoint)
&& Objects.equals(loggingEndpoint, another.loggingEndpoint)
&& Objects.equals(build, another.build)
&& Objects.equals(description, another.description)
&& Objects.equals(name, another.name)
&& Objects.equals(user, another.user)
&& Objects.equals(support, another.support)
&& Objects.equals(version, another.version);
}
/**
* Computes a hash code from attributes: {@code authorizationEndpoint}, {@code loggingEndpoint}, {@code build}, {@code description}, {@code name}, {@code user}, {@code support}, {@code version}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + Objects.hashCode(authorizationEndpoint);
h += (h << 5) + Objects.hashCode(loggingEndpoint);
h += (h << 5) + Objects.hashCode(build);
h += (h << 5) + Objects.hashCode(description);
h += (h << 5) + Objects.hashCode(name);
h += (h << 5) + Objects.hashCode(user);
h += (h << 5) + Objects.hashCode(support);
h += (h << 5) + Objects.hashCode(version);
return h;
}
/**
* Prints the immutable value {@code CloudInfo} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "CloudInfo{"
+ "authorizationEndpoint=" + authorizationEndpoint
+ ", loggingEndpoint=" + loggingEndpoint
+ ", build=" + build
+ ", description=" + description
+ ", name=" + name
+ ", user=" + user
+ ", support=" + support
+ ", version=" + version
+ "}";
}
/**
* 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 = "CloudInfo", generator = "Immutables")
@Deprecated
@JsonDeserialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json implements CloudInfo {
String authorizationEndpoint;
String loggingEndpoint;
String build;
String description;
String name;
String user;
String support;
String version;
@JsonProperty("authorizationEndpoint")
public void setAuthorizationEndpoint(@Nullable String authorizationEndpoint) {
this.authorizationEndpoint = authorizationEndpoint;
}
@JsonProperty("loggingEndpoint")
public void setLoggingEndpoint(@Nullable String loggingEndpoint) {
this.loggingEndpoint = loggingEndpoint;
}
@JsonProperty("build")
public void setBuild(@Nullable String build) {
this.build = build;
}
@JsonProperty("description")
public void setDescription(@Nullable String description) {
this.description = description;
}
@JsonProperty("name")
public void setName(@Nullable String name) {
this.name = name;
}
@JsonProperty("user")
public void setUser(@Nullable String user) {
this.user = user;
}
@JsonProperty("support")
public void setSupport(@Nullable String support) {
this.support = support;
}
@JsonProperty("version")
public void setVersion(@Nullable String version) {
this.version = version;
}
@Override
public String getAuthorizationEndpoint() { throw new UnsupportedOperationException(); }
@Override
public String getLoggingEndpoint() { throw new UnsupportedOperationException(); }
@Override
public String getBuild() { throw new UnsupportedOperationException(); }
@Override
public String getDescription() { throw new UnsupportedOperationException(); }
@Override
public String getName() { throw new UnsupportedOperationException(); }
@Override
public String getUser() { throw new UnsupportedOperationException(); }
@Override
public String getSupport() { throw new UnsupportedOperationException(); }
@Override
public String getVersion() { 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 ImmutableCloudInfo fromJson(Json json) {
ImmutableCloudInfo.Builder builder = ImmutableCloudInfo.builder();
if (json.authorizationEndpoint != null) {
builder.authorizationEndpoint(json.authorizationEndpoint);
}
if (json.loggingEndpoint != null) {
builder.loggingEndpoint(json.loggingEndpoint);
}
if (json.build != null) {
builder.build(json.build);
}
if (json.description != null) {
builder.description(json.description);
}
if (json.name != null) {
builder.name(json.name);
}
if (json.user != null) {
builder.user(json.user);
}
if (json.support != null) {
builder.support(json.support);
}
if (json.version != null) {
builder.version(json.version);
}
return builder.build();
}
/**
* Creates an immutable copy of a {@link CloudInfo} 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 CloudInfo instance
*/
public static ImmutableCloudInfo copyOf(CloudInfo instance) {
if (instance instanceof ImmutableCloudInfo) {
return (ImmutableCloudInfo) instance;
}
return ImmutableCloudInfo.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableCloudInfo ImmutableCloudInfo}.
*
* ImmutableCloudInfo.builder()
* .authorizationEndpoint(String | null) // nullable {@link CloudInfo#getAuthorizationEndpoint() authorizationEndpoint}
* .loggingEndpoint(String | null) // nullable {@link CloudInfo#getLoggingEndpoint() loggingEndpoint}
* .build(String | null) // nullable {@link CloudInfo#getBuild() build}
* .description(String | null) // nullable {@link CloudInfo#getDescription() description}
* .name(String | null) // nullable {@link CloudInfo#getName() name}
* .user(String | null) // nullable {@link CloudInfo#getUser() user}
* .support(String | null) // nullable {@link CloudInfo#getSupport() support}
* .version(String | null) // nullable {@link CloudInfo#getVersion() version}
* .build();
*
* @return A new ImmutableCloudInfo builder
*/
public static ImmutableCloudInfo.Builder builder() {
return new ImmutableCloudInfo.Builder();
}
/**
* Builds instances of type {@link ImmutableCloudInfo ImmutableCloudInfo}.
* 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 = "CloudInfo", generator = "Immutables")
public static final class Builder {
private String authorizationEndpoint;
private String loggingEndpoint;
private String build;
private String description;
private String name;
private String user;
private String support;
private String version;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code CloudInfo} instance.
* Regular attribute values will be replaced with those from the given instance.
* Absent optional values will not replace present values.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(CloudInfo instance) {
Objects.requireNonNull(instance, "instance");
@Nullable String authorizationEndpointValue = instance.getAuthorizationEndpoint();
if (authorizationEndpointValue != null) {
authorizationEndpoint(authorizationEndpointValue);
}
@Nullable String loggingEndpointValue = instance.getLoggingEndpoint();
if (loggingEndpointValue != null) {
loggingEndpoint(loggingEndpointValue);
}
@Nullable String buildValue = instance.getBuild();
if (buildValue != null) {
build(buildValue);
}
@Nullable String descriptionValue = instance.getDescription();
if (descriptionValue != null) {
description(descriptionValue);
}
@Nullable String nameValue = instance.getName();
if (nameValue != null) {
name(nameValue);
}
@Nullable String userValue = instance.getUser();
if (userValue != null) {
user(userValue);
}
@Nullable String supportValue = instance.getSupport();
if (supportValue != null) {
support(supportValue);
}
@Nullable String versionValue = instance.getVersion();
if (versionValue != null) {
version(versionValue);
}
return this;
}
/**
* Initializes the value for the {@link CloudInfo#getAuthorizationEndpoint() authorizationEndpoint} attribute.
* @param authorizationEndpoint The value for authorizationEndpoint (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("authorizationEndpoint")
public final Builder authorizationEndpoint(@Nullable String authorizationEndpoint) {
this.authorizationEndpoint = authorizationEndpoint;
return this;
}
/**
* Initializes the value for the {@link CloudInfo#getLoggingEndpoint() loggingEndpoint} attribute.
* @param loggingEndpoint The value for loggingEndpoint (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("loggingEndpoint")
public final Builder loggingEndpoint(@Nullable String loggingEndpoint) {
this.loggingEndpoint = loggingEndpoint;
return this;
}
/**
* Initializes the value for the {@link CloudInfo#getBuild() build} attribute.
* @param build The value for build (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("build")
public final Builder build(@Nullable String build) {
this.build = build;
return this;
}
/**
* Initializes the value for the {@link CloudInfo#getDescription() description} attribute.
* @param description The value for description (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("description")
public final Builder description(@Nullable String description) {
this.description = description;
return this;
}
/**
* Initializes the value for the {@link CloudInfo#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 CloudInfo#getUser() user} attribute.
* @param user The value for user (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("user")
public final Builder user(@Nullable String user) {
this.user = user;
return this;
}
/**
* Initializes the value for the {@link CloudInfo#getSupport() support} attribute.
* @param support The value for support (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("support")
public final Builder support(@Nullable String support) {
this.support = support;
return this;
}
/**
* Initializes the value for the {@link CloudInfo#getVersion() version} attribute.
* @param version The value for version (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("version")
public final Builder version(@Nullable String version) {
this.version = version;
return this;
}
/**
* Builds a new {@link ImmutableCloudInfo ImmutableCloudInfo}.
* @return An immutable instance of CloudInfo
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableCloudInfo build() {
return new ImmutableCloudInfo(authorizationEndpoint, loggingEndpoint, build, description, name, user, support, version);
}
}
}