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 { 029 private String groupId; 030 031 private String artifactId; 032 033 public ExecutableDependency() 034 { 035 } 036 037 public String getGroupId() 038 { 039 return this.groupId; 040 } 041 042 public void setGroupId( String groupId ) 043 { 044 this.groupId = groupId; 045 } 046 047 public String getArtifactId() 048 { 049 return this.artifactId; 050 } 051 052 public void setArtifactId( String artifactId ) 053 { 054 this.artifactId = artifactId; 055 } 056 057 public boolean matches( Artifact artifact ) 058 { 059 return artifact.getGroupId().equals( this.getGroupId() ) 060 && artifact.getArtifactId().equals( this.getArtifactId() ); 061 } 062 063 public String toString() 064 { 065 return this.groupId + ":" + this.artifactId; 066 } 067 068 public boolean equals( Object o ) 069 { 070 if ( this == o ) 071 { 072 return true; 073 } 074 if ( o == null || getClass() != o.getClass() ) 075 { 076 return false; 077 } 078 079 final ExecutableDependency that = (ExecutableDependency) o; 080 081 if ( artifactId != null ? !artifactId.equals( that.artifactId ) : that.artifactId != null ) 082 { 083 return false; 084 } 085 if ( groupId != null ? !groupId.equals( that.groupId ) : that.groupId != null ) 086 { 087 return false; 088 } 089 090 return true; 091 } 092 093 public int hashCode() 094 { 095 int result; 096 result = ( groupId != null ? groupId.hashCode() : 0 ); 097 result = 29 * result + ( artifactId != null ? artifactId.hashCode() : 0 ); 098 return result; 099 } 100 }