001 package org.codehaus.mojo.exec;
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements. See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership. The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License. You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied. See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022 import org.apache.maven.artifact.Artifact;
023
024 /**
025 *
026 */
027 public class ExecutableDependency {
028 private String groupId;
029
030 private String artifactId;
031
032 public ExecutableDependency() {
033 }
034
035 public String getGroupId() {
036 return this.groupId;
037 }
038
039 public void setGroupId(String groupId) {
040 this.groupId = groupId;
041 }
042
043 public String getArtifactId() {
044 return this.artifactId;
045 }
046
047 public void setArtifactId(String artifactId) {
048 this.artifactId = artifactId;
049 }
050
051 public boolean matches(Artifact artifact) {
052 return artifact.getGroupId().equals(this.getGroupId()) && artifact.getArtifactId().equals(this.getArtifactId());
053 }
054
055 public String toString() {
056 return this.groupId + ":" + this.artifactId;
057 }
058
059 public boolean equals(Object o) {
060 if (this == o) {
061 return true;
062 }
063 if (o == null || getClass() != o.getClass()) {
064 return false;
065 }
066
067 final ExecutableDependency that = (ExecutableDependency) o;
068
069 if (artifactId != null ? !artifactId.equals(that.artifactId) : that.artifactId != null) {
070 return false;
071 }
072 if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null) {
073 return false;
074 }
075
076 return true;
077 }
078
079 public int hashCode() {
080 int result;
081 result = (groupId != null ? groupId.hashCode() : 0);
082 result = 29 * result + (artifactId != null ? artifactId.hashCode() : 0);
083 return result;
084 }
085 }