001/*- 002 * #%L 003 * HAPI FHIR JPA Server 004 * %% 005 * Copyright (C) 2014 - 2024 Smile CDR, Inc. 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package ca.uhn.fhir.jpa.term.loinc; 021 022import org.apache.commons.lang3.builder.EqualsBuilder; 023import org.apache.commons.lang3.builder.HashCodeBuilder; 024import org.apache.commons.lang3.builder.ToStringBuilder; 025 026public class PartTypeAndPartName { 027 private final String myPartType; 028 private final String myPartName; 029 030 public PartTypeAndPartName(String thePartType, String thePartName) { 031 myPartType = thePartType; 032 myPartName = thePartName; 033 } 034 035 @Override 036 public boolean equals(Object theO) { 037 if (this == theO) { 038 return true; 039 } 040 041 if (theO == null || getClass() != theO.getClass()) { 042 return false; 043 } 044 045 PartTypeAndPartName that = (PartTypeAndPartName) theO; 046 047 return new EqualsBuilder() 048 .append(myPartType, that.myPartType) 049 .append(myPartName, that.myPartName) 050 .isEquals(); 051 } 052 053 public String getPartName() { 054 return myPartName; 055 } 056 057 public String getPartType() { 058 return myPartType; 059 } 060 061 @Override 062 public int hashCode() { 063 return new HashCodeBuilder(17, 37).append(myPartType).append(myPartName).toHashCode(); 064 } 065 066 @Override 067 public String toString() { 068 return new ToStringBuilder(this) 069 .append("partType", myPartType) 070 .append("partName", myPartName) 071 .toString(); 072 } 073}