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

com.spotify.styx.api.RunStateDataPayloadBuilder Maven / Gradle / Ivy

package com.spotify.styx.api;

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 javax.annotation.processing.Generated;

@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
@AutoMatter.Generated
public final class RunStateDataPayloadBuilder {
  private List activeStates;

  public RunStateDataPayloadBuilder() {
  }

  private RunStateDataPayloadBuilder(RunStateDataPayload v) {
    List _activeStates = v.activeStates();
    this.activeStates = (_activeStates == null) ? null : new ArrayList(_activeStates);
  }

  private RunStateDataPayloadBuilder(RunStateDataPayloadBuilder v) {
    this.activeStates = new ArrayList(v.activeStates());
  }

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

  public RunStateDataPayloadBuilder activeStates(
      List activeStates) {
    return activeStates((Collection) activeStates);
  }

  public RunStateDataPayloadBuilder activeStates(
      Collection activeStates) {
    if (activeStates == null) {
      throw new NullPointerException("activeStates");
    }
    for (RunStateDataPayload.RunStateData item : activeStates) {
      if (item == null) {
        throw new NullPointerException("activeStates: null item");
      }
    }
    this.activeStates = new ArrayList(activeStates);
    return this;
  }

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

  public RunStateDataPayloadBuilder activeStates(
      Iterator activeStates) {
    if (activeStates == null) {
      throw new NullPointerException("activeStates");
    }
    this.activeStates = new ArrayList();
    while (activeStates.hasNext()) {
      RunStateDataPayload.RunStateData item = activeStates.next();
      if (item == null) {
        throw new NullPointerException("activeStates: null item");
      }
      this.activeStates.add(item);
    }
    return this;
  }

  @SafeVarargs
  @SuppressWarnings("varargs")
  public final RunStateDataPayloadBuilder activeStates(
      RunStateDataPayload.RunStateData... activeStates) {
    if (activeStates == null) {
      throw new NullPointerException("activeStates");
    }
    return activeStates(Arrays.asList(activeStates));
  }

  public RunStateDataPayloadBuilder addActiveState(RunStateDataPayload.RunStateData activeState) {
    if (activeState == null) {
      throw new NullPointerException("activeState");
    }
    if (this.activeStates == null) {
      this.activeStates = new ArrayList();
    }
    activeStates.add(activeState);
    return this;
  }

  public RunStateDataPayload build() {
    List _activeStates = (activeStates != null) ? Collections.unmodifiableList(new ArrayList(activeStates)) : Collections.emptyList();
    return new Value(_activeStates);
  }

  public static RunStateDataPayloadBuilder from(RunStateDataPayload v) {
    return new RunStateDataPayloadBuilder(v);
  }

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

  @AutoMatter.Generated
  private static final class Value implements RunStateDataPayload {
    private final List activeStates;

    private Value(
        @AutoMatter.Field("activeStates") List activeStates) {
      this.activeStates = (activeStates != null) ? activeStates : Collections.emptyList();
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof RunStateDataPayload)) {
        return false;
      }
      final RunStateDataPayload that = (RunStateDataPayload) o;
      if (activeStates != null ? !activeStates.equals(that.activeStates()) : that.activeStates() != null) {
        return false;
      }
      return true;
    }

    @Override
    public int hashCode() {
      int result = 1;
      result = 31 * result + (this.activeStates != null ? this.activeStates.hashCode() : 0);
      return result;
    }

    @Override
    public String toString() {
      return "RunStateDataPayload{" +
      "activeStates=" + activeStates +
      '}';
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy