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

com.spotify.docker.client.messages.swarm.AutoValue_NodeSpec Maven / Gradle / Ivy

There is a newer version: 8.18.4
Show newest version

package com.spotify.docker.client.messages.swarm;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import javax.annotation.Generated;
import javax.annotation.Nullable;

@Generated("com.google.auto.value.processor.AutoValueProcessor")
 final class AutoValue_NodeSpec extends NodeSpec {

  private final String name;
  private final ImmutableMap labels;
  private final String role;
  private final String availability;

  private AutoValue_NodeSpec(
      @Nullable String name,
      @Nullable ImmutableMap labels,
      String role,
      String availability) {
    this.name = name;
    this.labels = labels;
    this.role = role;
    this.availability = availability;
  }

  @Nullable
  @JsonProperty(value = "Name")
  @Override
  public String name() {
    return name;
  }

  @Nullable
  @JsonProperty(value = "Labels")
  @Override
  public ImmutableMap labels() {
    return labels;
  }

  @JsonProperty(value = "Role")
  @Override
  public String role() {
    return role;
  }

  @JsonProperty(value = "Availability")
  @Override
  public String availability() {
    return availability;
  }

  @Override
  public String toString() {
    return "NodeSpec{"
        + "name=" + name + ", "
        + "labels=" + labels + ", "
        + "role=" + role + ", "
        + "availability=" + availability
        + "}";
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (o instanceof NodeSpec) {
      NodeSpec that = (NodeSpec) o;
      return ((this.name == null) ? (that.name() == null) : this.name.equals(that.name()))
           && ((this.labels == null) ? (that.labels() == null) : this.labels.equals(that.labels()))
           && (this.role.equals(that.role()))
           && (this.availability.equals(that.availability()));
    }
    return false;
  }

  @Override
  public int hashCode() {
    int h = 1;
    h *= 1000003;
    h ^= (name == null) ? 0 : this.name.hashCode();
    h *= 1000003;
    h ^= (labels == null) ? 0 : this.labels.hashCode();
    h *= 1000003;
    h ^= this.role.hashCode();
    h *= 1000003;
    h ^= this.availability.hashCode();
    return h;
  }

  static final class Builder extends NodeSpec.Builder {
    private String name;
    private ImmutableMap.Builder labelsBuilder$;
    private ImmutableMap labels;
    private String role;
    private String availability;
    Builder() {
      this.labels = ImmutableMap.of();
    }
    Builder(NodeSpec source) {
      this.name = source.name();
      this.labels = source.labels();
      this.role = source.role();
      this.availability = source.availability();
    }
    @Override
    public NodeSpec.Builder name(@Nullable String name) {
      this.name = name;
      return this;
    }
    @Override
    public NodeSpec.Builder labels(@Nullable Map labels) {
      if (labelsBuilder$ != null) {
        throw new IllegalStateException("Cannot set labels after calling labelsBuilder()");
      }
      this.labels = (labels == null ? null : ImmutableMap.copyOf(labels));
      return this;
    }
    @Override
    public ImmutableMap.Builder labelsBuilder() {
      if (labelsBuilder$ == null) {
        labelsBuilder$ = ImmutableMap.builder();
        labelsBuilder$.putAll(labels);
        labels = null;
      }
      return labelsBuilder$;
    }
    @Override
    public NodeSpec.Builder role(String role) {
      this.role = role;
      return this;
    }
    @Override
    public NodeSpec.Builder availability(String availability) {
      this.availability = availability;
      return this;
    }
    @Override
    public NodeSpec build() {
      if (labelsBuilder$ != null) {
        labels = labelsBuilder$.build();
      }
      String missing = "";
      if (role == null) {
        missing += " role";
      }
      if (availability == null) {
        missing += " availability";
      }
      if (!missing.isEmpty()) {
        throw new IllegalStateException("Missing required properties:" + missing);
      }
      return new AutoValue_NodeSpec(
          this.name,
          this.labels,
          this.role,
          this.availability);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy