001package org.hl7.fhir.r4.model;
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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.List;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.api.ICompositeType;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.DatatypeDef;
041import ca.uhn.fhir.model.api.annotation.Description;
042
043/**
044 * An identifier - identifies some entity uniquely and unambiguously. Typically
045 * this is used for business identifiers.
046 */
047@DatatypeDef(name = "Identifier")
048public class Identifier extends Type implements ICompositeType {
049
050  public enum IdentifierUse {
051    /**
052     * The identifier recommended for display and use in real-world interactions.
053     */
054    USUAL,
055    /**
056     * The identifier considered to be most trusted for the identification of this
057     * item. Sometimes also known as "primary" and "main". The determination of
058     * "official" is subjective and implementation guides often provide additional
059     * guidelines for use.
060     */
061    OFFICIAL,
062    /**
063     * A temporary identifier.
064     */
065    TEMP,
066    /**
067     * An identifier that was assigned in secondary use - it serves to identify the
068     * object in a relative context, but cannot be consistently assigned to the same
069     * object again in a different context.
070     */
071    SECONDARY,
072    /**
073     * The identifier id no longer considered valid, but may be relevant for search
074     * purposes. E.g. Changes to identifier schemes, account merges, etc.
075     */
076    OLD,
077    /**
078     * added to help the parsers with the generic types
079     */
080    NULL;
081
082    public static IdentifierUse fromCode(String codeString) throws FHIRException {
083      if (codeString == null || "".equals(codeString))
084        return null;
085      if ("usual".equals(codeString))
086        return USUAL;
087      if ("official".equals(codeString))
088        return OFFICIAL;
089      if ("temp".equals(codeString))
090        return TEMP;
091      if ("secondary".equals(codeString))
092        return SECONDARY;
093      if ("old".equals(codeString))
094        return OLD;
095      if (Configuration.isAcceptInvalidEnums())
096        return null;
097      else
098        throw new FHIRException("Unknown IdentifierUse code '" + codeString + "'");
099    }
100
101    public String toCode() {
102      switch (this) {
103      case USUAL:
104        return "usual";
105      case OFFICIAL:
106        return "official";
107      case TEMP:
108        return "temp";
109      case SECONDARY:
110        return "secondary";
111      case OLD:
112        return "old";
113      case NULL:
114        return null;
115      default:
116        return "?";
117      }
118    }
119
120    public String getSystem() {
121      switch (this) {
122      case USUAL:
123        return "http://hl7.org/fhir/identifier-use";
124      case OFFICIAL:
125        return "http://hl7.org/fhir/identifier-use";
126      case TEMP:
127        return "http://hl7.org/fhir/identifier-use";
128      case SECONDARY:
129        return "http://hl7.org/fhir/identifier-use";
130      case OLD:
131        return "http://hl7.org/fhir/identifier-use";
132      case NULL:
133        return null;
134      default:
135        return "?";
136      }
137    }
138
139    public String getDefinition() {
140      switch (this) {
141      case USUAL:
142        return "The identifier recommended for display and use in real-world interactions.";
143      case OFFICIAL:
144        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.";
145      case TEMP:
146        return "A temporary identifier.";
147      case SECONDARY:
148        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.";
149      case OLD:
150        return "The identifier id no longer considered valid, but may be relevant for search purposes.  E.g. Changes to identifier schemes, account merges, etc.";
151      case NULL:
152        return null;
153      default:
154        return "?";
155      }
156    }
157
158    public String getDisplay() {
159      switch (this) {
160      case USUAL:
161        return "Usual";
162      case OFFICIAL:
163        return "Official";
164      case TEMP:
165        return "Temp";
166      case SECONDARY:
167        return "Secondary";
168      case OLD:
169        return "Old";
170      case NULL:
171        return null;
172      default:
173        return "?";
174      }
175    }
176  }
177
178  public static class IdentifierUseEnumFactory implements EnumFactory<IdentifierUse> {
179    public IdentifierUse fromCode(String codeString) throws IllegalArgumentException {
180      if (codeString == null || "".equals(codeString))
181        if (codeString == null || "".equals(codeString))
182          return null;
183      if ("usual".equals(codeString))
184        return IdentifierUse.USUAL;
185      if ("official".equals(codeString))
186        return IdentifierUse.OFFICIAL;
187      if ("temp".equals(codeString))
188        return IdentifierUse.TEMP;
189      if ("secondary".equals(codeString))
190        return IdentifierUse.SECONDARY;
191      if ("old".equals(codeString))
192        return IdentifierUse.OLD;
193      throw new IllegalArgumentException("Unknown IdentifierUse code '" + codeString + "'");
194    }
195
196    public Enumeration<IdentifierUse> fromType(PrimitiveType<?> code) throws FHIRException {
197      if (code == null)
198        return null;
199      if (code.isEmpty())
200        return new Enumeration<IdentifierUse>(this, IdentifierUse.NULL, code);
201      String codeString = code.asStringValue();
202      if (codeString == null || "".equals(codeString))
203        return new Enumeration<IdentifierUse>(this, IdentifierUse.NULL, code);
204      if ("usual".equals(codeString))
205        return new Enumeration<IdentifierUse>(this, IdentifierUse.USUAL, code);
206      if ("official".equals(codeString))
207        return new Enumeration<IdentifierUse>(this, IdentifierUse.OFFICIAL, code);
208      if ("temp".equals(codeString))
209        return new Enumeration<IdentifierUse>(this, IdentifierUse.TEMP, code);
210      if ("secondary".equals(codeString))
211        return new Enumeration<IdentifierUse>(this, IdentifierUse.SECONDARY, code);
212      if ("old".equals(codeString))
213        return new Enumeration<IdentifierUse>(this, IdentifierUse.OLD, code);
214      throw new FHIRException("Unknown IdentifierUse code '" + codeString + "'");
215    }
216
217    public String toCode(IdentifierUse code) {
218       if (code == IdentifierUse.NULL)
219           return null;
220       if (code == IdentifierUse.USUAL)
221        return "usual";
222      if (code == IdentifierUse.OFFICIAL)
223        return "official";
224      if (code == IdentifierUse.TEMP)
225        return "temp";
226      if (code == IdentifierUse.SECONDARY)
227        return "secondary";
228      if (code == IdentifierUse.OLD)
229        return "old";
230      return "?";
231   }
232
233    public String toSystem(IdentifierUse code) {
234      return code.getSystem();
235    }
236  }
237
238  /**
239   * The purpose of this identifier.
240   */
241  @Child(name = "use", type = { CodeType.class }, order = 0, min = 0, max = 1, modifier = true, summary = true)
242  @Description(shortDefinition = "usual | official | temp | secondary | old (If known)", formalDefinition = "The purpose of this identifier.")
243  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/identifier-use")
244  protected Enumeration<IdentifierUse> use;
245
246  /**
247   * A coded type for the identifier that can be used to determine which
248   * identifier to use for a specific purpose.
249   */
250  @Child(name = "type", type = { CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
251  @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.")
252  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/identifier-type")
253  protected CodeableConcept type;
254
255  /**
256   * Establishes the namespace for the value - that is, a URL that describes a set
257   * values that are unique.
258   */
259  @Child(name = "system", type = { UriType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
260  @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.")
261  protected UriType system;
262
263  /**
264   * The portion of the identifier typically relevant to the user and which is
265   * unique within the context of the system.
266   */
267  @Child(name = "value", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
268  @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.")
269  protected StringType value;
270
271  /**
272   * Time period during which identifier is/was valid for use.
273   */
274  @Child(name = "period", type = { Period.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
275  @Description(shortDefinition = "Time period when id is/was valid for use", formalDefinition = "Time period during which identifier is/was valid for use.")
276  protected Period period;
277
278  /**
279   * Organization that issued/manages the identifier.
280   */
281  @Child(name = "assigner", type = {
282      Organization.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
283  @Description(shortDefinition = "Organization that issued id (may be just text)", formalDefinition = "Organization that issued/manages the identifier.")
284  protected Reference assigner;
285
286  /**
287   * The actual object that is the target of the reference (Organization that
288   * issued/manages the identifier.)
289   */
290  protected Organization assignerTarget;
291
292  private static final long serialVersionUID = -478840981L;
293
294  /**
295   * Constructor
296   */
297  public Identifier() {
298    super();
299  }
300
301  /**
302   * @return {@link #use} (The purpose of this identifier.). This is the
303   *         underlying object with id, value and extensions. The accessor
304   *         "getUse" gives direct access to the value
305   */
306  public Enumeration<IdentifierUse> getUseElement() {
307    if (this.use == null)
308      if (Configuration.errorOnAutoCreate())
309        throw new Error("Attempt to auto-create Identifier.use");
310      else if (Configuration.doAutoCreate())
311        this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory()); // bb
312    return this.use;
313  }
314
315  public boolean hasUseElement() {
316    return this.use != null && !this.use.isEmpty();
317  }
318
319  public boolean hasUse() {
320    return this.use != null && !this.use.isEmpty();
321  }
322
323  /**
324   * @param value {@link #use} (The purpose of this identifier.). This is the
325   *              underlying object with id, value and extensions. The accessor
326   *              "getUse" gives direct access to the value
327   */
328  public Identifier setUseElement(Enumeration<IdentifierUse> value) {
329    this.use = value;
330    return this;
331  }
332
333  /**
334   * @return The purpose of this identifier.
335   */
336  public IdentifierUse getUse() {
337    return this.use == null ? null : this.use.getValue();
338  }
339
340  /**
341   * @param value The purpose of this identifier.
342   */
343  public Identifier setUse(IdentifierUse value) {
344    if (value == null)
345      this.use = null;
346    else {
347      if (this.use == null)
348        this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory());
349      this.use.setValue(value);
350    }
351    return this;
352  }
353
354  /**
355   * @return {@link #type} (A coded type for the identifier that can be used to
356   *         determine which identifier to use for a specific purpose.)
357   */
358  public CodeableConcept getType() {
359    if (this.type == null)
360      if (Configuration.errorOnAutoCreate())
361        throw new Error("Attempt to auto-create Identifier.type");
362      else if (Configuration.doAutoCreate())
363        this.type = new CodeableConcept(); // cc
364    return this.type;
365  }
366
367  public boolean hasType() {
368    return this.type != null && !this.type.isEmpty();
369  }
370
371  /**
372   * @param value {@link #type} (A coded type for the identifier that can be used
373   *              to determine which identifier to use for a specific purpose.)
374   */
375  public Identifier setType(CodeableConcept value) {
376    this.type = value;
377    return this;
378  }
379
380  /**
381   * @return {@link #system} (Establishes the namespace for the value - that is, a
382   *         URL that describes a set values that are unique.). This is the
383   *         underlying object with id, value and extensions. The accessor
384   *         "getSystem" gives direct access to the value
385   */
386  public UriType getSystemElement() {
387    if (this.system == null)
388      if (Configuration.errorOnAutoCreate())
389        throw new Error("Attempt to auto-create Identifier.system");
390      else if (Configuration.doAutoCreate())
391        this.system = new UriType(); // bb
392    return this.system;
393  }
394
395  public boolean hasSystemElement() {
396    return this.system != null && !this.system.isEmpty();
397  }
398
399  public boolean hasSystem() {
400    return this.system != null && !this.system.isEmpty();
401  }
402
403  /**
404   * @param value {@link #system} (Establishes the namespace for the value - that
405   *              is, a URL that describes a set values that are unique.). This is
406   *              the underlying object with id, value and extensions. The
407   *              accessor "getSystem" gives direct access to the value
408   */
409  public Identifier setSystemElement(UriType value) {
410    this.system = value;
411    return this;
412  }
413
414  /**
415   * @return Establishes the namespace for the value - that is, a URL that
416   *         describes a set values that are unique.
417   */
418  public String getSystem() {
419    return this.system == null ? null : this.system.getValue();
420  }
421
422  /**
423   * @param value Establishes the namespace for the value - that is, a URL that
424   *              describes a set values that are unique.
425   */
426  public Identifier setSystem(String value) {
427    if (Utilities.noString(value))
428      this.system = null;
429    else {
430      if (this.system == null)
431        this.system = new UriType();
432      this.system.setValue(value);
433    }
434    return this;
435  }
436
437  /**
438   * @return {@link #value} (The portion of the identifier typically relevant to
439   *         the user and which is unique within the context of the system.). This
440   *         is the underlying object with id, value and extensions. The accessor
441   *         "getValue" gives direct access to the value
442   */
443  public StringType getValueElement() {
444    if (this.value == null)
445      if (Configuration.errorOnAutoCreate())
446        throw new Error("Attempt to auto-create Identifier.value");
447      else if (Configuration.doAutoCreate())
448        this.value = new StringType(); // bb
449    return this.value;
450  }
451
452  public boolean hasValueElement() {
453    return this.value != null && !this.value.isEmpty();
454  }
455
456  public boolean hasValue() {
457    return this.value != null && !this.value.isEmpty();
458  }
459
460  /**
461   * @param value {@link #value} (The portion of the identifier typically relevant
462   *              to the user and which is unique within the context of the
463   *              system.). This is the underlying object with id, value and
464   *              extensions. The accessor "getValue" gives direct access to the
465   *              value
466   */
467  public Identifier setValueElement(StringType value) {
468    this.value = value;
469    return this;
470  }
471
472  /**
473   * @return The portion of the identifier typically relevant to the user and
474   *         which is unique within the context of the system.
475   */
476  public String getValue() {
477    return this.value == null ? null : this.value.getValue();
478  }
479
480  /**
481   * @param value The portion of the identifier typically relevant to the user and
482   *              which is unique within the context of the system.
483   */
484  public Identifier setValue(String value) {
485    if (Utilities.noString(value))
486      this.value = null;
487    else {
488      if (this.value == null)
489        this.value = new StringType();
490      this.value.setValue(value);
491    }
492    return this;
493  }
494
495  /**
496   * @return {@link #period} (Time period during which identifier is/was valid for
497   *         use.)
498   */
499  public Period getPeriod() {
500    if (this.period == null)
501      if (Configuration.errorOnAutoCreate())
502        throw new Error("Attempt to auto-create Identifier.period");
503      else if (Configuration.doAutoCreate())
504        this.period = new Period(); // cc
505    return this.period;
506  }
507
508  public boolean hasPeriod() {
509    return this.period != null && !this.period.isEmpty();
510  }
511
512  /**
513   * @param value {@link #period} (Time period during which identifier is/was
514   *              valid for use.)
515   */
516  public Identifier setPeriod(Period value) {
517    this.period = value;
518    return this;
519  }
520
521  /**
522   * @return {@link #assigner} (Organization that issued/manages the identifier.)
523   */
524  public Reference getAssigner() {
525    if (this.assigner == null)
526      if (Configuration.errorOnAutoCreate())
527        throw new Error("Attempt to auto-create Identifier.assigner");
528      else if (Configuration.doAutoCreate())
529        this.assigner = new Reference(); // cc
530    return this.assigner;
531  }
532
533  public boolean hasAssigner() {
534    return this.assigner != null && !this.assigner.isEmpty();
535  }
536
537  /**
538   * @param value {@link #assigner} (Organization that issued/manages the
539   *              identifier.)
540   */
541  public Identifier setAssigner(Reference value) {
542    this.assigner = value;
543    return this;
544  }
545
546  /**
547   * @return {@link #assigner} The actual object that is the target of the
548   *         reference. The reference library doesn't populate this, but you can
549   *         use it to hold the resource if you resolve it. (Organization that
550   *         issued/manages the identifier.)
551   */
552  public Organization getAssignerTarget() {
553    if (this.assignerTarget == null)
554      if (Configuration.errorOnAutoCreate())
555        throw new Error("Attempt to auto-create Identifier.assigner");
556      else if (Configuration.doAutoCreate())
557        this.assignerTarget = new Organization(); // aa
558    return this.assignerTarget;
559  }
560
561  /**
562   * @param value {@link #assigner} The actual object that is the target of the
563   *              reference. The reference library doesn't use these, but you can
564   *              use it to hold the resource if you resolve it. (Organization
565   *              that issued/manages the identifier.)
566   */
567  public Identifier setAssignerTarget(Organization value) {
568    this.assignerTarget = value;
569    return this;
570  }
571
572  protected void listChildren(List<Property> children) {
573    super.listChildren(children);
574    children.add(new Property("use", "code", "The purpose of this identifier.", 0, 1, use));
575    children.add(new Property("type", "CodeableConcept",
576        "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.",
577        0, 1, type));
578    children.add(new Property("system", "uri",
579        "Establishes the namespace for the value - that is, a URL that describes a set values that are unique.", 0, 1,
580        system));
581    children.add(new Property("value", "string",
582        "The portion of the identifier typically relevant to the user and which is unique within the context of the system.",
583        0, 1, value));
584    children.add(
585        new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period));
586    children.add(new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.",
587        0, 1, assigner));
588  }
589
590  @Override
591  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
592    switch (_hash) {
593    case 116103:
594      /* use */ return new Property("use", "code", "The purpose of this identifier.", 0, 1, use);
595    case 3575610:
596      /* type */ return new Property("type", "CodeableConcept",
597          "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.",
598          0, 1, type);
599    case -887328209:
600      /* system */ return new Property("system", "uri",
601          "Establishes the namespace for the value - that is, a URL that describes a set values that are unique.", 0, 1,
602          system);
603    case 111972721:
604      /* value */ return new Property("value", "string",
605          "The portion of the identifier typically relevant to the user and which is unique within the context of the system.",
606          0, 1, value);
607    case -991726143:
608      /* period */ return new Property("period", "Period", "Time period during which identifier is/was valid for use.",
609          0, 1, period);
610    case -369881636:
611      /* assigner */ return new Property("assigner", "Reference(Organization)",
612          "Organization that issued/manages the identifier.", 0, 1, assigner);
613    default:
614      return super.getNamedProperty(_hash, _name, _checkValid);
615    }
616
617  }
618
619  @Override
620  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
621    switch (hash) {
622    case 116103:
623      /* use */ return this.use == null ? new Base[0] : new Base[] { this.use }; // Enumeration<IdentifierUse>
624    case 3575610:
625      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
626    case -887328209:
627      /* system */ return this.system == null ? new Base[0] : new Base[] { this.system }; // UriType
628    case 111972721:
629      /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // StringType
630    case -991726143:
631      /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Period
632    case -369881636:
633      /* assigner */ return this.assigner == null ? new Base[0] : new Base[] { this.assigner }; // Reference
634    default:
635      return super.getProperty(hash, name, checkValid);
636    }
637
638  }
639
640  @Override
641  public Base setProperty(int hash, String name, Base value) throws FHIRException {
642    switch (hash) {
643    case 116103: // use
644      value = new IdentifierUseEnumFactory().fromType(castToCode(value));
645      this.use = (Enumeration) value; // Enumeration<IdentifierUse>
646      return value;
647    case 3575610: // type
648      this.type = castToCodeableConcept(value); // CodeableConcept
649      return value;
650    case -887328209: // system
651      this.system = castToUri(value); // UriType
652      return value;
653    case 111972721: // value
654      this.value = castToString(value); // StringType
655      return value;
656    case -991726143: // period
657      this.period = castToPeriod(value); // Period
658      return value;
659    case -369881636: // assigner
660      this.assigner = castToReference(value); // Reference
661      return value;
662    default:
663      return super.setProperty(hash, name, value);
664    }
665
666  }
667
668  @Override
669  public Base setProperty(String name, Base value) throws FHIRException {
670    if (name.equals("use")) {
671      value = new IdentifierUseEnumFactory().fromType(castToCode(value));
672      this.use = (Enumeration) value; // Enumeration<IdentifierUse>
673    } else if (name.equals("type")) {
674      this.type = castToCodeableConcept(value); // CodeableConcept
675    } else if (name.equals("system")) {
676      this.system = castToUri(value); // UriType
677    } else if (name.equals("value")) {
678      this.value = castToString(value); // StringType
679    } else if (name.equals("period")) {
680      this.period = castToPeriod(value); // Period
681    } else if (name.equals("assigner")) {
682      this.assigner = castToReference(value); // Reference
683    } else
684      return super.setProperty(name, value);
685    return value;
686  }
687
688  @Override
689  public void removeChild(String name, Base value) throws FHIRException {
690    if (name.equals("use")) {
691      this.use = null;
692    } else if (name.equals("type")) {
693      this.type = null;
694    } else if (name.equals("system")) {
695      this.system = null;
696    } else if (name.equals("value")) {
697      this.value = null;
698    } else if (name.equals("period")) {
699      this.period = null;
700    } else if (name.equals("assigner")) {
701      this.assigner = null;
702    } else
703      super.removeChild(name, value);
704    
705  }
706
707  @Override
708  public Base makeProperty(int hash, String name) throws FHIRException {
709    switch (hash) {
710    case 116103:
711      return getUseElement();
712    case 3575610:
713      return getType();
714    case -887328209:
715      return getSystemElement();
716    case 111972721:
717      return getValueElement();
718    case -991726143:
719      return getPeriod();
720    case -369881636:
721      return getAssigner();
722    default:
723      return super.makeProperty(hash, name);
724    }
725
726  }
727
728  @Override
729  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
730    switch (hash) {
731    case 116103:
732      /* use */ return new String[] { "code" };
733    case 3575610:
734      /* type */ return new String[] { "CodeableConcept" };
735    case -887328209:
736      /* system */ return new String[] { "uri" };
737    case 111972721:
738      /* value */ return new String[] { "string" };
739    case -991726143:
740      /* period */ return new String[] { "Period" };
741    case -369881636:
742      /* assigner */ return new String[] { "Reference" };
743    default:
744      return super.getTypesForProperty(hash, name);
745    }
746
747  }
748
749  @Override
750  public Base addChild(String name) throws FHIRException {
751    if (name.equals("use")) {
752      throw new FHIRException("Cannot call addChild on a singleton property Identifier.use");
753    } else if (name.equals("type")) {
754      this.type = new CodeableConcept();
755      return this.type;
756    } else if (name.equals("system")) {
757      throw new FHIRException("Cannot call addChild on a singleton property Identifier.system");
758    } else if (name.equals("value")) {
759      throw new FHIRException("Cannot call addChild on a singleton property Identifier.value");
760    } else if (name.equals("period")) {
761      this.period = new Period();
762      return this.period;
763    } else if (name.equals("assigner")) {
764      this.assigner = new Reference();
765      return this.assigner;
766    } else
767      return super.addChild(name);
768  }
769
770  public String fhirType() {
771    return "Identifier";
772
773  }
774
775  public Identifier copy() {
776    Identifier dst = new Identifier();
777    copyValues(dst);
778    return dst;
779  }
780
781  public void copyValues(Identifier dst) {
782    super.copyValues(dst);
783    dst.use = use == null ? null : use.copy();
784    dst.type = type == null ? null : type.copy();
785    dst.system = system == null ? null : system.copy();
786    dst.value = value == null ? null : value.copy();
787    dst.period = period == null ? null : period.copy();
788    dst.assigner = assigner == null ? null : assigner.copy();
789  }
790
791  protected Identifier typedCopy() {
792    return copy();
793  }
794
795  @Override
796  public boolean equalsDeep(Base other_) {
797    if (!super.equalsDeep(other_))
798      return false;
799    if (!(other_ instanceof Identifier))
800      return false;
801    Identifier o = (Identifier) other_;
802    return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(system, o.system, true)
803        && compareDeep(value, o.value, true) && compareDeep(period, o.period, true)
804        && compareDeep(assigner, o.assigner, true);
805  }
806
807  @Override
808  public boolean equalsShallow(Base other_) {
809    if (!super.equalsShallow(other_))
810      return false;
811    if (!(other_ instanceof Identifier))
812      return false;
813    Identifier o = (Identifier) other_;
814    return compareValues(use, o.use, true) && compareValues(system, o.system, true)
815        && compareValues(value, o.value, true);
816  }
817
818  public boolean isEmpty() {
819    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(use, type, system, value, period, assigner);
820  }
821
822}