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

io.honnix.rkt.launcher.model.config.AuthBuilder Maven / Gradle / Ivy

package io.honnix.rkt.launcher.model.config;

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

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

  private String rktKind;

  private List domains;

  private String type;

  private Map credentials;

  public AuthBuilder() {
  }

  private AuthBuilder(Stage0Entry.Auth v) {
    this.rktVersion = v.rktVersion();
    this.rktKind = v.rktKind();
    List _domains = v.domains();
    this.domains = (_domains == null) ? null : new ArrayList(_domains);
    this.type = v.type();
    Map _credentials = v.credentials();
    this.credentials = (_credentials == null) ? null : new HashMap(_credentials);
  }

  private AuthBuilder(AuthBuilder v) {
    this.rktVersion = v.rktVersion;
    this.rktKind = v.rktKind;
    this.domains = (v.domains == null) ? null : new ArrayList(v.domains);
    this.type = v.type;
    this.credentials = (v.credentials == null) ? null : new HashMap(v.credentials);
  }

  public String rktVersion() {
    return rktVersion;
  }

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

  public String rktKind() {
    return rktKind;
  }

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

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

  public AuthBuilder domains(List domains) {
    return domains((Collection) domains);
  }

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

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

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

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

  public AuthBuilder addDomain(String domain) {
    if (domain == null) {
      throw new NullPointerException("domain");
    }
    if (this.domains == null) {
      this.domains = new ArrayList();
    }
    domains.add(domain);
    return this;
  }

  public String type() {
    return type;
  }

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

  public Map credentials() {
    if (this.credentials == null) {
      this.credentials = new HashMap();
    }
    return credentials;
  }

  public AuthBuilder credentials(Map credentials) {
    if (credentials == null) {
      throw new NullPointerException("credentials");
    }
    for (Map.Entry entry : credentials.entrySet()) {
      if (entry.getKey() == null) {
        throw new NullPointerException("credentials: null key");
      }
      if (entry.getValue() == null) {
        throw new NullPointerException("credentials: null value");
      }
    }
    this.credentials = new HashMap(credentials);
    return this;
  }

  public AuthBuilder credentials(String k1, String v1) {
    if (k1 == null) {
      throw new NullPointerException("credentials: k1");
    }
    if (v1 == null) {
      throw new NullPointerException("credentials: v1");
    }
    credentials = new HashMap();
    credentials.put(k1, v1);
    return this;
  }

  public AuthBuilder credentials(String k1, String v1, String k2, String v2) {
    credentials(k1, v1);
    if (k2 == null) {
      throw new NullPointerException("credentials: k2");
    }
    if (v2 == null) {
      throw new NullPointerException("credentials: v2");
    }
    credentials.put(k2, v2);
    return this;
  }

  public AuthBuilder credentials(String k1, String v1, String k2, String v2, String k3, String v3) {
    credentials(k1, v1, k2, v2);
    if (k3 == null) {
      throw new NullPointerException("credentials: k3");
    }
    if (v3 == null) {
      throw new NullPointerException("credentials: v3");
    }
    credentials.put(k3, v3);
    return this;
  }

  public AuthBuilder credentials(String k1, String v1, String k2, String v2, String k3, String v3, String k4, String v4) {
    credentials(k1, v1, k2, v2, k3, v3);
    if (k4 == null) {
      throw new NullPointerException("credentials: k4");
    }
    if (v4 == null) {
      throw new NullPointerException("credentials: v4");
    }
    credentials.put(k4, v4);
    return this;
  }

  public AuthBuilder credentials(String k1, String v1, String k2, String v2, String k3, String v3, String k4, String v4, String k5, String v5) {
    credentials(k1, v1, k2, v2, k3, v3, k4, v4);
    if (k5 == null) {
      throw new NullPointerException("credentials: k5");
    }
    if (v5 == null) {
      throw new NullPointerException("credentials: v5");
    }
    credentials.put(k5, v5);
    return this;
  }

  public AuthBuilder putCredential(String key, String value) {
    if (key == null) {
      throw new NullPointerException("credential: key");
    }
    if (value == null) {
      throw new NullPointerException("credential: value");
    }
    if (this.credentials == null) {
      this.credentials = new HashMap();
    }
    credentials.put(key, value);
    return this;
  }

  public Stage0Entry.Auth build() {
    List _domains = (domains != null) ? Collections.unmodifiableList(new ArrayList(domains)) : Collections.emptyList();
    Map _credentials = (credentials != null) ? Collections.unmodifiableMap(new HashMap(credentials)) : Collections.emptyMap();
    return new Value(rktVersion, rktKind, _domains, type, _credentials);
  }

  public static AuthBuilder from(Stage0Entry.Auth v) {
    return new AuthBuilder(v);
  }

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

  private static final class Value implements Stage0Entry.Auth {
    private final String rktVersion;

    private final String rktKind;

    private final List domains;

    private final String type;

    private final Map credentials;

    private Value(@AutoMatter.Field("rktVersion") String rktVersion, @AutoMatter.Field("rktKind") String rktKind, @AutoMatter.Field("domains") List domains, @AutoMatter.Field("type") String type, @AutoMatter.Field("credentials") Map credentials) {
      if (rktVersion == null) {
        throw new NullPointerException("rktVersion");
      }
      if (rktKind == null) {
        throw new NullPointerException("rktKind");
      }
      if (type == null) {
        throw new NullPointerException("type");
      }
      this.rktVersion = rktVersion;
      this.rktKind = rktKind;
      this.domains = (domains != null) ? domains : Collections.emptyList();
      this.type = type;
      this.credentials = (credentials != null) ? credentials : Collections.emptyMap();
    }

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

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

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

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

    @AutoMatter.Field
    @Override
    public Map credentials() {
      return credentials;
    }

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

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof Stage0Entry.Auth)) {
        return false;
      }
      final Stage0Entry.Auth that = (Stage0Entry.Auth) o;
      if (rktVersion != null ? !rktVersion.equals(that.rktVersion()) : that.rktVersion() != null) {
        return false;
      }
      if (rktKind != null ? !rktKind.equals(that.rktKind()) : that.rktKind() != null) {
        return false;
      }
      if (domains != null ? !domains.equals(that.domains()) : that.domains() != null) {
        return false;
      }
      if (type != null ? !type.equals(that.type()) : that.type() != null) {
        return false;
      }
      if (credentials != null ? !credentials.equals(that.credentials()) : that.credentials() != null) {
        return false;
      }
      return true;
    }

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

    @Override
    public String toString() {
      return "Stage0Entry.Auth{" +
      "rktVersion=" + rktVersion +
      ", rktKind=" + rktKind +
      ", domains=" + domains +
      ", type=" + type +
      ", credentials=" + credentials +
      '}';
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy