View Javadoc

1   /**
2    * Copyright 2011-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.maven.plugins.externals;
17  
18  public class GAV {
19  
20  	String groupId;
21  	String artifactId;
22  	String version;
23  
24  	public GAV() {
25  		this(null, null, null);
26  	}
27  
28  	public GAV(String groupId, String artifactId, String version) {
29  		super();
30  		this.groupId = groupId;
31  		this.artifactId = artifactId;
32  		this.version = version;
33  	}
34  
35  	public String getGroupId() {
36  		return groupId;
37  	}
38  
39  	public void setGroupId(String groupId) {
40  		this.groupId = groupId;
41  	}
42  
43  	public String getArtifactId() {
44  		return artifactId;
45  	}
46  
47  	public void setArtifactId(String artifactId) {
48  		this.artifactId = artifactId;
49  	}
50  
51  	public String getVersion() {
52  		return version;
53  	}
54  
55  	public void setVersion(String version) {
56  		this.version = version;
57  	}
58  
59  	@Override
60  	public int hashCode() {
61  		final int prime = 31;
62  		int result = 1;
63  		result = prime * result + ((artifactId == null) ? 0 : artifactId.hashCode());
64  		result = prime * result + ((groupId == null) ? 0 : groupId.hashCode());
65  		result = prime * result + ((version == null) ? 0 : version.hashCode());
66  		return result;
67  	}
68  
69  	@Override
70  	public boolean equals(Object obj) {
71  		if (this == obj)
72  			return true;
73  		if (obj == null)
74  			return false;
75  		if (getClass() != obj.getClass())
76  			return false;
77  		GAV other = (GAV) obj;
78  		if (artifactId == null) {
79  			if (other.artifactId != null)
80  				return false;
81  		} else if (!artifactId.equals(other.artifactId))
82  			return false;
83  		if (groupId == null) {
84  			if (other.groupId != null)
85  				return false;
86  		} else if (!groupId.equals(other.groupId))
87  			return false;
88  		if (version == null) {
89  			if (other.version != null)
90  				return false;
91  		} else if (!version.equals(other.version))
92  			return false;
93  		return true;
94  	}
95  }