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

com.spotify.styx.model.StyxConfigBuilder Maven / Gradle / Ivy

package com.spotify.styx.model;

import io.norberg.automatter.AutoMatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import javax.annotation.Generated;

@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class StyxConfigBuilder {
  private String globalDockerRunnerId;

  private boolean globalEnabled;

  private boolean debugEnabled;

  private boolean resourcesSyncEnabled;

  private boolean bootstrapActiveWFIEnabled;

  private boolean executionGatingEnabled;

  private Optional globalConcurrency;

  private Optional submissionRateLimit;

  private List clientBlacklist;

  public StyxConfigBuilder() {
    this.globalConcurrency = Optional.empty();
    this.submissionRateLimit = Optional.empty();
  }

  private StyxConfigBuilder(StyxConfig v) {
    this.globalDockerRunnerId = v.globalDockerRunnerId();
    this.globalEnabled = v.globalEnabled();
    this.debugEnabled = v.debugEnabled();
    this.resourcesSyncEnabled = v.resourcesSyncEnabled();
    this.bootstrapActiveWFIEnabled = v.bootstrapActiveWFIEnabled();
    this.executionGatingEnabled = v.executionGatingEnabled();
    this.globalConcurrency = v.globalConcurrency();
    this.submissionRateLimit = v.submissionRateLimit();
    List _clientBlacklist = v.clientBlacklist();
    this.clientBlacklist = (_clientBlacklist == null) ? null : new ArrayList(_clientBlacklist);
  }

  private StyxConfigBuilder(StyxConfigBuilder v) {
    this.globalDockerRunnerId = v.globalDockerRunnerId;
    this.globalEnabled = v.globalEnabled;
    this.debugEnabled = v.debugEnabled;
    this.resourcesSyncEnabled = v.resourcesSyncEnabled;
    this.bootstrapActiveWFIEnabled = v.bootstrapActiveWFIEnabled;
    this.executionGatingEnabled = v.executionGatingEnabled;
    this.globalConcurrency = v.globalConcurrency;
    this.submissionRateLimit = v.submissionRateLimit;
    this.clientBlacklist = (v.clientBlacklist == null) ? null : new ArrayList(v.clientBlacklist);
  }

  public String globalDockerRunnerId() {
    return globalDockerRunnerId;
  }

  public StyxConfigBuilder globalDockerRunnerId(String globalDockerRunnerId) {
    if (globalDockerRunnerId == null) {
      throw new NullPointerException("globalDockerRunnerId");
    }
    this.globalDockerRunnerId = globalDockerRunnerId;
    return this;
  }

  public boolean globalEnabled() {
    return globalEnabled;
  }

  public StyxConfigBuilder globalEnabled(boolean globalEnabled) {
    this.globalEnabled = globalEnabled;
    return this;
  }

  public boolean debugEnabled() {
    return debugEnabled;
  }

  public StyxConfigBuilder debugEnabled(boolean debugEnabled) {
    this.debugEnabled = debugEnabled;
    return this;
  }

  public boolean resourcesSyncEnabled() {
    return resourcesSyncEnabled;
  }

  public StyxConfigBuilder resourcesSyncEnabled(boolean resourcesSyncEnabled) {
    this.resourcesSyncEnabled = resourcesSyncEnabled;
    return this;
  }

  public boolean bootstrapActiveWFIEnabled() {
    return bootstrapActiveWFIEnabled;
  }

  public StyxConfigBuilder bootstrapActiveWFIEnabled(boolean bootstrapActiveWFIEnabled) {
    this.bootstrapActiveWFIEnabled = bootstrapActiveWFIEnabled;
    return this;
  }

  public boolean executionGatingEnabled() {
    return executionGatingEnabled;
  }

  public StyxConfigBuilder executionGatingEnabled(boolean executionGatingEnabled) {
    this.executionGatingEnabled = executionGatingEnabled;
    return this;
  }

  public Optional globalConcurrency() {
    return globalConcurrency;
  }

  public StyxConfigBuilder globalConcurrency(Long globalConcurrency) {
    return globalConcurrency(Optional.ofNullable(globalConcurrency));
  }

  @SuppressWarnings("unchecked")
  public StyxConfigBuilder globalConcurrency(Optional globalConcurrency) {
    if (globalConcurrency == null) {
      throw new NullPointerException("globalConcurrency");
    }
    this.globalConcurrency = (Optional)globalConcurrency;
    return this;
  }

  public Optional submissionRateLimit() {
    return submissionRateLimit;
  }

  public StyxConfigBuilder submissionRateLimit(Double submissionRateLimit) {
    return submissionRateLimit(Optional.ofNullable(submissionRateLimit));
  }

  @SuppressWarnings("unchecked")
  public StyxConfigBuilder submissionRateLimit(Optional submissionRateLimit) {
    if (submissionRateLimit == null) {
      throw new NullPointerException("submissionRateLimit");
    }
    this.submissionRateLimit = (Optional)submissionRateLimit;
    return this;
  }

  public List clientBlacklist() {
    if (this.clientBlacklist == null) {
      this.clientBlacklist = new ArrayList();
    }
    return clientBlacklist;
  }

  public StyxConfigBuilder clientBlacklist(List clientBlacklist) {
    return clientBlacklist((Collection) clientBlacklist);
  }

  public StyxConfigBuilder clientBlacklist(Collection clientBlacklist) {
    if (clientBlacklist == null) {
      throw new NullPointerException("clientBlacklist");
    }
    for (String item : clientBlacklist) {
      if (item == null) {
        throw new NullPointerException("clientBlacklist: null item");
      }
    }
    this.clientBlacklist = new ArrayList(clientBlacklist);
    return this;
  }

  public StyxConfigBuilder clientBlacklist(Iterable clientBlacklist) {
    if (clientBlacklist == null) {
      throw new NullPointerException("clientBlacklist");
    }
    if (clientBlacklist instanceof Collection) {
      return clientBlacklist((Collection) clientBlacklist);
    }
    return clientBlacklist(clientBlacklist.iterator());
  }

  public StyxConfigBuilder clientBlacklist(Iterator clientBlacklist) {
    if (clientBlacklist == null) {
      throw new NullPointerException("clientBlacklist");
    }
    this.clientBlacklist = new ArrayList();
    while (clientBlacklist.hasNext()) {
      String item = clientBlacklist.next();
      if (item == null) {
        throw new NullPointerException("clientBlacklist: null item");
      }
      this.clientBlacklist.add(item);
    }
    return this;
  }

  @SafeVarargs
  public final StyxConfigBuilder clientBlacklist(String... clientBlacklist) {
    if (clientBlacklist == null) {
      throw new NullPointerException("clientBlacklist");
    }
    return clientBlacklist(Arrays.asList(clientBlacklist));
  }

  public StyxConfig build() {
    List _clientBlacklist = (clientBlacklist != null) ? Collections.unmodifiableList(new ArrayList(clientBlacklist)) : Collections.emptyList();
    return new Value(globalDockerRunnerId, globalEnabled, debugEnabled, resourcesSyncEnabled, bootstrapActiveWFIEnabled, executionGatingEnabled, globalConcurrency, submissionRateLimit, _clientBlacklist);
  }

  public static StyxConfigBuilder from(StyxConfig v) {
    return new StyxConfigBuilder(v);
  }

  public static StyxConfigBuilder from(StyxConfigBuilder v) {
    return new StyxConfigBuilder(v);
  }

  private static final class Value implements StyxConfig {
    private final String globalDockerRunnerId;

    private final boolean globalEnabled;

    private final boolean debugEnabled;

    private final boolean resourcesSyncEnabled;

    private final boolean bootstrapActiveWFIEnabled;

    private final boolean executionGatingEnabled;

    private final Optional globalConcurrency;

    private final Optional submissionRateLimit;

    private final List clientBlacklist;

    private Value(@AutoMatter.Field("globalDockerRunnerId") String globalDockerRunnerId, @AutoMatter.Field("globalEnabled") boolean globalEnabled, @AutoMatter.Field("debugEnabled") boolean debugEnabled, @AutoMatter.Field("resourcesSyncEnabled") boolean resourcesSyncEnabled, @AutoMatter.Field("bootstrapActiveWFIEnabled") boolean bootstrapActiveWFIEnabled, @AutoMatter.Field("executionGatingEnabled") boolean executionGatingEnabled, @AutoMatter.Field("globalConcurrency") Optional globalConcurrency, @AutoMatter.Field("submissionRateLimit") Optional submissionRateLimit, @AutoMatter.Field("clientBlacklist") List clientBlacklist) {
      if (globalDockerRunnerId == null) {
        throw new NullPointerException("globalDockerRunnerId");
      }
      if (globalConcurrency == null) {
        throw new NullPointerException("globalConcurrency");
      }
      if (submissionRateLimit == null) {
        throw new NullPointerException("submissionRateLimit");
      }
      this.globalDockerRunnerId = globalDockerRunnerId;
      this.globalEnabled = globalEnabled;
      this.debugEnabled = debugEnabled;
      this.resourcesSyncEnabled = resourcesSyncEnabled;
      this.bootstrapActiveWFIEnabled = bootstrapActiveWFIEnabled;
      this.executionGatingEnabled = executionGatingEnabled;
      this.globalConcurrency = globalConcurrency;
      this.submissionRateLimit = submissionRateLimit;
      this.clientBlacklist = (clientBlacklist != null) ? clientBlacklist : Collections.emptyList();
    }

    @AutoMatter.Field
    @Override
    public String globalDockerRunnerId() {
      return globalDockerRunnerId;
    }

    @AutoMatter.Field
    @Override
    public boolean globalEnabled() {
      return globalEnabled;
    }

    @AutoMatter.Field
    @Override
    public boolean debugEnabled() {
      return debugEnabled;
    }

    @AutoMatter.Field
    @Override
    public boolean resourcesSyncEnabled() {
      return resourcesSyncEnabled;
    }

    @AutoMatter.Field
    @Override
    public boolean bootstrapActiveWFIEnabled() {
      return bootstrapActiveWFIEnabled;
    }

    @AutoMatter.Field
    @Override
    public boolean executionGatingEnabled() {
      return executionGatingEnabled;
    }

    @AutoMatter.Field
    @Override
    public Optional globalConcurrency() {
      return globalConcurrency;
    }

    @AutoMatter.Field
    @Override
    public Optional submissionRateLimit() {
      return submissionRateLimit;
    }

    @AutoMatter.Field
    @Override
    public List clientBlacklist() {
      return clientBlacklist;
    }

    public StyxConfigBuilder builder() {
      return new StyxConfigBuilder(this);
    }

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof StyxConfig)) {
        return false;
      }
      final StyxConfig that = (StyxConfig) o;
      if (globalDockerRunnerId != null ? !globalDockerRunnerId.equals(that.globalDockerRunnerId()) : that.globalDockerRunnerId() != null) {
        return false;
      }
      if (globalEnabled != that.globalEnabled()) {
        return false;
      }
      if (debugEnabled != that.debugEnabled()) {
        return false;
      }
      if (resourcesSyncEnabled != that.resourcesSyncEnabled()) {
        return false;
      }
      if (bootstrapActiveWFIEnabled != that.bootstrapActiveWFIEnabled()) {
        return false;
      }
      if (executionGatingEnabled != that.executionGatingEnabled()) {
        return false;
      }
      if (globalConcurrency != null ? !globalConcurrency.equals(that.globalConcurrency()) : that.globalConcurrency() != null) {
        return false;
      }
      if (submissionRateLimit != null ? !submissionRateLimit.equals(that.submissionRateLimit()) : that.submissionRateLimit() != null) {
        return false;
      }
      if (clientBlacklist != null ? !clientBlacklist.equals(that.clientBlacklist()) : that.clientBlacklist() != null) {
        return false;
      }
      return true;
    }

    @Override
    public int hashCode() {
      int result = 1;
      long temp;
      result = 31 * result + (this.globalDockerRunnerId != null ? this.globalDockerRunnerId.hashCode() : 0);
      result = 31 * result + (this.globalEnabled ? 1231 : 1237);
      result = 31 * result + (this.debugEnabled ? 1231 : 1237);
      result = 31 * result + (this.resourcesSyncEnabled ? 1231 : 1237);
      result = 31 * result + (this.bootstrapActiveWFIEnabled ? 1231 : 1237);
      result = 31 * result + (this.executionGatingEnabled ? 1231 : 1237);
      result = 31 * result + (this.globalConcurrency != null ? this.globalConcurrency.hashCode() : 0);
      result = 31 * result + (this.submissionRateLimit != null ? this.submissionRateLimit.hashCode() : 0);
      result = 31 * result + (this.clientBlacklist != null ? this.clientBlacklist.hashCode() : 0);
      return result;
    }

    @Override
    public String toString() {
      return "StyxConfig{" +
      "globalDockerRunnerId=" + globalDockerRunnerId +
      ", globalEnabled=" + globalEnabled +
      ", debugEnabled=" + debugEnabled +
      ", resourcesSyncEnabled=" + resourcesSyncEnabled +
      ", bootstrapActiveWFIEnabled=" + bootstrapActiveWFIEnabled +
      ", executionGatingEnabled=" + executionGatingEnabled +
      ", globalConcurrency=" + globalConcurrency +
      ", submissionRateLimit=" + submissionRateLimit +
      ", clientBlacklist=" + clientBlacklist +
      '}';
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy