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

org.cloudfoundry.client.v2.buildpacks.CreateBuildpackRequest 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.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 for the Create Buildpack
 */
@Generated(from = "_CreateBuildpackRequest", generator = "Immutables")
@SuppressWarnings({"all"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class CreateBuildpackRequest
    extends org.cloudfoundry.client.v2.buildpacks._CreateBuildpackRequest {
  private final @Nullable Boolean enabled;
  private final @Nullable String filename;
  private final @Nullable Boolean locked;
  private final String name;
  private final @Nullable Integer position;

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

  /**
   * 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 String getName() {
    return name;
  }

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

  /**
   * This instance is equal to all instances of {@code CreateBuildpackRequest} 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 CreateBuildpackRequest
        && equalTo(0, (CreateBuildpackRequest) another);
  }

  private boolean equalTo(int synthetic, CreateBuildpackRequest another) {
    return Objects.equals(enabled, another.enabled)
        && Objects.equals(filename, another.filename)
        && Objects.equals(locked, another.locked)
        && name.equals(another.name)
        && Objects.equals(position, another.position);
  }

  /**
   * Computes a hash code from attributes: {@code enabled}, {@code filename}, {@code locked}, {@code name}, {@code position}.
   * @return hashCode value
   */
  @Override
  public int hashCode() {
    int h = 5381;
    h += (h << 5) + Objects.hashCode(enabled);
    h += (h << 5) + Objects.hashCode(filename);
    h += (h << 5) + Objects.hashCode(locked);
    h += (h << 5) + name.hashCode();
    h += (h << 5) + Objects.hashCode(position);
    return h;
  }

  /**
   * Prints the immutable value {@code CreateBuildpackRequest} with attribute values.
   * @return A string representation of the value
   */
  @Override
  public String toString() {
    return "CreateBuildpackRequest{"
        + "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 = "_CreateBuildpackRequest", generator = "Immutables")
  @Deprecated
  @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
  static final class Json extends org.cloudfoundry.client.v2.buildpacks._CreateBuildpackRequest {
    Boolean enabled;
    String filename;
    Boolean locked;
    String name;
    Integer position;
    @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(String name) {
      this.name = name;
    }
    @JsonProperty("position")
    public void setPosition(@Nullable Integer position) {
      this.position = position;
    }
    @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 CreateBuildpackRequest fromJson(Json json) {
    CreateBuildpackRequest.Builder builder = CreateBuildpackRequest.builder();
    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 CreateBuildpackRequest CreateBuildpackRequest}.
   * 
   * CreateBuildpackRequest.builder()
   *    .enabled(Boolean | null) // nullable {@link CreateBuildpackRequest#getEnabled() enabled}
   *    .filename(String | null) // nullable {@link CreateBuildpackRequest#getFilename() filename}
   *    .locked(Boolean | null) // nullable {@link CreateBuildpackRequest#getLocked() locked}
   *    .name(String) // required {@link CreateBuildpackRequest#getName() name}
   *    .position(Integer | null) // nullable {@link CreateBuildpackRequest#getPosition() position}
   *    .build();
   * 
* @return A new CreateBuildpackRequest builder */ public static CreateBuildpackRequest.Builder builder() { return new CreateBuildpackRequest.Builder(); } /** * Builds instances of type {@link CreateBuildpackRequest CreateBuildpackRequest}. * 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 = "_CreateBuildpackRequest", generator = "Immutables") public static final class Builder { private static final long INIT_BIT_NAME = 0x1L; private long initBits = 0x1L; 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 CreateBuildpackRequest} 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(CreateBuildpackRequest instance) { return from((_CreateBuildpackRequest) instance); } /** * Copy abstract value type {@code _CreateBuildpackRequest} 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(_CreateBuildpackRequest instance) { Objects.requireNonNull(instance, "instance"); 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); } name(instance.getName()); Integer positionValue = instance.getPosition(); if (positionValue != null) { position(positionValue); } return this; } /** * Initializes the value for the {@link CreateBuildpackRequest#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 CreateBuildpackRequest#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 CreateBuildpackRequest#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 CreateBuildpackRequest#getName() name} attribute. * @param name The value for name * @return {@code this} builder for use in a chained invocation */ public final Builder name(String name) { this.name = Objects.requireNonNull(name, "name"); initBits &= ~INIT_BIT_NAME; return this; } /** * Initializes the value for the {@link CreateBuildpackRequest#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 CreateBuildpackRequest CreateBuildpackRequest}. * @return An immutable instance of CreateBuildpackRequest * @throws java.lang.IllegalStateException if any required attributes are missing */ public CreateBuildpackRequest build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new CreateBuildpackRequest(this); } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_NAME) != 0) attributes.add("name"); return "Cannot build CreateBuildpackRequest, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy