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