org.cloudfoundry.client.v3.buildpacks.UpdateBuildpackRequest Maven / Gradle / Ivy
package org.cloudfoundry.client.v3.buildpacks;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.cloudfoundry.Nullable;
import org.cloudfoundry.client.v3.Metadata;
import org.immutables.value.Generated;
/**
* The request payload to Update a Buildpack
*/
@Generated(from = "_UpdateBuildpackRequest", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class UpdateBuildpackRequest
extends org.cloudfoundry.client.v3.buildpacks._UpdateBuildpackRequest {
private final String buildpackId;
private final @Nullable Boolean enabled;
private final @Nullable Boolean locked;
private final @Nullable Metadata metadata;
private final @Nullable String name;
private final @Nullable Integer position;
private final @Nullable String stack;
private UpdateBuildpackRequest(UpdateBuildpackRequest.Builder builder) {
this.buildpackId = builder.buildpackId;
this.enabled = builder.enabled;
this.locked = builder.locked;
this.metadata = builder.metadata;
this.name = builder.name;
this.position = builder.position;
this.stack = builder.stack;
}
/**
* The buildpack id
*/
@JsonProperty("buildpackId")
@JsonIgnore
@Override
public String getBuildpackId() {
return buildpackId;
}
/**
* Whether the buildpack is enabled
*/
@JsonProperty("enabled")
@Override
public @Nullable Boolean getEnabled() {
return enabled;
}
/**
* Whether the buildpack is locked
*/
@JsonProperty("locked")
@Override
public @Nullable Boolean getLocked() {
return locked;
}
/**
* The metadata
*/
@JsonProperty("metadata")
@Override
public @Nullable Metadata getMetadata() {
return metadata;
}
/**
* The name
*/
@JsonProperty("name")
@Override
public @Nullable String getName() {
return name;
}
/**
* The position
*/
@JsonProperty("position")
@Override
public @Nullable Integer getPosition() {
return position;
}
/**
* The stack
*/
@JsonProperty("stack")
@Override
public @Nullable String getStack() {
return stack;
}
/**
* This instance is equal to all instances of {@code UpdateBuildpackRequest} 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 UpdateBuildpackRequest
&& equalTo(0, (UpdateBuildpackRequest) another);
}
private boolean equalTo(int synthetic, UpdateBuildpackRequest another) {
return buildpackId.equals(another.buildpackId)
&& Objects.equals(enabled, another.enabled)
&& Objects.equals(locked, another.locked)
&& Objects.equals(metadata, another.metadata)
&& Objects.equals(name, another.name)
&& Objects.equals(position, another.position)
&& Objects.equals(stack, another.stack);
}
/**
* Computes a hash code from attributes: {@code buildpackId}, {@code enabled}, {@code locked}, {@code metadata}, {@code name}, {@code position}, {@code stack}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + buildpackId.hashCode();
h += (h << 5) + Objects.hashCode(enabled);
h += (h << 5) + Objects.hashCode(locked);
h += (h << 5) + Objects.hashCode(metadata);
h += (h << 5) + Objects.hashCode(name);
h += (h << 5) + Objects.hashCode(position);
h += (h << 5) + Objects.hashCode(stack);
return h;
}
/**
* Prints the immutable value {@code UpdateBuildpackRequest} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "UpdateBuildpackRequest{"
+ "buildpackId=" + buildpackId
+ ", enabled=" + enabled
+ ", locked=" + locked
+ ", metadata=" + metadata
+ ", name=" + name
+ ", position=" + position
+ ", stack=" + stack
+ "}";
}
/**
* 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 = "_UpdateBuildpackRequest", generator = "Immutables")
@Deprecated
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json extends org.cloudfoundry.client.v3.buildpacks._UpdateBuildpackRequest {
String buildpackId;
Boolean enabled;
Boolean locked;
Metadata metadata;
String name;
Integer position;
String stack;
@JsonProperty("buildpackId")
@JsonIgnore
public void setBuildpackId(String buildpackId) {
this.buildpackId = buildpackId;
}
@JsonProperty("enabled")
public void setEnabled(@Nullable Boolean enabled) {
this.enabled = enabled;
}
@JsonProperty("locked")
public void setLocked(@Nullable Boolean locked) {
this.locked = locked;
}
@JsonProperty("metadata")
public void setMetadata(@Nullable Metadata metadata) {
this.metadata = metadata;
}
@JsonProperty("name")
public void setName(@Nullable String name) {
this.name = name;
}
@JsonProperty("position")
public void setPosition(@Nullable Integer position) {
this.position = position;
}
@JsonProperty("stack")
public void setStack(@Nullable String stack) {
this.stack = stack;
}
@Override
public String getBuildpackId() { throw new UnsupportedOperationException(); }
@Override
public Boolean getEnabled() { throw new UnsupportedOperationException(); }
@Override
public Boolean getLocked() { throw new UnsupportedOperationException(); }
@Override
public Metadata getMetadata() { throw new UnsupportedOperationException(); }
@Override
public String getName() { throw new UnsupportedOperationException(); }
@Override
public Integer getPosition() { throw new UnsupportedOperationException(); }
@Override
public String getStack() { 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 UpdateBuildpackRequest fromJson(Json json) {
UpdateBuildpackRequest.Builder builder = UpdateBuildpackRequest.builder();
if (json.buildpackId != null) {
builder.buildpackId(json.buildpackId);
}
if (json.enabled != null) {
builder.enabled(json.enabled);
}
if (json.locked != null) {
builder.locked(json.locked);
}
if (json.metadata != null) {
builder.metadata(json.metadata);
}
if (json.name != null) {
builder.name(json.name);
}
if (json.position != null) {
builder.position(json.position);
}
if (json.stack != null) {
builder.stack(json.stack);
}
return builder.build();
}
/**
* Creates a builder for {@link UpdateBuildpackRequest UpdateBuildpackRequest}.
*
* UpdateBuildpackRequest.builder()
* .buildpackId(String) // required {@link UpdateBuildpackRequest#getBuildpackId() buildpackId}
* .enabled(Boolean | null) // nullable {@link UpdateBuildpackRequest#getEnabled() enabled}
* .locked(Boolean | null) // nullable {@link UpdateBuildpackRequest#getLocked() locked}
* .metadata(org.cloudfoundry.client.v3.Metadata | null) // nullable {@link UpdateBuildpackRequest#getMetadata() metadata}
* .name(String | null) // nullable {@link UpdateBuildpackRequest#getName() name}
* .position(Integer | null) // nullable {@link UpdateBuildpackRequest#getPosition() position}
* .stack(String | null) // nullable {@link UpdateBuildpackRequest#getStack() stack}
* .build();
*
* @return A new UpdateBuildpackRequest builder
*/
public static UpdateBuildpackRequest.Builder builder() {
return new UpdateBuildpackRequest.Builder();
}
/**
* Builds instances of type {@link UpdateBuildpackRequest UpdateBuildpackRequest}.
* 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 = "_UpdateBuildpackRequest", generator = "Immutables")
public static final class Builder {
private static final long INIT_BIT_BUILDPACK_ID = 0x1L;
private long initBits = 0x1L;
private String buildpackId;
private Boolean enabled;
private Boolean locked;
private Metadata metadata;
private String name;
private Integer position;
private String stack;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code UpdateBuildpackRequest} 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(UpdateBuildpackRequest instance) {
return from((_UpdateBuildpackRequest) instance);
}
/**
* Copy abstract value type {@code _UpdateBuildpackRequest} 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(_UpdateBuildpackRequest instance) {
Objects.requireNonNull(instance, "instance");
buildpackId(instance.getBuildpackId());
Boolean enabledValue = instance.getEnabled();
if (enabledValue != null) {
enabled(enabledValue);
}
Boolean lockedValue = instance.getLocked();
if (lockedValue != null) {
locked(lockedValue);
}
Metadata metadataValue = instance.getMetadata();
if (metadataValue != null) {
metadata(metadataValue);
}
String nameValue = instance.getName();
if (nameValue != null) {
name(nameValue);
}
Integer positionValue = instance.getPosition();
if (positionValue != null) {
position(positionValue);
}
String stackValue = instance.getStack();
if (stackValue != null) {
stack(stackValue);
}
return this;
}
/**
* Initializes the value for the {@link UpdateBuildpackRequest#getBuildpackId() buildpackId} attribute.
* @param buildpackId The value for buildpackId
* @return {@code this} builder for use in a chained invocation
*/
public final Builder buildpackId(String buildpackId) {
this.buildpackId = Objects.requireNonNull(buildpackId, "buildpackId");
initBits &= ~INIT_BIT_BUILDPACK_ID;
return this;
}
/**
* Initializes the value for the {@link UpdateBuildpackRequest#getEnabled() enabled} attribute.
* @param enabled The value for enabled (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder enabled(@Nullable Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* Initializes the value for the {@link UpdateBuildpackRequest#getLocked() locked} attribute.
* @param locked The value for locked (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder locked(@Nullable Boolean locked) {
this.locked = locked;
return this;
}
/**
* Initializes the value for the {@link UpdateBuildpackRequest#getMetadata() metadata} attribute.
* @param metadata The value for metadata (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder metadata(@Nullable Metadata metadata) {
this.metadata = metadata;
return this;
}
/**
* Initializes the value for the {@link UpdateBuildpackRequest#getName() name} attribute.
* @param name The value for name (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder name(@Nullable String name) {
this.name = name;
return this;
}
/**
* Initializes the value for the {@link UpdateBuildpackRequest#getPosition() position} attribute.
* @param position The value for position (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder position(@Nullable Integer position) {
this.position = position;
return this;
}
/**
* Initializes the value for the {@link UpdateBuildpackRequest#getStack() stack} attribute.
* @param stack The value for stack (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder stack(@Nullable String stack) {
this.stack = stack;
return this;
}
/**
* Builds a new {@link UpdateBuildpackRequest UpdateBuildpackRequest}.
* @return An immutable instance of UpdateBuildpackRequest
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public UpdateBuildpackRequest build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new UpdateBuildpackRequest(this);
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList<>();
if ((initBits & INIT_BIT_BUILDPACK_ID) != 0) attributes.add("buildpackId");
return "Cannot build UpdateBuildpackRequest, some of required attributes are not set " + attributes;
}
}
}