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.exceptions.FHIRException;
035
036public enum DiscriminatorType {
037
038  /**
039   * The slices have different values in the nominated element.
040   */
041  VALUE,
042  /**
043   * The slices are differentiated by the presence or absence of the nominated
044   * element.
045   */
046  EXISTS,
047  /**
048   * The slices have different values in the nominated element, as determined by
049   * testing them against the applicable ElementDefinition.pattern[x].
050   */
051  PATTERN,
052  /**
053   * The slices are differentiated by type of the nominated element.
054   */
055  TYPE,
056  /**
057   * The slices are differentiated by conformance of the nominated element to a
058   * specified profile. Note that if the path specifies .resolve() then the
059   * profile is the target profile on the reference. In this case, validation by
060   * the possible profiles is required to differentiate the slices.
061   */
062  PROFILE,
063  /**
064   * added to help the parsers
065   */
066  NULL;
067
068  public static DiscriminatorType fromCode(String codeString) throws FHIRException {
069    if (codeString == null || "".equals(codeString))
070      return null;
071    if ("value".equals(codeString))
072      return VALUE;
073    if ("exists".equals(codeString))
074      return EXISTS;
075    if ("pattern".equals(codeString))
076      return PATTERN;
077    if ("type".equals(codeString))
078      return TYPE;
079    if ("profile".equals(codeString))
080      return PROFILE;
081    throw new FHIRException("Unknown DiscriminatorType code '" + codeString + "'");
082  }
083
084  public String toCode() {
085    switch (this) {
086    case VALUE:
087      return "value";
088    case EXISTS:
089      return "exists";
090    case PATTERN:
091      return "pattern";
092    case TYPE:
093      return "type";
094    case PROFILE:
095      return "profile";
096    case NULL:
097      return null;
098    default:
099      return "?";
100    }
101  }
102
103  public String getSystem() {
104    return "http://hl7.org/fhir/discriminator-type";
105  }
106
107  public String getDefinition() {
108    switch (this) {
109    case VALUE:
110      return "The slices have different values in the nominated element.";
111    case EXISTS:
112      return "The slices are differentiated by the presence or absence of the nominated element.";
113    case PATTERN:
114      return "The slices have different values in the nominated element, as determined by testing them against the applicable ElementDefinition.pattern[x].";
115    case TYPE:
116      return "The slices are differentiated by type of the nominated element.";
117    case PROFILE:
118      return "The slices are differentiated by conformance of the nominated element to a specified profile. Note that if the path specifies .resolve() then the profile is the target profile on the reference. In this case, validation by the possible profiles is required to differentiate the slices.";
119    case NULL:
120      return null;
121    default:
122      return "?";
123    }
124  }
125
126  public String getDisplay() {
127    switch (this) {
128    case VALUE:
129      return "Value";
130    case EXISTS:
131      return "Exists";
132    case PATTERN:
133      return "Pattern";
134    case TYPE:
135      return "Type";
136    case PROFILE:
137      return "Profile";
138    case NULL:
139      return null;
140    default:
141      return "?";
142    }
143  }
144
145}