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

com.github.ferstl.maven.pomenforcers.artifact.ArtifactInfo Maven / Gradle / Ivy

Go to download

The Pedantic POM Enforcers consist of serveral Maven enforcer rules that help you keep your project setup consistent and organized.

There is a newer version: 2.2.0
Show newest version
package com.github.ferstl.maven.pomenforcers.artifact;

import com.google.common.base.Equivalence;

public class ArtifactInfo {
  private final String groupId;
  private final String artifactId;

  public ArtifactInfo(String groupId, String artifactId) {
    this.groupId = groupId;
    this.artifactId = artifactId;
  }

  public String getGroupId() {
    return this.groupId;
  }

  public String getArtifactId() {
    return this.artifactId;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj instanceof ArtifactInfo) {
      return new ArtifactInfoEquivalence().equivalent(this, (ArtifactInfo) obj);
    }
    return false;
  }

  @Override
  public int hashCode() {
    return new ArtifactInfoEquivalence().hash(this);
  }

  @Override
  public String toString() {
    return this.groupId + ":" + this.artifactId;
  }

  private class ArtifactInfoEquivalence extends Equivalence {

    @Override
    protected boolean doEquivalent(ArtifactInfo a, ArtifactInfo b) {
      return a.groupId.equals(b.groupId) && a.artifactId.equals(b.artifactId);
    }

    @Override
    protected int doHash(ArtifactInfo t) {
      return (t.groupId + ":" + t.artifactId).hashCode();
    }

  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy