View Javadoc
1   package ca.uhn.fhir.jpa.term.loinc;
2   
3   /*-
4    * #%L
5    * HAPI FHIR JPA Server
6    * %%
7    * Copyright (C) 2014 - 2018 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  import org.apache.commons.lang3.builder.EqualsBuilder;
24  import org.apache.commons.lang3.builder.HashCodeBuilder;
25  import org.apache.commons.lang3.builder.ToStringBuilder;
26  
27  public class PartTypeAndPartName {
28  	private final String myPartType;
29  	private final String myPartName;
30  
31  	public PartTypeAndPartName(String thePartType, String thePartName) {
32  		myPartType = thePartType;
33  		myPartName = thePartName;
34  	}
35  
36  	@Override
37  	public boolean equals(Object theO) {
38  		if (this == theO) {
39  			return true;
40  		}
41  
42  		if (theO == null || getClass() != theO.getClass()) {
43  			return false;
44  		}
45  
46  		PartTypeAndPartName that = (PartTypeAndPartName) theO;
47  
48  		return new EqualsBuilder()
49  			.append(myPartType, that.myPartType)
50  			.append(myPartName, that.myPartName)
51  			.isEquals();
52  	}
53  
54  	public String getPartName() {
55  		return myPartName;
56  	}
57  
58  	public String getPartType() {
59  		return myPartType;
60  	}
61  
62  	@Override
63  	public int hashCode() {
64  		return new HashCodeBuilder(17, 37)
65  			.append(myPartType)
66  			.append(myPartName)
67  			.toHashCode();
68  	}
69  
70  	@Override
71  	public String toString() {
72  		return new ToStringBuilder(this)
73  			.append("partType", myPartType)
74  			.append("partName", myPartName)
75  			.toString();
76  	}
77  }