1 package com.soebes.maven.extensions;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 class ProjectKey
26 {
27 private final String groupId;
28
29 private final String artifactId;
30
31 private final String version;
32
33 public ProjectKey( final String groupId, final String artifactId, final String version )
34 {
35 super();
36 this.groupId = groupId;
37 this.artifactId = artifactId;
38 this.version = version;
39 }
40
41 public String getGroupId()
42 {
43 return groupId;
44 }
45
46 public String getArtifactId()
47 {
48 return artifactId;
49 }
50
51 public String getVersion()
52 {
53 return version;
54 }
55
56 public String getId()
57 {
58 return this.groupId + ":" + this.artifactId + ":" + this.version;
59 }
60
61 public int hashCode()
62 {
63 final int prime = 31;
64 int result = 1;
65 result = prime * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
66 result = prime * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
67 result = prime * result + ( ( version == null ) ? 0 : version.hashCode() );
68 return result;
69 }
70
71 public boolean equals( Object obj )
72 {
73 if ( this == obj )
74 return true;
75 if ( obj == null )
76 return false;
77 if ( !( obj instanceof ProjectKey ) )
78 return false;
79 ProjectKey other = (ProjectKey) obj;
80 if ( artifactId == null )
81 {
82 if ( other.artifactId != null )
83 return false;
84 }
85 else if ( !artifactId.equals( other.artifactId ) )
86 return false;
87 if ( groupId == null )
88 {
89 if ( other.groupId != null )
90 return false;
91 }
92 else if ( !groupId.equals( other.groupId ) )
93 return false;
94 if ( version == null )
95 {
96 if ( other.version != null )
97 return false;
98 }
99 else if ( !version.equals( other.version ) )
100 return false;
101 return true;
102 }
103
104 }