/* * Copyright 2016 the original author or authors. * * This file is part of HotswapAgent. * * HotswapAgent is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 2 of the License, or (at your * option) any later version. * * HotswapAgent is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with HotswapAgent. If not, see http://www.gnu.org/licenses/. */ package org.hotswap.agent.versions; /** * The Class MavenInfo. * * @author alpapad@gmail.com */ public class MavenInfo { /** The group id. */ private final String groupId; /** The artifact id. */ private final String artifactId; /** The version. */ private final ArtifactVersion version; /** * Instantiates a new maven info. * * @param groupId the group id * @param artifactId the artifact id * @param version the version */ public MavenInfo(String groupId, String artifactId, String version) { super(); this.groupId = groupId; this.artifactId = artifactId; this.version = new ArtifactVersion(version); } /** * Gets the artifact id. * * @return the artifact id */ public String getArtifactId() { return artifactId; } /** * Gets the group id. * * @return the group id */ public String getGroupId() { return groupId; } /** * Gets the version. * * @return the version */ public ArtifactVersion getVersion() { return version; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } MavenInfo other = (MavenInfo) obj; if (artifactId == null) { if (other.artifactId != null) { return false; } } else if (!artifactId.equals(other.artifactId)) { return false; } if (groupId == null) { if (other.groupId != null) { return false; } } else if (!groupId.equals(other.groupId)) { return false; } if (version == null) { if (other.version != null) { return false; } } else if (!version.equals(other.version)) { return false; } return true; } /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((artifactId == null) ? 0 : artifactId.hashCode()); result = prime * result + ((groupId == null) ? 0 : groupId.hashCode()); result = prime * result + ((version == null) ? 0 : version.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "MavenInfo [groupId=" + groupId + ", artifactId=" + artifactId + ", version=" + version + "]"; } }