/*******************************************************************************
* Copyright (c) 2013 GoPivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* GoPivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.eclipse.boot.core;
/**
* Identifies a boot starter within the scope of a project (i.e. this is a 'key' that can
* be used to lookup a Starter in a project. It doesn't contain version info.
*
* @author Kris De Volder
*/
public class MavenId {
final private String groupId;
final private String artifactId;
public MavenId(String groupId, String artifactId) {
super();
this.groupId = groupId;
this.artifactId = artifactId;
}
public String getGroupId() {
return groupId;
}
public String getArtifactId() {
return artifactId;
}
@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());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MavenId other = (MavenId) 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;
return true;
}
@Override
public String toString() {
return "StarterId [groupId=" + groupId + ", artifactId=" + artifactId + "]";
}
}