All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cloudfoundry.client.v2.buildpacks.UpdateBuildpackRequest Maven / Gradle / Ivy

The newest version!
package org.cloudfoundry.client.v2.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.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.v2.buildpacks._UpdateBuildpackRequest {
  private final String buildpackId;
  private final @Nullable Boolean enabled;
  private final @Nullable String filename;
  private final @Nullable Boolean locked;
  private final @Nullable String name;
  private final @Nullable Integer position;

  private UpdateBuildpackRequest(UpdateBuildpackRequest.Builder builder) {
    this.buildpackId = builder.buildpackId;
    this.enabled = builder.enabled;
    this.filename = builder.filename;
    this.locked = builder.locked;
    this.name = builder.name;
    this.position = builder.position;
  }

  /**
   * The buildpack id
   */
  @JsonProperty("buildpackId")
  @JsonIgnore
  @Override
  public String getBuildpackId() {
    return buildpackId;
  }

  /**
   * The enabled flag
   */
  @JsonProperty("enabled")
  @Override
  public @Nullable Boolean getEnabled() {
    return enabled;
  }

  /**
   * The filename
   */
  @JsonProperty("filename")
  @Override
  public @Nullable String getFilename() {
    return filename;
  }

  /**
   * The locked flag
   */
  @JsonProperty("locked")
  @Override
  public @Nullable Boolean getLocked() {
    return locked;
  }

  /**
   * The name
   */
  @JsonProperty("name")
  @Override
  public @Nullable String getName() {
    return name;
  }

  /**
   * The position
   */
  @JsonProperty("position")
  @Override
  public @Nullable Integer getPosition() {
    return position;
  }

  /**
   * 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(filename, another.filename)
        && Objects.equals(locked, another.locked)
        && Objects.equals(name, another.name)
        && Objects.equals(position, another.position);
  }

  /**
   * Computes a hash code from attributes: {@code buildpackId}, {@code enabled}, {@code filename}, {@code locked}, {@code name}, {@code position}.
   * @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(filename);
    h += (h << 5) + Objects.hashCode(locked);
    h += (h << 5) + Objects.hashCode(name);
    h += (h << 5) + Objects.hashCode(position);
    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
        + ", filename=" + filename
        + ", locked=" + locked
        + ", name=" + name
        + ", position=" + position
        + "}";
  }

  /**
   * 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.v2.buildpacks._UpdateBuildpackRequest {
    String buildpackId;
    Boolean enabled;
    String filename;
    Boolean locked;
    String name;
    Integer position;
    @JsonProperty("buildpackId")
    @JsonIgnore
    public void setBuildpackId(String buildpackId) {
      this.buildpackId = buildpackId;
    }
    @JsonProperty("enabled")
    public void setEnabled(@Nullable Boolean enabled) {
      this.enabled = enabled;
    }
    @JsonProperty("filename")
    public void setFilename(@Nullable String filename) {
      this.filename = filename;
    }
    @JsonProperty("locked")
    public void setLocked(@Nullable Boolean locked) {
      this.locked = locked;
    }
    @JsonProperty("name")
    public void setName(@Nullable String name) {
      this.name = name;
    }
    @JsonProperty("position")
    public void setPosition(@Nullable Integer position) {
      this.position = position;
    }
    @Override
    public String getBuildpackId() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getEnabled() { throw new UnsupportedOperationException(); }
    @Override
    public String getFilename() { throw new UnsupportedOperationException(); }
    @Override
    public Boolean getLocked() { throw new UnsupportedOperationException(); }
    @Override
    public String getName() { throw new UnsupportedOperationException(); }
    @Override
    public Integer getPosition() { 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.filename != null) {
      builder.filename(json.filename);
    }
    if (json.locked != null) {
      builder.locked(json.locked);
    }
    if (json.name != null) {
      builder.name(json.name);
    }
    if (json.position != null) {
      builder.position(json.position);
    }
    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}
   *    .filename(String | null) // nullable {@link UpdateBuildpackRequest#getFilename() filename}
   *    .locked(Boolean | null) // nullable {@link UpdateBuildpackRequest#getLocked() locked}
   *    .name(String | null) // nullable {@link UpdateBuildpackRequest#getName() name}
   *    .position(Integer | null) // nullable {@link UpdateBuildpackRequest#getPosition() position}
   *    .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 String filename; private Boolean locked; private String name; private Integer position; 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); } String filenameValue = instance.getFilename(); if (filenameValue != null) { filename(filenameValue); } Boolean lockedValue = instance.getLocked(); if (lockedValue != null) { locked(lockedValue); } String nameValue = instance.getName(); if (nameValue != null) { name(nameValue); } Integer positionValue = instance.getPosition(); if (positionValue != null) { position(positionValue); } 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#getFilename() filename} attribute. * @param filename The value for filename (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ public final Builder filename(@Nullable String filename) { this.filename = filename; 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#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; } /** * 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; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy