org.cloudfoundry.client.v3.processes.Data Maven / Gradle / Ivy
package org.cloudfoundry.client.v3.processes;
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.Nullable;
import org.immutables.value.Generated;
/**
* Immutable implementation of {@link _Data}.
*
* Use the builder to create immutable instances:
* {@code Data.builder()}.
*/
@Generated(from = "_Data", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class Data extends org.cloudfoundry.client.v3.processes._Data {
private final @Nullable String endpoint;
private final @Nullable Integer invocationTimeout;
private final @Nullable Integer timeout;
private Data(Data.Builder builder) {
this.endpoint = builder.endpoint;
this.invocationTimeout = builder.invocationTimeout;
this.timeout = builder.timeout;
}
/**
* The endpoint
*/
@JsonProperty("endpoint")
@Override
public @Nullable String getEndpoint() {
return endpoint;
}
/**
* The invocation timeout
*/
@JsonProperty("invocation_timeout")
@Override
public @Nullable Integer getInvocationTimeout() {
return invocationTimeout;
}
/**
* The timeout
*/
@JsonProperty("timeout")
@Override
public @Nullable Integer getTimeout() {
return timeout;
}
/**
* This instance is equal to all instances of {@code Data} 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 Data
&& equalTo(0, (Data) another);
}
private boolean equalTo(int synthetic, Data another) {
return Objects.equals(endpoint, another.endpoint)
&& Objects.equals(invocationTimeout, another.invocationTimeout)
&& Objects.equals(timeout, another.timeout);
}
/**
* Computes a hash code from attributes: {@code endpoint}, {@code invocationTimeout}, {@code timeout}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + Objects.hashCode(endpoint);
h += (h << 5) + Objects.hashCode(invocationTimeout);
h += (h << 5) + Objects.hashCode(timeout);
return h;
}
/**
* Prints the immutable value {@code Data} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "Data{"
+ "endpoint=" + endpoint
+ ", invocationTimeout=" + invocationTimeout
+ ", timeout=" + timeout
+ "}";
}
/**
* 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 = "_Data", generator = "Immutables")
@Deprecated
@JsonDeserialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json extends org.cloudfoundry.client.v3.processes._Data {
String endpoint;
Integer invocationTimeout;
Integer timeout;
@JsonProperty("endpoint")
public void setEndpoint(@Nullable String endpoint) {
this.endpoint = endpoint;
}
@JsonProperty("invocation_timeout")
public void setInvocationTimeout(@Nullable Integer invocationTimeout) {
this.invocationTimeout = invocationTimeout;
}
@JsonProperty("timeout")
public void setTimeout(@Nullable Integer timeout) {
this.timeout = timeout;
}
@Override
public String getEndpoint() { throw new UnsupportedOperationException(); }
@Override
public Integer getInvocationTimeout() { throw new UnsupportedOperationException(); }
@Override
public Integer getTimeout() { 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 Data fromJson(Json json) {
Data.Builder builder = Data.builder();
if (json.endpoint != null) {
builder.endpoint(json.endpoint);
}
if (json.invocationTimeout != null) {
builder.invocationTimeout(json.invocationTimeout);
}
if (json.timeout != null) {
builder.timeout(json.timeout);
}
return builder.build();
}
/**
* Creates a builder for {@link Data Data}.
*
* Data.builder()
* .endpoint(String | null) // nullable {@link Data#getEndpoint() endpoint}
* .invocationTimeout(Integer | null) // nullable {@link Data#getInvocationTimeout() invocationTimeout}
* .timeout(Integer | null) // nullable {@link Data#getTimeout() timeout}
* .build();
*
* @return A new Data builder
*/
public static Data.Builder builder() {
return new Data.Builder();
}
/**
* Builds instances of type {@link Data Data}.
* 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 = "_Data", generator = "Immutables")
public static final class Builder {
private String endpoint;
private Integer invocationTimeout;
private Integer timeout;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code Data} 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(Data instance) {
return from((_Data) instance);
}
/**
* Copy abstract value type {@code _Data} instance into builder.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
final Builder from(_Data instance) {
Objects.requireNonNull(instance, "instance");
String endpointValue = instance.getEndpoint();
if (endpointValue != null) {
endpoint(endpointValue);
}
Integer invocationTimeoutValue = instance.getInvocationTimeout();
if (invocationTimeoutValue != null) {
invocationTimeout(invocationTimeoutValue);
}
Integer timeoutValue = instance.getTimeout();
if (timeoutValue != null) {
timeout(timeoutValue);
}
return this;
}
/**
* Initializes the value for the {@link Data#getEndpoint() endpoint} attribute.
* @param endpoint The value for endpoint (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("endpoint")
public final Builder endpoint(@Nullable String endpoint) {
this.endpoint = endpoint;
return this;
}
/**
* Initializes the value for the {@link Data#getInvocationTimeout() invocationTimeout} attribute.
* @param invocationTimeout The value for invocationTimeout (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("invocation_timeout")
public final Builder invocationTimeout(@Nullable Integer invocationTimeout) {
this.invocationTimeout = invocationTimeout;
return this;
}
/**
* Initializes the value for the {@link Data#getTimeout() timeout} attribute.
* @param timeout The value for timeout (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("timeout")
public final Builder timeout(@Nullable Integer timeout) {
this.timeout = timeout;
return this;
}
/**
* Builds a new {@link Data Data}.
* @return An immutable instance of Data
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public Data build() {
return new Data(this);
}
}
}