org.codehaus.mojo.exec.ExecutableDependency Maven / Gradle / Ivy
package org.codehaus.mojo.exec;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.artifact.Artifact;
/**
*
* ExecutableDependency class.
*
*/
public class ExecutableDependency {
private String groupId;
private String artifactId;
/**
*
* Getter for the field groupId
.
*
*
* @return a {@link java.lang.String} object.
*/
public String getGroupId() {
return this.groupId;
}
/**
*
* Setter for the field groupId
.
*
*
* @param groupId a {@link java.lang.String} object.
*/
public void setGroupId(String groupId) {
this.groupId = groupId;
}
/**
*
* Getter for the field artifactId
.
*
*
* @return a {@link java.lang.String} object.
*/
public String getArtifactId() {
return this.artifactId;
}
/**
*
* Setter for the field artifactId
.
*
*
* @param artifactId a {@link java.lang.String} object.
*/
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
/**
*
* Matches the groupId and artifactId.
*
*
* @param artifact a {@link org.apache.maven.artifact.Artifact} object.
* @return true
if both math, false
otherwise.
*/
public boolean matches(Artifact artifact) {
return artifact.getGroupId().equals(this.getGroupId())
&& artifact.getArtifactId().equals(this.getArtifactId());
}
/** {@inheritDoc} */
public String toString() {
return this.groupId + ":" + this.artifactId;
}
/** {@inheritDoc} */
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ExecutableDependency)) {
return false;
}
final ExecutableDependency that = (ExecutableDependency) o;
if (artifactId != null ? !artifactId.equals(that.artifactId) : that.artifactId != null) {
return false;
}
if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) {
return false;
}
return true;
}
/** {@inheritDoc} */
public int hashCode() {
int result;
result = (groupId != null ? groupId.hashCode() : 0);
result = 29 * result + (artifactId != null ? artifactId.hashCode() : 0);
return result;
}
}