001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047
048/**
049 * Identifier Type: An identifier - identifies some entity uniquely and unambiguously. Typically this is used for business identifiers.
050 */
051@DatatypeDef(name="Identifier")
052public class Identifier extends DataType implements ICompositeType {
053
054    public enum IdentifierUse {
055        /**
056         * The identifier recommended for display and use in real-world interactions which should be used when such identifier is different from the \"official\" identifier.
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 which should be used when such identifier is different from the \"official\" identifier.";
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(PrimitiveType<?> code) throws FHIRException {
161          if (code == null)
162            return null;
163          if (code.isEmpty())
164            return new Enumeration<IdentifierUse>(this, IdentifierUse.NULL, code);
165          String codeString = ((PrimitiveType) code).asStringValue();
166          if (codeString == null || "".equals(codeString))
167            return new Enumeration<IdentifierUse>(this, IdentifierUse.NULL, code);
168        if ("usual".equals(codeString))
169          return new Enumeration<IdentifierUse>(this, IdentifierUse.USUAL, code);
170        if ("official".equals(codeString))
171          return new Enumeration<IdentifierUse>(this, IdentifierUse.OFFICIAL, code);
172        if ("temp".equals(codeString))
173          return new Enumeration<IdentifierUse>(this, IdentifierUse.TEMP, code);
174        if ("secondary".equals(codeString))
175          return new Enumeration<IdentifierUse>(this, IdentifierUse.SECONDARY, code);
176        if ("old".equals(codeString))
177          return new Enumeration<IdentifierUse>(this, IdentifierUse.OLD, code);
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, an absolute 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, an absolute 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    private static final long serialVersionUID = 2098433371L;
243
244  /**
245   * Constructor
246   */
247    public Identifier() {
248      super();
249    }
250
251    /**
252     * @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
253     */
254    public Enumeration<IdentifierUse> getUseElement() { 
255      if (this.use == null)
256        if (Configuration.errorOnAutoCreate())
257          throw new Error("Attempt to auto-create Identifier.use");
258        else if (Configuration.doAutoCreate())
259          this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory()); // bb
260      return this.use;
261    }
262
263    public boolean hasUseElement() { 
264      return this.use != null && !this.use.isEmpty();
265    }
266
267    public boolean hasUse() { 
268      return this.use != null && !this.use.isEmpty();
269    }
270
271    /**
272     * @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
273     */
274    public Identifier setUseElement(Enumeration<IdentifierUse> value) { 
275      this.use = value;
276      return this;
277    }
278
279    /**
280     * @return The purpose of this identifier.
281     */
282    public IdentifierUse getUse() { 
283      return this.use == null ? null : this.use.getValue();
284    }
285
286    /**
287     * @param value The purpose of this identifier.
288     */
289    public Identifier setUse(IdentifierUse value) { 
290      if (value == null)
291        this.use = null;
292      else {
293        if (this.use == null)
294          this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory());
295        this.use.setValue(value);
296      }
297      return this;
298    }
299
300    /**
301     * @return {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.)
302     */
303    public CodeableConcept getType() { 
304      if (this.type == null)
305        if (Configuration.errorOnAutoCreate())
306          throw new Error("Attempt to auto-create Identifier.type");
307        else if (Configuration.doAutoCreate())
308          this.type = new CodeableConcept(); // cc
309      return this.type;
310    }
311
312    public boolean hasType() { 
313      return this.type != null && !this.type.isEmpty();
314    }
315
316    /**
317     * @param value {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.)
318     */
319    public Identifier setType(CodeableConcept value) { 
320      this.type = value;
321      return this;
322    }
323
324    /**
325     * @return {@link #system} (Establishes the namespace for the value - that is, an absolute 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
326     */
327    public UriType getSystemElement() { 
328      if (this.system == null)
329        if (Configuration.errorOnAutoCreate())
330          throw new Error("Attempt to auto-create Identifier.system");
331        else if (Configuration.doAutoCreate())
332          this.system = new UriType(); // bb
333      return this.system;
334    }
335
336    public boolean hasSystemElement() { 
337      return this.system != null && !this.system.isEmpty();
338    }
339
340    public boolean hasSystem() { 
341      return this.system != null && !this.system.isEmpty();
342    }
343
344    /**
345     * @param value {@link #system} (Establishes the namespace for the value - that is, an absolute 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
346     */
347    public Identifier setSystemElement(UriType value) { 
348      this.system = value;
349      return this;
350    }
351
352    /**
353     * @return Establishes the namespace for the value - that is, an absolute URL that describes a set values that are unique.
354     */
355    public String getSystem() { 
356      return this.system == null ? null : this.system.getValue();
357    }
358
359    /**
360     * @param value Establishes the namespace for the value - that is, an absolute URL that describes a set values that are unique.
361     */
362    public Identifier setSystem(String value) { 
363      if (Utilities.noString(value))
364        this.system = null;
365      else {
366        if (this.system == null)
367          this.system = new UriType();
368        this.system.setValue(value);
369      }
370      return this;
371    }
372
373    /**
374     * @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
375     */
376    public StringType getValueElement() { 
377      if (this.value == null)
378        if (Configuration.errorOnAutoCreate())
379          throw new Error("Attempt to auto-create Identifier.value");
380        else if (Configuration.doAutoCreate())
381          this.value = new StringType(); // bb
382      return this.value;
383    }
384
385    public boolean hasValueElement() { 
386      return this.value != null && !this.value.isEmpty();
387    }
388
389    public boolean hasValue() { 
390      return this.value != null && !this.value.isEmpty();
391    }
392
393    /**
394     * @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
395     */
396    public Identifier setValueElement(StringType value) { 
397      this.value = value;
398      return this;
399    }
400
401    /**
402     * @return The portion of the identifier typically relevant to the user and which is unique within the context of the system.
403     */
404    public String getValue() { 
405      return this.value == null ? null : this.value.getValue();
406    }
407
408    /**
409     * @param value The portion of the identifier typically relevant to the user and which is unique within the context of the system.
410     */
411    public Identifier setValue(String value) { 
412      if (Utilities.noString(value))
413        this.value = null;
414      else {
415        if (this.value == null)
416          this.value = new StringType();
417        this.value.setValue(value);
418      }
419      return this;
420    }
421
422    /**
423     * @return {@link #period} (Time period during which identifier is/was valid for use.)
424     */
425    public Period getPeriod() { 
426      if (this.period == null)
427        if (Configuration.errorOnAutoCreate())
428          throw new Error("Attempt to auto-create Identifier.period");
429        else if (Configuration.doAutoCreate())
430          this.period = new Period(); // cc
431      return this.period;
432    }
433
434    public boolean hasPeriod() { 
435      return this.period != null && !this.period.isEmpty();
436    }
437
438    /**
439     * @param value {@link #period} (Time period during which identifier is/was valid for use.)
440     */
441    public Identifier setPeriod(Period value) { 
442      this.period = value;
443      return this;
444    }
445
446    /**
447     * @return {@link #assigner} (Organization that issued/manages the identifier.)
448     */
449    public Reference getAssigner() { 
450      if (this.assigner == null)
451        if (Configuration.errorOnAutoCreate())
452          throw new Error("Attempt to auto-create Identifier.assigner");
453        else if (Configuration.doAutoCreate())
454          this.assigner = new Reference(); // cc
455      return this.assigner;
456    }
457
458    public boolean hasAssigner() { 
459      return this.assigner != null && !this.assigner.isEmpty();
460    }
461
462    /**
463     * @param value {@link #assigner} (Organization that issued/manages the identifier.)
464     */
465    public Identifier setAssigner(Reference value) { 
466      this.assigner = value;
467      return this;
468    }
469
470      protected void listChildren(List<Property> children) {
471        super.listChildren(children);
472        children.add(new Property("use", "code", "The purpose of this identifier.", 0, 1, use));
473        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));
474        children.add(new Property("system", "uri", "Establishes the namespace for the value - that is, an absolute URL that describes a set values that are unique.", 0, 1, system));
475        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));
476        children.add(new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period));
477        children.add(new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, 1, assigner));
478      }
479
480      @Override
481      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
482        switch (_hash) {
483        case 116103: /*use*/  return new Property("use", "code", "The purpose of this identifier.", 0, 1, use);
484        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);
485        case -887328209: /*system*/  return new Property("system", "uri", "Establishes the namespace for the value - that is, an absolute URL that describes a set values that are unique.", 0, 1, system);
486        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);
487        case -991726143: /*period*/  return new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period);
488        case -369881636: /*assigner*/  return new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, 1, assigner);
489        default: return super.getNamedProperty(_hash, _name, _checkValid);
490        }
491
492      }
493
494      @Override
495      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
496        switch (hash) {
497        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<IdentifierUse>
498        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
499        case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType
500        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
501        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
502        case -369881636: /*assigner*/ return this.assigner == null ? new Base[0] : new Base[] {this.assigner}; // Reference
503        default: return super.getProperty(hash, name, checkValid);
504        }
505
506      }
507
508      @Override
509      public Base setProperty(int hash, String name, Base value) throws FHIRException {
510        switch (hash) {
511        case 116103: // use
512          value = new IdentifierUseEnumFactory().fromType(TypeConvertor.castToCode(value));
513          this.use = (Enumeration) value; // Enumeration<IdentifierUse>
514          return value;
515        case 3575610: // type
516          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
517          return value;
518        case -887328209: // system
519          this.system = TypeConvertor.castToUri(value); // UriType
520          return value;
521        case 111972721: // value
522          this.value = TypeConvertor.castToString(value); // StringType
523          return value;
524        case -991726143: // period
525          this.period = TypeConvertor.castToPeriod(value); // Period
526          return value;
527        case -369881636: // assigner
528          this.assigner = TypeConvertor.castToReference(value); // Reference
529          return value;
530        default: return super.setProperty(hash, name, value);
531        }
532
533      }
534
535      @Override
536      public Base setProperty(String name, Base value) throws FHIRException {
537        if (name.equals("use")) {
538          value = new IdentifierUseEnumFactory().fromType(TypeConvertor.castToCode(value));
539          this.use = (Enumeration) value; // Enumeration<IdentifierUse>
540        } else if (name.equals("type")) {
541          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
542        } else if (name.equals("system")) {
543          this.system = TypeConvertor.castToUri(value); // UriType
544        } else if (name.equals("value")) {
545          this.value = TypeConvertor.castToString(value); // StringType
546        } else if (name.equals("period")) {
547          this.period = TypeConvertor.castToPeriod(value); // Period
548        } else if (name.equals("assigner")) {
549          this.assigner = TypeConvertor.castToReference(value); // Reference
550        } else
551          return super.setProperty(name, value);
552        return value;
553      }
554
555      @Override
556      public Base makeProperty(int hash, String name) throws FHIRException {
557        switch (hash) {
558        case 116103:  return getUseElement();
559        case 3575610:  return getType();
560        case -887328209:  return getSystemElement();
561        case 111972721:  return getValueElement();
562        case -991726143:  return getPeriod();
563        case -369881636:  return getAssigner();
564        default: return super.makeProperty(hash, name);
565        }
566
567      }
568
569      @Override
570      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
571        switch (hash) {
572        case 116103: /*use*/ return new String[] {"code"};
573        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
574        case -887328209: /*system*/ return new String[] {"uri"};
575        case 111972721: /*value*/ return new String[] {"string"};
576        case -991726143: /*period*/ return new String[] {"Period"};
577        case -369881636: /*assigner*/ return new String[] {"Reference"};
578        default: return super.getTypesForProperty(hash, name);
579        }
580
581      }
582
583      @Override
584      public Base addChild(String name) throws FHIRException {
585        if (name.equals("use")) {
586          throw new FHIRException("Cannot call addChild on a singleton property Identifier.use");
587        }
588        else if (name.equals("type")) {
589          this.type = new CodeableConcept();
590          return this.type;
591        }
592        else if (name.equals("system")) {
593          throw new FHIRException("Cannot call addChild on a singleton property Identifier.system");
594        }
595        else if (name.equals("value")) {
596          throw new FHIRException("Cannot call addChild on a singleton property Identifier.value");
597        }
598        else if (name.equals("period")) {
599          this.period = new Period();
600          return this.period;
601        }
602        else if (name.equals("assigner")) {
603          this.assigner = new Reference();
604          return this.assigner;
605        }
606        else
607          return super.addChild(name);
608      }
609
610  public String fhirType() {
611    return "Identifier";
612
613  }
614
615      public Identifier copy() {
616        Identifier dst = new Identifier();
617        copyValues(dst);
618        return dst;
619      }
620
621      public void copyValues(Identifier dst) {
622        super.copyValues(dst);
623        dst.use = use == null ? null : use.copy();
624        dst.type = type == null ? null : type.copy();
625        dst.system = system == null ? null : system.copy();
626        dst.value = value == null ? null : value.copy();
627        dst.period = period == null ? null : period.copy();
628        dst.assigner = assigner == null ? null : assigner.copy();
629      }
630
631      protected Identifier typedCopy() {
632        return copy();
633      }
634
635      @Override
636      public boolean equalsDeep(Base other_) {
637        if (!super.equalsDeep(other_))
638          return false;
639        if (!(other_ instanceof Identifier))
640          return false;
641        Identifier o = (Identifier) other_;
642        return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(system, o.system, true)
643           && compareDeep(value, o.value, true) && compareDeep(period, o.period, true) && compareDeep(assigner, o.assigner, true)
644          ;
645      }
646
647      @Override
648      public boolean equalsShallow(Base other_) {
649        if (!super.equalsShallow(other_))
650          return false;
651        if (!(other_ instanceof Identifier))
652          return false;
653        Identifier o = (Identifier) other_;
654        return compareValues(use, o.use, true) && compareValues(system, o.system, true) && compareValues(value, o.value, true)
655          ;
656      }
657
658      public boolean isEmpty() {
659        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(use, type, system, value
660          , period, assigner);
661      }
662
663      public boolean matches(Identifier other) {
664        return hasSystem() && hasValue() && getSystem().matches(other.getSystem()) && getValue().matches(other.getValue());
665      }
666
667
668}
669