001package org.hl7.fhir.r4.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r4
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.List;
054
055import org.hl7.fhir.exceptions.FHIRException;
056import org.hl7.fhir.instance.model.api.ICompositeType;
057import org.hl7.fhir.utilities.Utilities;
058
059import ca.uhn.fhir.model.api.annotation.Child;
060import ca.uhn.fhir.model.api.annotation.DatatypeDef;
061import ca.uhn.fhir.model.api.annotation.Description;
062/**
063 * An identifier - identifies some entity uniquely and unambiguously. Typically this is used for business identifiers.
064 */
065@DatatypeDef(name="Identifier")
066public class Identifier extends Type implements ICompositeType {
067
068    public enum IdentifierUse {
069        /**
070         * The identifier recommended for display and use in real-world interactions.
071         */
072        USUAL, 
073        /**
074         * The identifier considered to be most trusted for the identification of this item. Sometimes also known as "primary" and "main". The determination of "official" is subjective and implementation guides often provide additional guidelines for use.
075         */
076        OFFICIAL, 
077        /**
078         * A temporary identifier.
079         */
080        TEMP, 
081        /**
082         * An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context.
083         */
084        SECONDARY, 
085        /**
086         * The identifier id no longer considered valid, but may be relevant for search purposes.  E.g. Changes to identifier schemes, account merges, etc.
087         */
088        OLD, 
089        /**
090         * added to help the parsers with the generic types
091         */
092        NULL;
093        public static IdentifierUse fromCode(String codeString) throws FHIRException {
094            if (codeString == null || "".equals(codeString))
095                return null;
096        if ("usual".equals(codeString))
097          return USUAL;
098        if ("official".equals(codeString))
099          return OFFICIAL;
100        if ("temp".equals(codeString))
101          return TEMP;
102        if ("secondary".equals(codeString))
103          return SECONDARY;
104        if ("old".equals(codeString))
105          return OLD;
106        if (Configuration.isAcceptInvalidEnums())
107          return null;
108        else
109          throw new FHIRException("Unknown IdentifierUse code '"+codeString+"'");
110        }
111        public String toCode() {
112          switch (this) {
113            case USUAL: return "usual";
114            case OFFICIAL: return "official";
115            case TEMP: return "temp";
116            case SECONDARY: return "secondary";
117            case OLD: return "old";
118            default: return "?";
119          }
120        }
121        public String getSystem() {
122          switch (this) {
123            case USUAL: return "http://hl7.org/fhir/identifier-use";
124            case OFFICIAL: return "http://hl7.org/fhir/identifier-use";
125            case TEMP: return "http://hl7.org/fhir/identifier-use";
126            case SECONDARY: return "http://hl7.org/fhir/identifier-use";
127            case OLD: return "http://hl7.org/fhir/identifier-use";
128            default: return "?";
129          }
130        }
131        public String getDefinition() {
132          switch (this) {
133            case USUAL: return "The identifier recommended for display and use in real-world interactions.";
134            case OFFICIAL: return "The identifier considered to be most trusted for the identification of this item. Sometimes also known as \"primary\" and \"main\". The determination of \"official\" is subjective and implementation guides often provide additional guidelines for use.";
135            case TEMP: return "A temporary identifier.";
136            case SECONDARY: return "An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context.";
137            case OLD: return "The identifier id no longer considered valid, but may be relevant for search purposes.  E.g. Changes to identifier schemes, account merges, etc.";
138            default: return "?";
139          }
140        }
141        public String getDisplay() {
142          switch (this) {
143            case USUAL: return "Usual";
144            case OFFICIAL: return "Official";
145            case TEMP: return "Temp";
146            case SECONDARY: return "Secondary";
147            case OLD: return "Old";
148            default: return "?";
149          }
150        }
151    }
152
153  public static class IdentifierUseEnumFactory implements EnumFactory<IdentifierUse> {
154    public IdentifierUse fromCode(String codeString) throws IllegalArgumentException {
155      if (codeString == null || "".equals(codeString))
156            if (codeString == null || "".equals(codeString))
157                return null;
158        if ("usual".equals(codeString))
159          return IdentifierUse.USUAL;
160        if ("official".equals(codeString))
161          return IdentifierUse.OFFICIAL;
162        if ("temp".equals(codeString))
163          return IdentifierUse.TEMP;
164        if ("secondary".equals(codeString))
165          return IdentifierUse.SECONDARY;
166        if ("old".equals(codeString))
167          return IdentifierUse.OLD;
168        throw new IllegalArgumentException("Unknown IdentifierUse code '"+codeString+"'");
169        }
170        public Enumeration<IdentifierUse> fromType(Base code) throws FHIRException {
171          if (code == null)
172            return null;
173          if (code.isEmpty())
174            return new Enumeration<IdentifierUse>(this);
175          String codeString = ((PrimitiveType) code).asStringValue();
176          if (codeString == null || "".equals(codeString))
177            return null;
178        if ("usual".equals(codeString))
179          return new Enumeration<IdentifierUse>(this, IdentifierUse.USUAL);
180        if ("official".equals(codeString))
181          return new Enumeration<IdentifierUse>(this, IdentifierUse.OFFICIAL);
182        if ("temp".equals(codeString))
183          return new Enumeration<IdentifierUse>(this, IdentifierUse.TEMP);
184        if ("secondary".equals(codeString))
185          return new Enumeration<IdentifierUse>(this, IdentifierUse.SECONDARY);
186        if ("old".equals(codeString))
187          return new Enumeration<IdentifierUse>(this, IdentifierUse.OLD);
188        throw new FHIRException("Unknown IdentifierUse code '"+codeString+"'");
189        }
190    public String toCode(IdentifierUse code) {
191      if (code == IdentifierUse.USUAL)
192        return "usual";
193      if (code == IdentifierUse.OFFICIAL)
194        return "official";
195      if (code == IdentifierUse.TEMP)
196        return "temp";
197      if (code == IdentifierUse.SECONDARY)
198        return "secondary";
199      if (code == IdentifierUse.OLD)
200        return "old";
201      return "?";
202      }
203    public String toSystem(IdentifierUse code) {
204      return code.getSystem();
205      }
206    }
207
208    /**
209     * The purpose of this identifier.
210     */
211    @Child(name = "use", type = {CodeType.class}, order=0, min=0, max=1, modifier=true, summary=true)
212    @Description(shortDefinition="usual | official | temp | secondary | old (If known)", formalDefinition="The purpose of this identifier." )
213    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/identifier-use")
214    protected Enumeration<IdentifierUse> use;
215
216    /**
217     * A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.
218     */
219    @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
220    @Description(shortDefinition="Description of identifier", formalDefinition="A coded type for the identifier that can be used to determine which identifier to use for a specific purpose." )
221    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/identifier-type")
222    protected CodeableConcept type;
223
224    /**
225     * Establishes the namespace for the value - that is, a URL that describes a set values that are unique.
226     */
227    @Child(name = "system", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true)
228    @Description(shortDefinition="The namespace for the identifier value", formalDefinition="Establishes the namespace for the value - that is, a URL that describes a set values that are unique." )
229    protected UriType system;
230
231    /**
232     * The portion of the identifier typically relevant to the user and which is unique within the context of the system.
233     */
234    @Child(name = "value", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
235    @Description(shortDefinition="The value that is unique", formalDefinition="The portion of the identifier typically relevant to the user and which is unique within the context of the system." )
236    protected StringType value;
237
238    /**
239     * Time period during which identifier is/was valid for use.
240     */
241    @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true)
242    @Description(shortDefinition="Time period when id is/was valid for use", formalDefinition="Time period during which identifier is/was valid for use." )
243    protected Period period;
244
245    /**
246     * Organization that issued/manages the identifier.
247     */
248    @Child(name = "assigner", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=true)
249    @Description(shortDefinition="Organization that issued id (may be just text)", formalDefinition="Organization that issued/manages the identifier." )
250    protected Reference assigner;
251
252    /**
253     * The actual object that is the target of the reference (Organization that issued/manages the identifier.)
254     */
255    protected Organization assignerTarget;
256
257    private static final long serialVersionUID = -478840981L;
258
259  /**
260   * Constructor
261   */
262    public Identifier() {
263      super();
264    }
265
266    /**
267     * @return {@link #use} (The purpose of this identifier.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
268     */
269    public Enumeration<IdentifierUse> getUseElement() { 
270      if (this.use == null)
271        if (Configuration.errorOnAutoCreate())
272          throw new Error("Attempt to auto-create Identifier.use");
273        else if (Configuration.doAutoCreate())
274          this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory()); // bb
275      return this.use;
276    }
277
278    public boolean hasUseElement() { 
279      return this.use != null && !this.use.isEmpty();
280    }
281
282    public boolean hasUse() { 
283      return this.use != null && !this.use.isEmpty();
284    }
285
286    /**
287     * @param value {@link #use} (The purpose of this identifier.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
288     */
289    public Identifier setUseElement(Enumeration<IdentifierUse> value) { 
290      this.use = value;
291      return this;
292    }
293
294    /**
295     * @return The purpose of this identifier.
296     */
297    public IdentifierUse getUse() { 
298      return this.use == null ? null : this.use.getValue();
299    }
300
301    /**
302     * @param value The purpose of this identifier.
303     */
304    public Identifier setUse(IdentifierUse value) { 
305      if (value == null)
306        this.use = null;
307      else {
308        if (this.use == null)
309          this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory());
310        this.use.setValue(value);
311      }
312      return this;
313    }
314
315    /**
316     * @return {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.)
317     */
318    public CodeableConcept getType() { 
319      if (this.type == null)
320        if (Configuration.errorOnAutoCreate())
321          throw new Error("Attempt to auto-create Identifier.type");
322        else if (Configuration.doAutoCreate())
323          this.type = new CodeableConcept(); // cc
324      return this.type;
325    }
326
327    public boolean hasType() { 
328      return this.type != null && !this.type.isEmpty();
329    }
330
331    /**
332     * @param value {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.)
333     */
334    public Identifier setType(CodeableConcept value) { 
335      this.type = value;
336      return this;
337    }
338
339    /**
340     * @return {@link #system} (Establishes the namespace for the value - that is, a URL that describes a set values that are unique.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
341     */
342    public UriType getSystemElement() { 
343      if (this.system == null)
344        if (Configuration.errorOnAutoCreate())
345          throw new Error("Attempt to auto-create Identifier.system");
346        else if (Configuration.doAutoCreate())
347          this.system = new UriType(); // bb
348      return this.system;
349    }
350
351    public boolean hasSystemElement() { 
352      return this.system != null && !this.system.isEmpty();
353    }
354
355    public boolean hasSystem() { 
356      return this.system != null && !this.system.isEmpty();
357    }
358
359    /**
360     * @param value {@link #system} (Establishes the namespace for the value - that is, a URL that describes a set values that are unique.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
361     */
362    public Identifier setSystemElement(UriType value) { 
363      this.system = value;
364      return this;
365    }
366
367    /**
368     * @return Establishes the namespace for the value - that is, a URL that describes a set values that are unique.
369     */
370    public String getSystem() { 
371      return this.system == null ? null : this.system.getValue();
372    }
373
374    /**
375     * @param value Establishes the namespace for the value - that is, a URL that describes a set values that are unique.
376     */
377    public Identifier setSystem(String value) { 
378      if (Utilities.noString(value))
379        this.system = null;
380      else {
381        if (this.system == null)
382          this.system = new UriType();
383        this.system.setValue(value);
384      }
385      return this;
386    }
387
388    /**
389     * @return {@link #value} (The portion of the identifier typically relevant to the user and which is unique within the context of the system.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
390     */
391    public StringType getValueElement() { 
392      if (this.value == null)
393        if (Configuration.errorOnAutoCreate())
394          throw new Error("Attempt to auto-create Identifier.value");
395        else if (Configuration.doAutoCreate())
396          this.value = new StringType(); // bb
397      return this.value;
398    }
399
400    public boolean hasValueElement() { 
401      return this.value != null && !this.value.isEmpty();
402    }
403
404    public boolean hasValue() { 
405      return this.value != null && !this.value.isEmpty();
406    }
407
408    /**
409     * @param value {@link #value} (The portion of the identifier typically relevant to the user and which is unique within the context of the system.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
410     */
411    public Identifier setValueElement(StringType value) { 
412      this.value = value;
413      return this;
414    }
415
416    /**
417     * @return The portion of the identifier typically relevant to the user and which is unique within the context of the system.
418     */
419    public String getValue() { 
420      return this.value == null ? null : this.value.getValue();
421    }
422
423    /**
424     * @param value The portion of the identifier typically relevant to the user and which is unique within the context of the system.
425     */
426    public Identifier setValue(String value) { 
427      if (Utilities.noString(value))
428        this.value = null;
429      else {
430        if (this.value == null)
431          this.value = new StringType();
432        this.value.setValue(value);
433      }
434      return this;
435    }
436
437    /**
438     * @return {@link #period} (Time period during which identifier is/was valid for use.)
439     */
440    public Period getPeriod() { 
441      if (this.period == null)
442        if (Configuration.errorOnAutoCreate())
443          throw new Error("Attempt to auto-create Identifier.period");
444        else if (Configuration.doAutoCreate())
445          this.period = new Period(); // cc
446      return this.period;
447    }
448
449    public boolean hasPeriod() { 
450      return this.period != null && !this.period.isEmpty();
451    }
452
453    /**
454     * @param value {@link #period} (Time period during which identifier is/was valid for use.)
455     */
456    public Identifier setPeriod(Period value) { 
457      this.period = value;
458      return this;
459    }
460
461    /**
462     * @return {@link #assigner} (Organization that issued/manages the identifier.)
463     */
464    public Reference getAssigner() { 
465      if (this.assigner == null)
466        if (Configuration.errorOnAutoCreate())
467          throw new Error("Attempt to auto-create Identifier.assigner");
468        else if (Configuration.doAutoCreate())
469          this.assigner = new Reference(); // cc
470      return this.assigner;
471    }
472
473    public boolean hasAssigner() { 
474      return this.assigner != null && !this.assigner.isEmpty();
475    }
476
477    /**
478     * @param value {@link #assigner} (Organization that issued/manages the identifier.)
479     */
480    public Identifier setAssigner(Reference value) { 
481      this.assigner = value;
482      return this;
483    }
484
485    /**
486     * @return {@link #assigner} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Organization that issued/manages the identifier.)
487     */
488    public Organization getAssignerTarget() { 
489      if (this.assignerTarget == null)
490        if (Configuration.errorOnAutoCreate())
491          throw new Error("Attempt to auto-create Identifier.assigner");
492        else if (Configuration.doAutoCreate())
493          this.assignerTarget = new Organization(); // aa
494      return this.assignerTarget;
495    }
496
497    /**
498     * @param value {@link #assigner} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Organization that issued/manages the identifier.)
499     */
500    public Identifier setAssignerTarget(Organization value) { 
501      this.assignerTarget = value;
502      return this;
503    }
504
505      protected void listChildren(List<Property> children) {
506        super.listChildren(children);
507        children.add(new Property("use", "code", "The purpose of this identifier.", 0, 1, use));
508        children.add(new Property("type", "CodeableConcept", "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.", 0, 1, type));
509        children.add(new Property("system", "uri", "Establishes the namespace for the value - that is, a URL that describes a set values that are unique.", 0, 1, system));
510        children.add(new Property("value", "string", "The portion of the identifier typically relevant to the user and which is unique within the context of the system.", 0, 1, value));
511        children.add(new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period));
512        children.add(new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, 1, assigner));
513      }
514
515      @Override
516      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
517        switch (_hash) {
518        case 116103: /*use*/  return new Property("use", "code", "The purpose of this identifier.", 0, 1, use);
519        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.", 0, 1, type);
520        case -887328209: /*system*/  return new Property("system", "uri", "Establishes the namespace for the value - that is, a URL that describes a set values that are unique.", 0, 1, system);
521        case 111972721: /*value*/  return new Property("value", "string", "The portion of the identifier typically relevant to the user and which is unique within the context of the system.", 0, 1, value);
522        case -991726143: /*period*/  return new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period);
523        case -369881636: /*assigner*/  return new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, 1, assigner);
524        default: return super.getNamedProperty(_hash, _name, _checkValid);
525        }
526
527      }
528
529      @Override
530      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
531        switch (hash) {
532        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<IdentifierUse>
533        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
534        case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType
535        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
536        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
537        case -369881636: /*assigner*/ return this.assigner == null ? new Base[0] : new Base[] {this.assigner}; // Reference
538        default: return super.getProperty(hash, name, checkValid);
539        }
540
541      }
542
543      @Override
544      public Base setProperty(int hash, String name, Base value) throws FHIRException {
545        switch (hash) {
546        case 116103: // use
547          value = new IdentifierUseEnumFactory().fromType(castToCode(value));
548          this.use = (Enumeration) value; // Enumeration<IdentifierUse>
549          return value;
550        case 3575610: // type
551          this.type = castToCodeableConcept(value); // CodeableConcept
552          return value;
553        case -887328209: // system
554          this.system = castToUri(value); // UriType
555          return value;
556        case 111972721: // value
557          this.value = castToString(value); // StringType
558          return value;
559        case -991726143: // period
560          this.period = castToPeriod(value); // Period
561          return value;
562        case -369881636: // assigner
563          this.assigner = castToReference(value); // Reference
564          return value;
565        default: return super.setProperty(hash, name, value);
566        }
567
568      }
569
570      @Override
571      public Base setProperty(String name, Base value) throws FHIRException {
572        if (name.equals("use")) {
573          value = new IdentifierUseEnumFactory().fromType(castToCode(value));
574          this.use = (Enumeration) value; // Enumeration<IdentifierUse>
575        } else if (name.equals("type")) {
576          this.type = castToCodeableConcept(value); // CodeableConcept
577        } else if (name.equals("system")) {
578          this.system = castToUri(value); // UriType
579        } else if (name.equals("value")) {
580          this.value = castToString(value); // StringType
581        } else if (name.equals("period")) {
582          this.period = castToPeriod(value); // Period
583        } else if (name.equals("assigner")) {
584          this.assigner = castToReference(value); // Reference
585        } else
586          return super.setProperty(name, value);
587        return value;
588      }
589
590      @Override
591      public Base makeProperty(int hash, String name) throws FHIRException {
592        switch (hash) {
593        case 116103:  return getUseElement();
594        case 3575610:  return getType(); 
595        case -887328209:  return getSystemElement();
596        case 111972721:  return getValueElement();
597        case -991726143:  return getPeriod(); 
598        case -369881636:  return getAssigner(); 
599        default: return super.makeProperty(hash, name);
600        }
601
602      }
603
604      @Override
605      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
606        switch (hash) {
607        case 116103: /*use*/ return new String[] {"code"};
608        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
609        case -887328209: /*system*/ return new String[] {"uri"};
610        case 111972721: /*value*/ return new String[] {"string"};
611        case -991726143: /*period*/ return new String[] {"Period"};
612        case -369881636: /*assigner*/ return new String[] {"Reference"};
613        default: return super.getTypesForProperty(hash, name);
614        }
615
616      }
617
618      @Override
619      public Base addChild(String name) throws FHIRException {
620        if (name.equals("use")) {
621          throw new FHIRException("Cannot call addChild on a primitive type Identifier.use");
622        }
623        else if (name.equals("type")) {
624          this.type = new CodeableConcept();
625          return this.type;
626        }
627        else if (name.equals("system")) {
628          throw new FHIRException("Cannot call addChild on a primitive type Identifier.system");
629        }
630        else if (name.equals("value")) {
631          throw new FHIRException("Cannot call addChild on a primitive type Identifier.value");
632        }
633        else if (name.equals("period")) {
634          this.period = new Period();
635          return this.period;
636        }
637        else if (name.equals("assigner")) {
638          this.assigner = new Reference();
639          return this.assigner;
640        }
641        else
642          return super.addChild(name);
643      }
644
645  public String fhirType() {
646    return "Identifier";
647
648  }
649
650      public Identifier copy() {
651        Identifier dst = new Identifier();
652        copyValues(dst);
653        dst.use = use == null ? null : use.copy();
654        dst.type = type == null ? null : type.copy();
655        dst.system = system == null ? null : system.copy();
656        dst.value = value == null ? null : value.copy();
657        dst.period = period == null ? null : period.copy();
658        dst.assigner = assigner == null ? null : assigner.copy();
659        return dst;
660      }
661
662      protected Identifier typedCopy() {
663        return copy();
664      }
665
666      @Override
667      public boolean equalsDeep(Base other_) {
668        if (!super.equalsDeep(other_))
669          return false;
670        if (!(other_ instanceof Identifier))
671          return false;
672        Identifier o = (Identifier) other_;
673        return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(system, o.system, true)
674           && compareDeep(value, o.value, true) && compareDeep(period, o.period, true) && compareDeep(assigner, o.assigner, true)
675          ;
676      }
677
678      @Override
679      public boolean equalsShallow(Base other_) {
680        if (!super.equalsShallow(other_))
681          return false;
682        if (!(other_ instanceof Identifier))
683          return false;
684        Identifier o = (Identifier) other_;
685        return compareValues(use, o.use, true) && compareValues(system, o.system, true) && compareValues(value, o.value, true)
686          ;
687      }
688
689      public boolean isEmpty() {
690        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(use, type, system, value
691          , period, assigner);
692      }
693
694
695}
696