
org.cloudfoundry.client.v3.serviceinstances.CreateServiceInstanceResponse Maven / Gradle / Ivy
package org.cloudfoundry.client.v3.serviceinstances;
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 java.util.Optional;
import org.immutables.value.Generated;
/**
* The response payload for the Update Service operation
*/
@Generated(from = "_CreateServiceInstanceResponse", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class CreateServiceInstanceResponse
extends org.cloudfoundry.client.v3.serviceinstances._CreateServiceInstanceResponse {
private final String jobId;
private final ServiceInstanceResource serviceInstance;
private CreateServiceInstanceResponse(CreateServiceInstanceResponse.Builder builder) {
this.jobId = builder.jobId;
this.serviceInstance = builder.serviceInstance;
}
/**
* @return The value of the {@code jobId} attribute
*/
@JsonProperty("jobId")
@Override
public Optional getJobId() {
return Optional.ofNullable(jobId);
}
/**
* @return The value of the {@code serviceInstance} attribute
*/
@JsonProperty("serviceInstance")
@Override
public Optional getServiceInstance() {
return Optional.ofNullable(serviceInstance);
}
/**
* This instance is equal to all instances of {@code CreateServiceInstanceResponse} 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 CreateServiceInstanceResponse
&& equalTo(0, (CreateServiceInstanceResponse) another);
}
private boolean equalTo(int synthetic, CreateServiceInstanceResponse another) {
return Objects.equals(jobId, another.jobId)
&& Objects.equals(serviceInstance, another.serviceInstance);
}
/**
* Computes a hash code from attributes: {@code jobId}, {@code serviceInstance}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + Objects.hashCode(jobId);
h += (h << 5) + Objects.hashCode(serviceInstance);
return h;
}
/**
* Prints the immutable value {@code CreateServiceInstanceResponse} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder("CreateServiceInstanceResponse{");
if (jobId != null) {
builder.append("jobId=").append(jobId);
}
if (serviceInstance != null) {
if (builder.length() > 30) builder.append(", ");
builder.append("serviceInstance=").append(serviceInstance);
}
return builder.append("}").toString();
}
/**
* 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 = "_CreateServiceInstanceResponse", generator = "Immutables")
@Deprecated
@JsonDeserialize
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json extends org.cloudfoundry.client.v3.serviceinstances._CreateServiceInstanceResponse {
Optional jobId = Optional.empty();
Optional serviceInstance = Optional.empty();
@JsonProperty("jobId")
public void setJobId(Optional jobId) {
this.jobId = jobId;
}
@JsonProperty("serviceInstance")
public void setServiceInstance(Optional serviceInstance) {
this.serviceInstance = serviceInstance;
}
@Override
public Optional getJobId() { throw new UnsupportedOperationException(); }
@Override
public Optional getServiceInstance() { 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 CreateServiceInstanceResponse fromJson(Json json) {
CreateServiceInstanceResponse.Builder builder = CreateServiceInstanceResponse.builder();
if (json.jobId != null) {
builder.jobId(json.jobId);
}
if (json.serviceInstance != null) {
builder.serviceInstance(json.serviceInstance);
}
return builder.build();
}
/**
* Creates a builder for {@link CreateServiceInstanceResponse CreateServiceInstanceResponse}.
*
* CreateServiceInstanceResponse.builder()
* .jobId(String) // optional {@link CreateServiceInstanceResponse#getJobId() jobId}
* .serviceInstance(ServiceInstanceResource) // optional {@link CreateServiceInstanceResponse#getServiceInstance() serviceInstance}
* .build();
*
* @return A new CreateServiceInstanceResponse builder
*/
public static CreateServiceInstanceResponse.Builder builder() {
return new CreateServiceInstanceResponse.Builder();
}
/**
* Builds instances of type {@link CreateServiceInstanceResponse CreateServiceInstanceResponse}.
* 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 = "_CreateServiceInstanceResponse", generator = "Immutables")
public static final class Builder {
private String jobId;
private ServiceInstanceResource serviceInstance;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code CreateServiceInstanceResponse} 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(CreateServiceInstanceResponse instance) {
return from((_CreateServiceInstanceResponse) instance);
}
/**
* Copy abstract value type {@code _CreateServiceInstanceResponse} 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(_CreateServiceInstanceResponse instance) {
Objects.requireNonNull(instance, "instance");
Optional jobIdOptional = instance.getJobId();
if (jobIdOptional.isPresent()) {
jobId(jobIdOptional);
}
Optional serviceInstanceOptional = instance.getServiceInstance();
if (serviceInstanceOptional.isPresent()) {
serviceInstance(serviceInstanceOptional);
}
return this;
}
/**
* Initializes the optional value {@link CreateServiceInstanceResponse#getJobId() jobId} to jobId.
* @param jobId The value for jobId
* @return {@code this} builder for chained invocation
*/
public final Builder jobId(String jobId) {
this.jobId = Objects.requireNonNull(jobId, "jobId");
return this;
}
/**
* Initializes the optional value {@link CreateServiceInstanceResponse#getJobId() jobId} to jobId.
* @param jobId The value for jobId
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("jobId")
public final Builder jobId(Optional jobId) {
this.jobId = jobId.orElse(null);
return this;
}
/**
* Initializes the optional value {@link CreateServiceInstanceResponse#getServiceInstance() serviceInstance} to serviceInstance.
* @param serviceInstance The value for serviceInstance
* @return {@code this} builder for chained invocation
*/
public final Builder serviceInstance(ServiceInstanceResource serviceInstance) {
this.serviceInstance = Objects.requireNonNull(serviceInstance, "serviceInstance");
return this;
}
/**
* Initializes the optional value {@link CreateServiceInstanceResponse#getServiceInstance() serviceInstance} to serviceInstance.
* @param serviceInstance The value for serviceInstance
* @return {@code this} builder for use in a chained invocation
*/
@JsonProperty("serviceInstance")
public final Builder serviceInstance(Optional extends ServiceInstanceResource> serviceInstance) {
this.serviceInstance = serviceInstance.orElse(null);
return this;
}
/**
* Builds a new {@link CreateServiceInstanceResponse CreateServiceInstanceResponse}.
* @return An immutable instance of CreateServiceInstanceResponse
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public CreateServiceInstanceResponse build() {
return new CreateServiceInstanceResponse(this);
}
}
}