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

io.honnix.rkt.launcher.output.ListOutputBuilder Maven / Gradle / Ivy

There is a newer version: 0.0.8
Show newest version
package io.honnix.rkt.launcher.output;

import io.honnix.rkt.launcher.model.Pod;
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.Generated;

@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class ListOutputBuilder {
  private List pods;

  public ListOutputBuilder() {
  }

  private ListOutputBuilder(ListOutput v) {
    List _pods = v.pods();
    this.pods = (_pods == null) ? null : new ArrayList(_pods);
  }

  private ListOutputBuilder(ListOutputBuilder v) {
    this.pods = (v.pods == null) ? null : new ArrayList(v.pods);
  }

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

  public ListOutputBuilder pods(List pods) {
    return pods((Collection) pods);
  }

  public ListOutputBuilder pods(Collection pods) {
    if (pods == null) {
      throw new NullPointerException("pods");
    }
    for (Pod item : pods) {
      if (item == null) {
        throw new NullPointerException("pods: null item");
      }
    }
    this.pods = new ArrayList(pods);
    return this;
  }

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

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

  @SafeVarargs
  public final ListOutputBuilder pods(Pod... pods) {
    if (pods == null) {
      throw new NullPointerException("pods");
    }
    return pods(Arrays.asList(pods));
  }

  public ListOutputBuilder addPod(Pod pod) {
    if (pod == null) {
      throw new NullPointerException("pod");
    }
    if (this.pods == null) {
      this.pods = new ArrayList();
    }
    pods.add(pod);
    return this;
  }

  public ListOutput build() {
    List _pods = (pods != null) ? Collections.unmodifiableList(new ArrayList(pods)) : Collections.emptyList();
    return new Value(_pods);
  }

  public static ListOutputBuilder from(ListOutput v) {
    return new ListOutputBuilder(v);
  }

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

  private static final class Value implements ListOutput {
    private final List pods;

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

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

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

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

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

    @Override
    public String toString() {
      return "ListOutput{" +
      "pods=" + pods +
      '}';
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy