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