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 Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0
033
034import org.hl7.fhir.r4.model.EnumFactory;
035
036public class ObjectRoleEnumFactory implements EnumFactory<ObjectRole> {
037
038  public ObjectRole fromCode(String codeString) throws IllegalArgumentException {
039    if (codeString == null || "".equals(codeString))
040      return null;
041    if ("1".equals(codeString))
042      return ObjectRole._1;
043    if ("2".equals(codeString))
044      return ObjectRole._2;
045    if ("3".equals(codeString))
046      return ObjectRole._3;
047    if ("4".equals(codeString))
048      return ObjectRole._4;
049    if ("5".equals(codeString))
050      return ObjectRole._5;
051    if ("6".equals(codeString))
052      return ObjectRole._6;
053    if ("7".equals(codeString))
054      return ObjectRole._7;
055    if ("8".equals(codeString))
056      return ObjectRole._8;
057    if ("9".equals(codeString))
058      return ObjectRole._9;
059    if ("10".equals(codeString))
060      return ObjectRole._10;
061    if ("11".equals(codeString))
062      return ObjectRole._11;
063    if ("12".equals(codeString))
064      return ObjectRole._12;
065    if ("13".equals(codeString))
066      return ObjectRole._13;
067    if ("14".equals(codeString))
068      return ObjectRole._14;
069    if ("15".equals(codeString))
070      return ObjectRole._15;
071    if ("16".equals(codeString))
072      return ObjectRole._16;
073    if ("17".equals(codeString))
074      return ObjectRole._17;
075    if ("18".equals(codeString))
076      return ObjectRole._18;
077    if ("19".equals(codeString))
078      return ObjectRole._19;
079    if ("20".equals(codeString))
080      return ObjectRole._20;
081    if ("21".equals(codeString))
082      return ObjectRole._21;
083    if ("22".equals(codeString))
084      return ObjectRole._22;
085    if ("23".equals(codeString))
086      return ObjectRole._23;
087    if ("24".equals(codeString))
088      return ObjectRole._24;
089    throw new IllegalArgumentException("Unknown ObjectRole code '" + codeString + "'");
090  }
091
092  public String toCode(ObjectRole code) {
093       if (code == ObjectRole.NULL)
094           return null;
095       if (code == ObjectRole._1)
096      return "1";
097    if (code == ObjectRole._2)
098      return "2";
099    if (code == ObjectRole._3)
100      return "3";
101    if (code == ObjectRole._4)
102      return "4";
103    if (code == ObjectRole._5)
104      return "5";
105    if (code == ObjectRole._6)
106      return "6";
107    if (code == ObjectRole._7)
108      return "7";
109    if (code == ObjectRole._8)
110      return "8";
111    if (code == ObjectRole._9)
112      return "9";
113    if (code == ObjectRole._10)
114      return "10";
115    if (code == ObjectRole._11)
116      return "11";
117    if (code == ObjectRole._12)
118      return "12";
119    if (code == ObjectRole._13)
120      return "13";
121    if (code == ObjectRole._14)
122      return "14";
123    if (code == ObjectRole._15)
124      return "15";
125    if (code == ObjectRole._16)
126      return "16";
127    if (code == ObjectRole._17)
128      return "17";
129    if (code == ObjectRole._18)
130      return "18";
131    if (code == ObjectRole._19)
132      return "19";
133    if (code == ObjectRole._20)
134      return "20";
135    if (code == ObjectRole._21)
136      return "21";
137    if (code == ObjectRole._22)
138      return "22";
139    if (code == ObjectRole._23)
140      return "23";
141    if (code == ObjectRole._24)
142      return "24";
143    return "?";
144   }
145
146  public String toSystem(ObjectRole code) {
147    return code.getSystem();
148  }
149
150}