package com.github.ferstl.maven.pomenforcers.artifact;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;


@XmlAccessorType(XmlAccessType.FIELD)
public class Artifact {

  @XmlElement(name = "groupId")
  private String groupId;

  @XmlElement(name = "artifactId")
  private String artifactId;

  Artifact() {}

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

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

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

//  public static void main(String[] args) throws Exception {
//    JAXBContext ctx = JAXBContext.newInstance(Dependencies.class);
//    Unmarshaller unmarshaller = ctx.createUnmarshaller();
//    Dependencies artifact = (Dependencies) unmarshaller.unmarshal(new StringReader(
//        "<dependencies>" +
//          "<dependency>" +
//            "<groupId>com.foo</groupId>" +
//            "<artifactId>my-lib</artifactId>" +
//            "<version>1.0-SNAPSHOT</version>" +
//            "<classifier>test</classifier>" +
//            "<type>zip</type>" +
//          "</dependency>" +
//        "</dependencies>"));
//
//    System.out.println(artifact);
//  }
}

@@ -51,16 +51,45 @@
 act;%0D%0A%0D%0A
+import java.util.Objects;%0D%0A%0D%0A
 import j
@@ -125,24 +125,24 @@
 ccessType;%0D%0A
-
 import javax
@@ -228,16 +228,71 @@
 ent;%0D%0A%0D%0A
+import static com.google.common.base.Objects.equal;%0D%0A%0D%0A
 %0D%0A@XmlAc
@@ -719,32 +719,32 @@
 ArtifactId() %7B%0D%0A
-
     return this.
@@ -763,16 +763,538 @@
 %0A  %7D%0D%0A%0D%0A
+  @Override%0D%0A  public String toString() %7B%0D%0A    return this.groupId + %22:%22 + this.artifactId;%0D%0A  %7D%0D%0A%0D%0A  @Override%0D%0A  public boolean equals(Object obj) %7B%0D%0A    if (this == obj) %7B%0D%0A      return true;%0D%0A    %7D%0D%0A    if (!(obj instanceof Artifact)) %7B%0D%0A      return false;%0D%0A    %7D%0D%0A%0D%0A    Artifact other = (Artifact) obj;%0D%0A    return equal(this.groupId, other.groupId)%0D%0A        && equal(this.artifactId, other.artifactId);%0D%0A  %7D%0D%0A%0D%0A  @Override%0D%0A  public int hashCode() %7B%0D%0A    return Objects.hash(this.groupId, this.artifactId);%0D%0A  %7D%0D%0A%0D%0A
 //  publ

implement equals() and hashCode()