1 package hudson.maven; 2 3 import org.apache.maven.plugin.descriptor.PluginDescriptor; 4 5 11 public final class PluginName { 12 public final String groupId; 13 public final String artifactId; 14 public final String version; 15 16 public PluginName(String groupId, String artifactId, String version) { 17 this.groupId = groupId; 18 this.artifactId = artifactId; 19 this.version = version; 20 } 21 22 public PluginName(PluginDescriptor pd) { 23 this(pd.getGroupId(), pd.getArtifactId(), pd.getVersion()); 24 } 25 26 29 public String toString() { 30 return groupId+':'+artifactId+':'+version; 31 } 32 33 public boolean equals(Object o) { 34 if (this == o) return true; 35 if (o == null || getClass() != o.getClass()) return false; 36 37 PluginName that = (PluginName) o; 38 39 return artifactId.equals(that.artifactId) 40 && groupId.equals(that.groupId) 41 && version.equals(that.version); 42 43 } 44 45 public int hashCode() { 46 int result; 47 result = groupId.hashCode(); 48 result = 31 * result + artifactId.hashCode(); 49 result = 31 * result + version.hashCode(); 50 return result; 51 } 52 53 public boolean matches(String groupId, String artifactId) { 54 return this.groupId.equals(groupId) && this.artifactId.equals(artifactId); 55 } 56 } 57 | Popular Tags |