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            default: return "?";
105          }
106        }
107        public String getSystem() {
108          switch (this) {
109            case USUAL: return "http://hl7.org/fhir/identifier-use";
110            case OFFICIAL: return "http://hl7.org/fhir/identifier-use";
111            case TEMP: return "http://hl7.org/fhir/identifier-use";
112            case SECONDARY: return "http://hl7.org/fhir/identifier-use";
113            case OLD: return "http://hl7.org/fhir/identifier-use";
114            default: return "?";
115          }
116        }
117        public String getDefinition() {
118          switch (this) {
119            case USUAL: return "The identifier recommended for display and use in real-world interactions.";
120            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.";
121            case TEMP: return "A temporary identifier.";
122            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.";
123            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.";
124            default: return "?";
125          }
126        }
127        public String getDisplay() {
128          switch (this) {
129            case USUAL: return "Usual";
130            case OFFICIAL: return "Official";
131            case TEMP: return "Temp";
132            case SECONDARY: return "Secondary";
133            case OLD: return "Old";
134            default: return "?";
135          }
136        }
137    }
138
139  public static class IdentifierUseEnumFactory implements EnumFactory<IdentifierUse> {
140    public IdentifierUse fromCode(String codeString) throws IllegalArgumentException {
141      if (codeString == null || "".equals(codeString))
142            if (codeString == null || "".equals(codeString))
143                return null;
144        if ("usual".equals(codeString))
145          return IdentifierUse.USUAL;
146        if ("official".equals(codeString))
147          return IdentifierUse.OFFICIAL;
148        if ("temp".equals(codeString))
149          return IdentifierUse.TEMP;
150        if ("secondary".equals(codeString))
151          return IdentifierUse.SECONDARY;
152        if ("old".equals(codeString))
153          return IdentifierUse.OLD;
154        throw new IllegalArgumentException("Unknown IdentifierUse code '"+codeString+"'");
155        }
156        public Enumeration<IdentifierUse> fromType(Base code) throws FHIRException {
157          if (code == null)
158            return null;
159          if (code.isEmpty())
160            return new Enumeration<IdentifierUse>(this);
161          String codeString = ((PrimitiveType) code).asStringValue();
162          if (codeString == null || "".equals(codeString))
163            return null;
164        if ("usual".equals(codeString))
165          return new Enumeration<IdentifierUse>(this, IdentifierUse.USUAL);
166        if ("official".equals(codeString))
167          return new Enumeration<IdentifierUse>(this, IdentifierUse.OFFICIAL);
168        if ("temp".equals(codeString))
169          return new Enumeration<IdentifierUse>(this, IdentifierUse.TEMP);
170        if ("secondary".equals(codeString))
171          return new Enumeration<IdentifierUse>(this, IdentifierUse.SECONDARY);
172        if ("old".equals(codeString))
173          return new Enumeration<IdentifierUse>(this, IdentifierUse.OLD);
174        throw new FHIRException("Unknown IdentifierUse code '"+codeString+"'");
175        }
176    public String toCode(IdentifierUse code) {
177      if (code == IdentifierUse.USUAL)
178        return "usual";
179      if (code == IdentifierUse.OFFICIAL)
180        return "official";
181      if (code == IdentifierUse.TEMP)
182        return "temp";
183      if (code == IdentifierUse.SECONDARY)
184        return "secondary";
185      if (code == IdentifierUse.OLD)
186        return "old";
187      return "?";
188      }
189    public String toSystem(IdentifierUse code) {
190      return code.getSystem();
191      }
192    }
193
194    /**
195     * The purpose of this identifier.
196     */
197    @Child(name = "use", type = {CodeType.class}, order=0, min=0, max=1, modifier=true, summary=true)
198    @Description(shortDefinition="usual | official | temp | secondary | old (If known)", formalDefinition="The purpose of this identifier." )
199    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/identifier-use")
200    protected Enumeration<IdentifierUse> use;
201
202    /**
203     * A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.
204     */
205    @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
206    @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." )
207    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/identifier-type")
208    protected CodeableConcept type;
209
210    /**
211     * Establishes the namespace for the value - that is, a URL that describes a set values that are unique.
212     */
213    @Child(name = "system", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true)
214    @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." )
215    protected UriType system;
216
217    /**
218     * The portion of the identifier typically relevant to the user and which is unique within the context of the system.
219     */
220    @Child(name = "value", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
221    @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." )
222    protected StringType value;
223
224    /**
225     * Time period during which identifier is/was valid for use.
226     */
227    @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true)
228    @Description(shortDefinition="Time period when id is/was valid for use", formalDefinition="Time period during which identifier is/was valid for use." )
229    protected Period period;
230
231    /**
232     * Organization that issued/manages the identifier.
233     */
234    @Child(name = "assigner", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=true)
235    @Description(shortDefinition="Organization that issued id (may be just text)", formalDefinition="Organization that issued/manages the identifier." )
236    protected Reference assigner;
237
238    /**
239     * The actual object that is the target of the reference (Organization that issued/manages the identifier.)
240     */
241    protected Organization assignerTarget;
242
243    private static final long serialVersionUID = -478840981L;
244
245  /**
246   * Constructor
247   */
248    public Identifier() {
249      super();
250    }
251
252    /**
253     * @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
254     */
255    public Enumeration<IdentifierUse> getUseElement() { 
256      if (this.use == null)
257        if (Configuration.errorOnAutoCreate())
258          throw new Error("Attempt to auto-create Identifier.use");
259        else if (Configuration.doAutoCreate())
260          this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory()); // bb
261      return this.use;
262    }
263
264    public boolean hasUseElement() { 
265      return this.use != null && !this.use.isEmpty();
266    }
267
268    public boolean hasUse() { 
269      return this.use != null && !this.use.isEmpty();
270    }
271
272    /**
273     * @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
274     */
275    public Identifier setUseElement(Enumeration<IdentifierUse> value) { 
276      this.use = value;
277      return this;
278    }
279
280    /**
281     * @return The purpose of this identifier.
282     */
283    public IdentifierUse getUse() { 
284      return this.use == null ? null : this.use.getValue();
285    }
286
287    /**
288     * @param value The purpose of this identifier.
289     */
290    public Identifier setUse(IdentifierUse value) { 
291      if (value == null)
292        this.use = null;
293      else {
294        if (this.use == null)
295          this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory());
296        this.use.setValue(value);
297      }
298      return this;
299    }
300
301    /**
302     * @return {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.)
303     */
304    public CodeableConcept getType() { 
305      if (this.type == null)
306        if (Configuration.errorOnAutoCreate())
307          throw new Error("Attempt to auto-create Identifier.type");
308        else if (Configuration.doAutoCreate())
309          this.type = new CodeableConcept(); // cc
310      return this.type;
311    }
312
313    public boolean hasType() { 
314      return this.type != null && !this.type.isEmpty();
315    }
316
317    /**
318     * @param value {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.)
319     */
320    public Identifier setType(CodeableConcept value) { 
321      this.type = value;
322      return this;
323    }
324
325    /**
326     * @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
327     */
328    public UriType getSystemElement() { 
329      if (this.system == null)
330        if (Configuration.errorOnAutoCreate())
331          throw new Error("Attempt to auto-create Identifier.system");
332        else if (Configuration.doAutoCreate())
333          this.system = new UriType(); // bb
334      return this.system;
335    }
336
337    public boolean hasSystemElement() { 
338      return this.system != null && !this.system.isEmpty();
339    }
340
341    public boolean hasSystem() { 
342      return this.system != null && !this.system.isEmpty();
343    }
344
345    /**
346     * @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
347     */
348    public Identifier setSystemElement(UriType value) { 
349      this.system = value;
350      return this;
351    }
352
353    /**
354     * @return Establishes the namespace for the value - that is, a URL that describes a set values that are unique.
355     */
356    public String getSystem() { 
357      return this.system == null ? null : this.system.getValue();
358    }
359
360    /**
361     * @param value Establishes the namespace for the value - that is, a URL that describes a set values that are unique.
362     */
363    public Identifier setSystem(String value) { 
364      if (Utilities.noString(value))
365        this.system = null;
366      else {
367        if (this.system == null)
368          this.system = new UriType();
369        this.system.setValue(value);
370      }
371      return this;
372    }
373
374    /**
375     * @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
376     */
377    public StringType getValueElement() { 
378      if (this.value == null)
379        if (Configuration.errorOnAutoCreate())
380          throw new Error("Attempt to auto-create Identifier.value");
381        else if (Configuration.doAutoCreate())
382          this.value = new StringType(); // bb
383      return this.value;
384    }
385
386    public boolean hasValueElement() { 
387      return this.value != null && !this.value.isEmpty();
388    }
389
390    public boolean hasValue() { 
391      return this.value != null && !this.value.isEmpty();
392    }
393
394    /**
395     * @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
396     */
397    public Identifier setValueElement(StringType value) { 
398      this.value = value;
399      return this;
400    }
401
402    /**
403     * @return The portion of the identifier typically relevant to the user and which is unique within the context of the system.
404     */
405    public String getValue() { 
406      return this.value == null ? null : this.value.getValue();
407    }
408
409    /**
410     * @param value The portion of the identifier typically relevant to the user and which is unique within the context of the system.
411     */
412    public Identifier setValue(String value) { 
413      if (Utilities.noString(value))
414        this.value = null;
415      else {
416        if (this.value == null)
417          this.value = new StringType();
418        this.value.setValue(value);
419      }
420      return this;
421    }
422
423    /**
424     * @return {@link #period} (Time period during which identifier is/was valid for use.)
425     */
426    public Period getPeriod() { 
427      if (this.period == null)
428        if (Configuration.errorOnAutoCreate())
429          throw new Error("Attempt to auto-create Identifier.period");
430        else if (Configuration.doAutoCreate())
431          this.period = new Period(); // cc
432      return this.period;
433    }
434
435    public boolean hasPeriod() { 
436      return this.period != null && !this.period.isEmpty();
437    }
438
439    /**
440     * @param value {@link #period} (Time period during which identifier is/was valid for use.)
441     */
442    public Identifier setPeriod(Period value) { 
443      this.period = value;
444      return this;
445    }
446
447    /**
448     * @return {@link #assigner} (Organization that issued/manages the identifier.)
449     */
450    public Reference getAssigner() { 
451      if (this.assigner == null)
452        if (Configuration.errorOnAutoCreate())
453          throw new Error("Attempt to auto-create Identifier.assigner");
454        else if (Configuration.doAutoCreate())
455          this.assigner = new Reference(); // cc
456      return this.assigner;
457    }
458
459    public boolean hasAssigner() { 
460      return this.assigner != null && !this.assigner.isEmpty();
461    }
462
463    /**
464     * @param value {@link #assigner} (Organization that issued/manages the identifier.)
465     */
466    public Identifier setAssigner(Reference value) { 
467      this.assigner = value;
468      return this;
469    }
470
471    /**
472     * @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.)
473     */
474    public Organization getAssignerTarget() { 
475      if (this.assignerTarget == null)
476        if (Configuration.errorOnAutoCreate())
477          throw new Error("Attempt to auto-create Identifier.assigner");
478        else if (Configuration.doAutoCreate())
479          this.assignerTarget = new Organization(); // aa
480      return this.assignerTarget;
481    }
482
483    /**
484     * @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.)
485     */
486    public Identifier setAssignerTarget(Organization value) { 
487      this.assignerTarget = value;
488      return this;
489    }
490
491      protected void listChildren(List<Property> children) {
492        super.listChildren(children);
493        children.add(new Property("use", "code", "The purpose of this identifier.", 0, 1, use));
494        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));
495        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));
496        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));
497        children.add(new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period));
498        children.add(new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, 1, assigner));
499      }
500
501      @Override
502      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
503        switch (_hash) {
504        case 116103: /*use*/  return new Property("use", "code", "The purpose of this identifier.", 0, 1, use);
505        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);
506        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);
507        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);
508        case -991726143: /*period*/  return new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period);
509        case -369881636: /*assigner*/  return new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, 1, assigner);
510        default: return super.getNamedProperty(_hash, _name, _checkValid);
511        }
512
513      }
514
515      @Override
516      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
517        switch (hash) {
518        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<IdentifierUse>
519        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
520        case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType
521        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
522        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
523        case -369881636: /*assigner*/ return this.assigner == null ? new Base[0] : new Base[] {this.assigner}; // Reference
524        default: return super.getProperty(hash, name, checkValid);
525        }
526
527      }
528
529      @Override
530      public Base setProperty(int hash, String name, Base value) throws FHIRException {
531        switch (hash) {
532        case 116103: // use
533          value = new IdentifierUseEnumFactory().fromType(castToCode(value));
534          this.use = (Enumeration) value; // Enumeration<IdentifierUse>
535          return value;
536        case 3575610: // type
537          this.type = castToCodeableConcept(value); // CodeableConcept
538          return value;
539        case -887328209: // system
540          this.system = castToUri(value); // UriType
541          return value;
542        case 111972721: // value
543          this.value = castToString(value); // StringType
544          return value;
545        case -991726143: // period
546          this.period = castToPeriod(value); // Period
547          return value;
548        case -369881636: // assigner
549          this.assigner = castToReference(value); // Reference
550          return value;
551        default: return super.setProperty(hash, name, value);
552        }
553
554      }
555
556      @Override
557      public Base setProperty(String name, Base value) throws FHIRException {
558        if (name.equals("use")) {
559          value = new IdentifierUseEnumFactory().fromType(castToCode(value));
560          this.use = (Enumeration) value; // Enumeration<IdentifierUse>
561        } else if (name.equals("type")) {
562          this.type = castToCodeableConcept(value); // CodeableConcept
563        } else if (name.equals("system")) {
564          this.system = castToUri(value); // UriType
565        } else if (name.equals("value")) {
566          this.value = castToString(value); // StringType
567        } else if (name.equals("period")) {
568          this.period = castToPeriod(value); // Period
569        } else if (name.equals("assigner")) {
570          this.assigner = castToReference(value); // Reference
571        } else
572          return super.setProperty(name, value);
573        return value;
574      }
575
576      @Override
577      public Base makeProperty(int hash, String name) throws FHIRException {
578        switch (hash) {
579        case 116103:  return getUseElement();
580        case 3575610:  return getType(); 
581        case -887328209:  return getSystemElement();
582        case 111972721:  return getValueElement();
583        case -991726143:  return getPeriod(); 
584        case -369881636:  return getAssigner(); 
585        default: return super.makeProperty(hash, name);
586        }
587
588      }
589
590      @Override
591      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
592        switch (hash) {
593        case 116103: /*use*/ return new String[] {"code"};
594        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
595        case -887328209: /*system*/ return new String[] {"uri"};
596        case 111972721: /*value*/ return new String[] {"string"};
597        case -991726143: /*period*/ return new String[] {"Period"};
598        case -369881636: /*assigner*/ return new String[] {"Reference"};
599        default: return super.getTypesForProperty(hash, name);
600        }
601
602      }
603
604      @Override
605      public Base addChild(String name) throws FHIRException {
606        if (name.equals("use")) {
607          throw new FHIRException("Cannot call addChild on a primitive type Identifier.use");
608        }
609        else if (name.equals("type")) {
610          this.type = new CodeableConcept();
611          return this.type;
612        }
613        else if (name.equals("system")) {
614          throw new FHIRException("Cannot call addChild on a primitive type Identifier.system");
615        }
616        else if (name.equals("value")) {
617          throw new FHIRException("Cannot call addChild on a primitive type Identifier.value");
618        }
619        else if (name.equals("period")) {
620          this.period = new Period();
621          return this.period;
622        }
623        else if (name.equals("assigner")) {
624          this.assigner = new Reference();
625          return this.assigner;
626        }
627        else
628          return super.addChild(name);
629      }
630
631  public String fhirType() {
632    return "Identifier";
633
634  }
635
636      public Identifier copy() {
637        Identifier dst = new Identifier();
638        copyValues(dst);
639        return dst;
640      }
641
642      public void copyValues(Identifier dst) {
643        super.copyValues(dst);
644        dst.use = use == null ? null : use.copy();
645        dst.type = type == null ? null : type.copy();
646        dst.system = system == null ? null : system.copy();
647        dst.value = value == null ? null : value.copy();
648        dst.period = period == null ? null : period.copy();
649        dst.assigner = assigner == null ? null : assigner.copy();
650      }
651
652      protected Identifier typedCopy() {
653        return copy();
654      }
655
656      @Override
657      public boolean equalsDeep(Base other_) {
658        if (!super.equalsDeep(other_))
659          return false;
660        if (!(other_ instanceof Identifier))
661          return false;
662        Identifier o = (Identifier) other_;
663        return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(system, o.system, true)
664           && compareDeep(value, o.value, true) && compareDeep(period, o.period, true) && compareDeep(assigner, o.assigner, true)
665          ;
666      }
667
668      @Override
669      public boolean equalsShallow(Base other_) {
670        if (!super.equalsShallow(other_))
671          return false;
672        if (!(other_ instanceof Identifier))
673          return false;
674        Identifier o = (Identifier) other_;
675        return compareValues(use, o.use, true) && compareValues(system, o.system, true) && compareValues(value, o.value, true)
676          ;
677      }
678
679      public boolean isEmpty() {
680        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(use, type, system, value
681          , period, assigner);
682      }
683
684
685}