001package org.hl7.fhir.instance.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.List;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.api.ICompositeType;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.*;
040/**
041 * Details for all kinds of technology mediated contact points for a person or organization, including telephone, email, etc.
042 */
043@DatatypeDef(name="ContactPoint")
044public class ContactPoint extends Type implements ICompositeType {
045
046    public enum ContactPointSystem {
047        /**
048         * The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.
049         */
050        PHONE, 
051        /**
052         * The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.
053         */
054        FAX, 
055        /**
056         * The value is an email address.
057         */
058        EMAIL, 
059        /**
060         * The value is a pager number. These may be local pager numbers that are only usable on a particular pager system.
061         */
062        PAGER, 
063        /**
064         * A contact that is not a phone, fax, or email address. The format of the value SHOULD be a URL. This is intended for various personal contacts including blogs, Twitter, Facebook, etc. Do not use for email addresses. If this is not a URL, then it will require human interpretation.
065         */
066        OTHER, 
067        /**
068         * added to help the parsers
069         */
070        NULL;
071        public static ContactPointSystem fromCode(String codeString) throws FHIRException {
072            if (codeString == null || "".equals(codeString))
073                return null;
074        if ("phone".equals(codeString))
075          return PHONE;
076        if ("fax".equals(codeString))
077          return FAX;
078        if ("email".equals(codeString))
079          return EMAIL;
080        if ("pager".equals(codeString))
081          return PAGER;
082        if ("other".equals(codeString))
083          return OTHER;
084        throw new FHIRException("Unknown ContactPointSystem code '"+codeString+"'");
085        }
086        public String toCode() {
087          switch (this) {
088            case PHONE: return "phone";
089            case FAX: return "fax";
090            case EMAIL: return "email";
091            case PAGER: return "pager";
092            case OTHER: return "other";
093            default: return "?";
094          }
095        }
096        public String getSystem() {
097          switch (this) {
098            case PHONE: return "http://hl7.org/fhir/contact-point-system";
099            case FAX: return "http://hl7.org/fhir/contact-point-system";
100            case EMAIL: return "http://hl7.org/fhir/contact-point-system";
101            case PAGER: return "http://hl7.org/fhir/contact-point-system";
102            case OTHER: return "http://hl7.org/fhir/contact-point-system";
103            default: return "?";
104          }
105        }
106        public String getDefinition() {
107          switch (this) {
108            case PHONE: return "The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.";
109            case FAX: return "The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.";
110            case EMAIL: return "The value is an email address.";
111            case PAGER: return "The value is a pager number. These may be local pager numbers that are only usable on a particular pager system.";
112            case OTHER: return "A contact that is not a phone, fax, or email address. The format of the value SHOULD be a URL. This is intended for various personal contacts including blogs, Twitter, Facebook, etc. Do not use for email addresses. If this is not a URL, then it will require human interpretation.";
113            default: return "?";
114          }
115        }
116        public String getDisplay() {
117          switch (this) {
118            case PHONE: return "Phone";
119            case FAX: return "Fax";
120            case EMAIL: return "Email";
121            case PAGER: return "Pager";
122            case OTHER: return "URL";
123            default: return "?";
124          }
125        }
126    }
127
128  public static class ContactPointSystemEnumFactory implements EnumFactory<ContactPointSystem> {
129    public ContactPointSystem fromCode(String codeString) throws IllegalArgumentException {
130      if (codeString == null || "".equals(codeString))
131            if (codeString == null || "".equals(codeString))
132                return null;
133        if ("phone".equals(codeString))
134          return ContactPointSystem.PHONE;
135        if ("fax".equals(codeString))
136          return ContactPointSystem.FAX;
137        if ("email".equals(codeString))
138          return ContactPointSystem.EMAIL;
139        if ("pager".equals(codeString))
140          return ContactPointSystem.PAGER;
141        if ("other".equals(codeString))
142          return ContactPointSystem.OTHER;
143        throw new IllegalArgumentException("Unknown ContactPointSystem code '"+codeString+"'");
144        }
145        public Enumeration<ContactPointSystem> fromType(Base code) throws FHIRException {
146          if (code == null || code.isEmpty())
147            return null;
148          String codeString = ((PrimitiveType) code).asStringValue();
149          if (codeString == null || "".equals(codeString))
150            return null;
151        if ("phone".equals(codeString))
152          return new Enumeration<ContactPointSystem>(this, ContactPointSystem.PHONE);
153        if ("fax".equals(codeString))
154          return new Enumeration<ContactPointSystem>(this, ContactPointSystem.FAX);
155        if ("email".equals(codeString))
156          return new Enumeration<ContactPointSystem>(this, ContactPointSystem.EMAIL);
157        if ("pager".equals(codeString))
158          return new Enumeration<ContactPointSystem>(this, ContactPointSystem.PAGER);
159        if ("other".equals(codeString))
160          return new Enumeration<ContactPointSystem>(this, ContactPointSystem.OTHER);
161        throw new FHIRException("Unknown ContactPointSystem code '"+codeString+"'");
162        }
163    public String toCode(ContactPointSystem code) {
164      if (code == ContactPointSystem.PHONE)
165        return "phone";
166      if (code == ContactPointSystem.FAX)
167        return "fax";
168      if (code == ContactPointSystem.EMAIL)
169        return "email";
170      if (code == ContactPointSystem.PAGER)
171        return "pager";
172      if (code == ContactPointSystem.OTHER)
173        return "other";
174      return "?";
175      }
176    }
177
178    public enum ContactPointUse {
179        /**
180         * A communication contact point at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available.
181         */
182        HOME, 
183        /**
184         * An office contact point. First choice for business related contacts during business hours.
185         */
186        WORK, 
187        /**
188         * A temporary contact point. The period can provide more detailed information.
189         */
190        TEMP, 
191        /**
192         * This contact point is no longer in use (or was never correct, but retained for records).
193         */
194        OLD, 
195        /**
196         * A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business.
197         */
198        MOBILE, 
199        /**
200         * added to help the parsers
201         */
202        NULL;
203        public static ContactPointUse fromCode(String codeString) throws FHIRException {
204            if (codeString == null || "".equals(codeString))
205                return null;
206        if ("home".equals(codeString))
207          return HOME;
208        if ("work".equals(codeString))
209          return WORK;
210        if ("temp".equals(codeString))
211          return TEMP;
212        if ("old".equals(codeString))
213          return OLD;
214        if ("mobile".equals(codeString))
215          return MOBILE;
216        throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'");
217        }
218        public String toCode() {
219          switch (this) {
220            case HOME: return "home";
221            case WORK: return "work";
222            case TEMP: return "temp";
223            case OLD: return "old";
224            case MOBILE: return "mobile";
225            default: return "?";
226          }
227        }
228        public String getSystem() {
229          switch (this) {
230            case HOME: return "http://hl7.org/fhir/contact-point-use";
231            case WORK: return "http://hl7.org/fhir/contact-point-use";
232            case TEMP: return "http://hl7.org/fhir/contact-point-use";
233            case OLD: return "http://hl7.org/fhir/contact-point-use";
234            case MOBILE: return "http://hl7.org/fhir/contact-point-use";
235            default: return "?";
236          }
237        }
238        public String getDefinition() {
239          switch (this) {
240            case HOME: return "A communication contact point at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available.";
241            case WORK: return "An office contact point. First choice for business related contacts during business hours.";
242            case TEMP: return "A temporary contact point. The period can provide more detailed information.";
243            case OLD: return "This contact point is no longer in use (or was never correct, but retained for records).";
244            case MOBILE: return "A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business.";
245            default: return "?";
246          }
247        }
248        public String getDisplay() {
249          switch (this) {
250            case HOME: return "Home";
251            case WORK: return "Work";
252            case TEMP: return "Temp";
253            case OLD: return "Old";
254            case MOBILE: return "Mobile";
255            default: return "?";
256          }
257        }
258    }
259
260  public static class ContactPointUseEnumFactory implements EnumFactory<ContactPointUse> {
261    public ContactPointUse fromCode(String codeString) throws IllegalArgumentException {
262      if (codeString == null || "".equals(codeString))
263            if (codeString == null || "".equals(codeString))
264                return null;
265        if ("home".equals(codeString))
266          return ContactPointUse.HOME;
267        if ("work".equals(codeString))
268          return ContactPointUse.WORK;
269        if ("temp".equals(codeString))
270          return ContactPointUse.TEMP;
271        if ("old".equals(codeString))
272          return ContactPointUse.OLD;
273        if ("mobile".equals(codeString))
274          return ContactPointUse.MOBILE;
275        throw new IllegalArgumentException("Unknown ContactPointUse code '"+codeString+"'");
276        }
277        public Enumeration<ContactPointUse> fromType(Base code) throws FHIRException {
278          if (code == null || code.isEmpty())
279            return null;
280          String codeString = ((PrimitiveType) code).asStringValue();
281          if (codeString == null || "".equals(codeString))
282            return null;
283        if ("home".equals(codeString))
284          return new Enumeration<ContactPointUse>(this, ContactPointUse.HOME);
285        if ("work".equals(codeString))
286          return new Enumeration<ContactPointUse>(this, ContactPointUse.WORK);
287        if ("temp".equals(codeString))
288          return new Enumeration<ContactPointUse>(this, ContactPointUse.TEMP);
289        if ("old".equals(codeString))
290          return new Enumeration<ContactPointUse>(this, ContactPointUse.OLD);
291        if ("mobile".equals(codeString))
292          return new Enumeration<ContactPointUse>(this, ContactPointUse.MOBILE);
293        throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'");
294        }
295    public String toCode(ContactPointUse code) {
296      if (code == ContactPointUse.HOME)
297        return "home";
298      if (code == ContactPointUse.WORK)
299        return "work";
300      if (code == ContactPointUse.TEMP)
301        return "temp";
302      if (code == ContactPointUse.OLD)
303        return "old";
304      if (code == ContactPointUse.MOBILE)
305        return "mobile";
306      return "?";
307      }
308    }
309
310    /**
311     * Telecommunications form for contact point - what communications system is required to make use of the contact.
312     */
313    @Child(name = "system", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=true)
314    @Description(shortDefinition="phone | fax | email | pager | other", formalDefinition="Telecommunications form for contact point - what communications system is required to make use of the contact." )
315    protected Enumeration<ContactPointSystem> system;
316
317    /**
318     * The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).
319     */
320    @Child(name = "value", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
321    @Description(shortDefinition="The actual contact point details", formalDefinition="The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address)." )
322    protected StringType value;
323
324    /**
325     * Identifies the purpose for the contact point.
326     */
327    @Child(name = "use", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true)
328    @Description(shortDefinition="home | work | temp | old | mobile - purpose of this contact point", formalDefinition="Identifies the purpose for the contact point." )
329    protected Enumeration<ContactPointUse> use;
330
331    /**
332     * Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.
333     */
334    @Child(name = "rank", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=true)
335    @Description(shortDefinition="Specify preferred order of use (1 = highest)", formalDefinition="Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values." )
336    protected PositiveIntType rank;
337
338    /**
339     * Time period when the contact point was/is in use.
340     */
341    @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true)
342    @Description(shortDefinition="Time period when the contact point was/is in use", formalDefinition="Time period when the contact point was/is in use." )
343    protected Period period;
344
345    private static final long serialVersionUID = 1509610874L;
346
347  /*
348   * Constructor
349   */
350    public ContactPoint() {
351      super();
352    }
353
354    /**
355     * @return {@link #system} (Telecommunications form for contact point - what communications system is required to make use of the contact.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
356     */
357    public Enumeration<ContactPointSystem> getSystemElement() { 
358      if (this.system == null)
359        if (Configuration.errorOnAutoCreate())
360          throw new Error("Attempt to auto-create ContactPoint.system");
361        else if (Configuration.doAutoCreate())
362          this.system = new Enumeration<ContactPointSystem>(new ContactPointSystemEnumFactory()); // bb
363      return this.system;
364    }
365
366    public boolean hasSystemElement() { 
367      return this.system != null && !this.system.isEmpty();
368    }
369
370    public boolean hasSystem() { 
371      return this.system != null && !this.system.isEmpty();
372    }
373
374    /**
375     * @param value {@link #system} (Telecommunications form for contact point - what communications system is required to make use of the contact.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
376     */
377    public ContactPoint setSystemElement(Enumeration<ContactPointSystem> value) { 
378      this.system = value;
379      return this;
380    }
381
382    /**
383     * @return Telecommunications form for contact point - what communications system is required to make use of the contact.
384     */
385    public ContactPointSystem getSystem() { 
386      return this.system == null ? null : this.system.getValue();
387    }
388
389    /**
390     * @param value Telecommunications form for contact point - what communications system is required to make use of the contact.
391     */
392    public ContactPoint setSystem(ContactPointSystem value) { 
393      if (value == null)
394        this.system = null;
395      else {
396        if (this.system == null)
397          this.system = new Enumeration<ContactPointSystem>(new ContactPointSystemEnumFactory());
398        this.system.setValue(value);
399      }
400      return this;
401    }
402
403    /**
404     * @return {@link #value} (The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
405     */
406    public StringType getValueElement() { 
407      if (this.value == null)
408        if (Configuration.errorOnAutoCreate())
409          throw new Error("Attempt to auto-create ContactPoint.value");
410        else if (Configuration.doAutoCreate())
411          this.value = new StringType(); // bb
412      return this.value;
413    }
414
415    public boolean hasValueElement() { 
416      return this.value != null && !this.value.isEmpty();
417    }
418
419    public boolean hasValue() { 
420      return this.value != null && !this.value.isEmpty();
421    }
422
423    /**
424     * @param value {@link #value} (The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
425     */
426    public ContactPoint setValueElement(StringType value) { 
427      this.value = value;
428      return this;
429    }
430
431    /**
432     * @return The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).
433     */
434    public String getValue() { 
435      return this.value == null ? null : this.value.getValue();
436    }
437
438    /**
439     * @param value The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).
440     */
441    public ContactPoint setValue(String value) { 
442      if (Utilities.noString(value))
443        this.value = null;
444      else {
445        if (this.value == null)
446          this.value = new StringType();
447        this.value.setValue(value);
448      }
449      return this;
450    }
451
452    /**
453     * @return {@link #use} (Identifies the purpose for the contact point.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
454     */
455    public Enumeration<ContactPointUse> getUseElement() { 
456      if (this.use == null)
457        if (Configuration.errorOnAutoCreate())
458          throw new Error("Attempt to auto-create ContactPoint.use");
459        else if (Configuration.doAutoCreate())
460          this.use = new Enumeration<ContactPointUse>(new ContactPointUseEnumFactory()); // bb
461      return this.use;
462    }
463
464    public boolean hasUseElement() { 
465      return this.use != null && !this.use.isEmpty();
466    }
467
468    public boolean hasUse() { 
469      return this.use != null && !this.use.isEmpty();
470    }
471
472    /**
473     * @param value {@link #use} (Identifies the purpose for the contact point.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
474     */
475    public ContactPoint setUseElement(Enumeration<ContactPointUse> value) { 
476      this.use = value;
477      return this;
478    }
479
480    /**
481     * @return Identifies the purpose for the contact point.
482     */
483    public ContactPointUse getUse() { 
484      return this.use == null ? null : this.use.getValue();
485    }
486
487    /**
488     * @param value Identifies the purpose for the contact point.
489     */
490    public ContactPoint setUse(ContactPointUse value) { 
491      if (value == null)
492        this.use = null;
493      else {
494        if (this.use == null)
495          this.use = new Enumeration<ContactPointUse>(new ContactPointUseEnumFactory());
496        this.use.setValue(value);
497      }
498      return this;
499    }
500
501    /**
502     * @return {@link #rank} (Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value
503     */
504    public PositiveIntType getRankElement() { 
505      if (this.rank == null)
506        if (Configuration.errorOnAutoCreate())
507          throw new Error("Attempt to auto-create ContactPoint.rank");
508        else if (Configuration.doAutoCreate())
509          this.rank = new PositiveIntType(); // bb
510      return this.rank;
511    }
512
513    public boolean hasRankElement() { 
514      return this.rank != null && !this.rank.isEmpty();
515    }
516
517    public boolean hasRank() { 
518      return this.rank != null && !this.rank.isEmpty();
519    }
520
521    /**
522     * @param value {@link #rank} (Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value
523     */
524    public ContactPoint setRankElement(PositiveIntType value) { 
525      this.rank = value;
526      return this;
527    }
528
529    /**
530     * @return Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.
531     */
532    public int getRank() { 
533      return this.rank == null || this.rank.isEmpty() ? 0 : this.rank.getValue();
534    }
535
536    /**
537     * @param value Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.
538     */
539    public ContactPoint setRank(int value) { 
540        if (this.rank == null)
541          this.rank = new PositiveIntType();
542        this.rank.setValue(value);
543      return this;
544    }
545
546    /**
547     * @return {@link #period} (Time period when the contact point was/is in use.)
548     */
549    public Period getPeriod() { 
550      if (this.period == null)
551        if (Configuration.errorOnAutoCreate())
552          throw new Error("Attempt to auto-create ContactPoint.period");
553        else if (Configuration.doAutoCreate())
554          this.period = new Period(); // cc
555      return this.period;
556    }
557
558    public boolean hasPeriod() { 
559      return this.period != null && !this.period.isEmpty();
560    }
561
562    /**
563     * @param value {@link #period} (Time period when the contact point was/is in use.)
564     */
565    public ContactPoint setPeriod(Period value) { 
566      this.period = value;
567      return this;
568    }
569
570      protected void listChildren(List<Property> childrenList) {
571        super.listChildren(childrenList);
572        childrenList.add(new Property("system", "code", "Telecommunications form for contact point - what communications system is required to make use of the contact.", 0, java.lang.Integer.MAX_VALUE, system));
573        childrenList.add(new Property("value", "string", "The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).", 0, java.lang.Integer.MAX_VALUE, value));
574        childrenList.add(new Property("use", "code", "Identifies the purpose for the contact point.", 0, java.lang.Integer.MAX_VALUE, use));
575        childrenList.add(new Property("rank", "positiveInt", "Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.", 0, java.lang.Integer.MAX_VALUE, rank));
576        childrenList.add(new Property("period", "Period", "Time period when the contact point was/is in use.", 0, java.lang.Integer.MAX_VALUE, period));
577      }
578
579      @Override
580      public void setProperty(String name, Base value) throws FHIRException {
581        if (name.equals("system"))
582          this.system = new ContactPointSystemEnumFactory().fromType(value); // Enumeration<ContactPointSystem>
583        else if (name.equals("value"))
584          this.value = castToString(value); // StringType
585        else if (name.equals("use"))
586          this.use = new ContactPointUseEnumFactory().fromType(value); // Enumeration<ContactPointUse>
587        else if (name.equals("rank"))
588          this.rank = castToPositiveInt(value); // PositiveIntType
589        else if (name.equals("period"))
590          this.period = castToPeriod(value); // Period
591        else
592          super.setProperty(name, value);
593      }
594
595      @Override
596      public Base addChild(String name) throws FHIRException {
597        if (name.equals("system")) {
598          throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.system");
599        }
600        else if (name.equals("value")) {
601          throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.value");
602        }
603        else if (name.equals("use")) {
604          throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.use");
605        }
606        else if (name.equals("rank")) {
607          throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.rank");
608        }
609        else if (name.equals("period")) {
610          this.period = new Period();
611          return this.period;
612        }
613        else
614          return super.addChild(name);
615      }
616
617  public String fhirType() {
618    return "ContactPoint";
619
620  }
621
622      public ContactPoint copy() {
623        ContactPoint dst = new ContactPoint();
624        copyValues(dst);
625        dst.system = system == null ? null : system.copy();
626        dst.value = value == null ? null : value.copy();
627        dst.use = use == null ? null : use.copy();
628        dst.rank = rank == null ? null : rank.copy();
629        dst.period = period == null ? null : period.copy();
630        return dst;
631      }
632
633      protected ContactPoint typedCopy() {
634        return copy();
635      }
636
637      @Override
638      public boolean equalsDeep(Base other) {
639        if (!super.equalsDeep(other))
640          return false;
641        if (!(other instanceof ContactPoint))
642          return false;
643        ContactPoint o = (ContactPoint) other;
644        return compareDeep(system, o.system, true) && compareDeep(value, o.value, true) && compareDeep(use, o.use, true)
645           && compareDeep(rank, o.rank, true) && compareDeep(period, o.period, true);
646      }
647
648      @Override
649      public boolean equalsShallow(Base other) {
650        if (!super.equalsShallow(other))
651          return false;
652        if (!(other instanceof ContactPoint))
653          return false;
654        ContactPoint o = (ContactPoint) other;
655        return compareValues(system, o.system, true) && compareValues(value, o.value, true) && compareValues(use, o.use, true)
656           && compareValues(rank, o.rank, true);
657      }
658
659      public boolean isEmpty() {
660        return super.isEmpty() && (system == null || system.isEmpty()) && (value == null || value.isEmpty())
661           && (use == null || use.isEmpty()) && (rank == null || rank.isEmpty()) && (period == null || period.isEmpty())
662          ;
663      }
664
665
666}
667