001package org.hl7.fhir.r4.model.codesystems;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034
035import org.hl7.fhir.r4.model.EnumFactory;
036
037public class V3AddressUseEnumFactory implements EnumFactory<V3AddressUse> {
038
039  public V3AddressUse fromCode(String codeString) throws IllegalArgumentException {
040    if (codeString == null || "".equals(codeString))
041      return null;
042    if ("_GeneralAddressUse".equals(codeString))
043      return V3AddressUse._GENERALADDRESSUSE;
044    if ("BAD".equals(codeString))
045      return V3AddressUse.BAD;
046    if ("CONF".equals(codeString))
047      return V3AddressUse.CONF;
048    if ("H".equals(codeString))
049      return V3AddressUse.H;
050    if ("HP".equals(codeString))
051      return V3AddressUse.HP;
052    if ("HV".equals(codeString))
053      return V3AddressUse.HV;
054    if ("OLD".equals(codeString))
055      return V3AddressUse.OLD;
056    if ("TMP".equals(codeString))
057      return V3AddressUse.TMP;
058    if ("WP".equals(codeString))
059      return V3AddressUse.WP;
060    if ("DIR".equals(codeString))
061      return V3AddressUse.DIR;
062    if ("PUB".equals(codeString))
063      return V3AddressUse.PUB;
064    if ("_PostalAddressUse".equals(codeString))
065      return V3AddressUse._POSTALADDRESSUSE;
066    if ("PHYS".equals(codeString))
067      return V3AddressUse.PHYS;
068    if ("PST".equals(codeString))
069      return V3AddressUse.PST;
070    if ("_TelecommunicationAddressUse".equals(codeString))
071      return V3AddressUse._TELECOMMUNICATIONADDRESSUSE;
072    if ("AS".equals(codeString))
073      return V3AddressUse.AS;
074    if ("EC".equals(codeString))
075      return V3AddressUse.EC;
076    if ("MC".equals(codeString))
077      return V3AddressUse.MC;
078    if ("PG".equals(codeString))
079      return V3AddressUse.PG;
080    throw new IllegalArgumentException("Unknown V3AddressUse code '"+codeString+"'");
081  }
082
083  public String toCode(V3AddressUse code) {
084    if (code == V3AddressUse._GENERALADDRESSUSE)
085      return "_GeneralAddressUse";
086    if (code == V3AddressUse.BAD)
087      return "BAD";
088    if (code == V3AddressUse.CONF)
089      return "CONF";
090    if (code == V3AddressUse.H)
091      return "H";
092    if (code == V3AddressUse.HP)
093      return "HP";
094    if (code == V3AddressUse.HV)
095      return "HV";
096    if (code == V3AddressUse.OLD)
097      return "OLD";
098    if (code == V3AddressUse.TMP)
099      return "TMP";
100    if (code == V3AddressUse.WP)
101      return "WP";
102    if (code == V3AddressUse.DIR)
103      return "DIR";
104    if (code == V3AddressUse.PUB)
105      return "PUB";
106    if (code == V3AddressUse._POSTALADDRESSUSE)
107      return "_PostalAddressUse";
108    if (code == V3AddressUse.PHYS)
109      return "PHYS";
110    if (code == V3AddressUse.PST)
111      return "PST";
112    if (code == V3AddressUse._TELECOMMUNICATIONADDRESSUSE)
113      return "_TelecommunicationAddressUse";
114    if (code == V3AddressUse.AS)
115      return "AS";
116    if (code == V3AddressUse.EC)
117      return "EC";
118    if (code == V3AddressUse.MC)
119      return "MC";
120    if (code == V3AddressUse.PG)
121      return "PG";
122    return "?";
123  }
124
125    public String toSystem(V3AddressUse code) {
126      return code.getSystem();
127      }
128
129}
130