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

com.spotify.missinglink.ConflictBuilder Maven / Gradle / Ivy

The newest version!
package com.spotify.missinglink;

import com.spotify.missinglink.datamodel.ArtifactName;
import com.spotify.missinglink.datamodel.Dependency;
import io.norberg.automatter.AutoMatter;
import javax.annotation.Generated;

@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class ConflictBuilder {
  private Dependency dependency;

  private ArtifactName existsIn;

  private ArtifactName usedBy;

  private Conflict.ConflictCategory category;

  private String reason;

  public ConflictBuilder() {
  }

  private ConflictBuilder(Conflict v) {
    this.dependency = v.dependency();
    this.existsIn = v.existsIn();
    this.usedBy = v.usedBy();
    this.category = v.category();
    this.reason = v.reason();
  }

  private ConflictBuilder(ConflictBuilder v) {
    this.dependency = v.dependency;
    this.existsIn = v.existsIn;
    this.usedBy = v.usedBy;
    this.category = v.category;
    this.reason = v.reason;
  }

  public Dependency dependency() {
    return dependency;
  }

  public ConflictBuilder dependency(Dependency dependency) {
    if (dependency == null) {
      throw new NullPointerException("dependency");
    }
    this.dependency = dependency;
    return this;
  }

  public ArtifactName existsIn() {
    return existsIn;
  }

  public ConflictBuilder existsIn(ArtifactName existsIn) {
    if (existsIn == null) {
      throw new NullPointerException("existsIn");
    }
    this.existsIn = existsIn;
    return this;
  }

  public ArtifactName usedBy() {
    return usedBy;
  }

  public ConflictBuilder usedBy(ArtifactName usedBy) {
    if (usedBy == null) {
      throw new NullPointerException("usedBy");
    }
    this.usedBy = usedBy;
    return this;
  }

  public Conflict.ConflictCategory category() {
    return category;
  }

  public ConflictBuilder category(Conflict.ConflictCategory category) {
    if (category == null) {
      throw new NullPointerException("category");
    }
    this.category = category;
    return this;
  }

  public String reason() {
    return reason;
  }

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

  public Conflict build() {
    return new Value(dependency, existsIn, usedBy, category, reason);
  }

  public static ConflictBuilder from(Conflict v) {
    return new ConflictBuilder(v);
  }

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

  private static final class Value implements Conflict {
    private final Dependency dependency;

    private final ArtifactName existsIn;

    private final ArtifactName usedBy;

    private final Conflict.ConflictCategory category;

    private final String reason;

    private Value(@AutoMatter.Field("dependency") Dependency dependency, @AutoMatter.Field("existsIn") ArtifactName existsIn, @AutoMatter.Field("usedBy") ArtifactName usedBy, @AutoMatter.Field("category") Conflict.ConflictCategory category, @AutoMatter.Field("reason") String reason) {
      if (dependency == null) {
        throw new NullPointerException("dependency");
      }
      if (existsIn == null) {
        throw new NullPointerException("existsIn");
      }
      if (usedBy == null) {
        throw new NullPointerException("usedBy");
      }
      if (category == null) {
        throw new NullPointerException("category");
      }
      if (reason == null) {
        throw new NullPointerException("reason");
      }
      this.dependency = dependency;
      this.existsIn = existsIn;
      this.usedBy = usedBy;
      this.category = category;
      this.reason = reason;
    }

    @AutoMatter.Field
    @Override
    public Dependency dependency() {
      return dependency;
    }

    @AutoMatter.Field
    @Override
    public ArtifactName existsIn() {
      return existsIn;
    }

    @AutoMatter.Field
    @Override
    public ArtifactName usedBy() {
      return usedBy;
    }

    @AutoMatter.Field
    @Override
    public Conflict.ConflictCategory category() {
      return category;
    }

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

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

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof Conflict)) {
        return false;
      }
      final Conflict that = (Conflict) o;
      if (dependency != null ? !dependency.equals(that.dependency()) : that.dependency() != null) {
        return false;
      }
      if (existsIn != null ? !existsIn.equals(that.existsIn()) : that.existsIn() != null) {
        return false;
      }
      if (usedBy != null ? !usedBy.equals(that.usedBy()) : that.usedBy() != null) {
        return false;
      }
      if (category != null ? !category.equals(that.category()) : that.category() != null) {
        return false;
      }
      if (reason != null ? !reason.equals(that.reason()) : that.reason() != null) {
        return false;
      }
      return true;
    }

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

    @Override
    public String toString() {
      return "Conflict{" +
      "dependency=" + dependency +
      ", existsIn=" + existsIn +
      ", usedBy=" + usedBy +
      ", category=" + category +
      ", reason=" + reason +
      '}';
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy