001package org.hl7.fhir.dstu3.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 Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045import org.hl7.fhir.exceptions.FHIRFormatError;
046/**
047 * Financial instrument which may be used to reimburse or pay for health care products and services.
048 */
049@ResourceDef(name="Coverage", profile="http://hl7.org/fhir/StructureDefinition/Coverage")
050public class Coverage extends DomainResource {
051
052    public enum CoverageStatus {
053        /**
054         * The instance is currently in-force.
055         */
056        ACTIVE, 
057        /**
058         * The instance is withdrawn, rescinded or reversed.
059         */
060        CANCELLED, 
061        /**
062         * A new instance the contents of which is not complete.
063         */
064        DRAFT, 
065        /**
066         * The instance was entered in error.
067         */
068        ENTEREDINERROR, 
069        /**
070         * added to help the parsers with the generic types
071         */
072        NULL;
073        public static CoverageStatus fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("active".equals(codeString))
077          return ACTIVE;
078        if ("cancelled".equals(codeString))
079          return CANCELLED;
080        if ("draft".equals(codeString))
081          return DRAFT;
082        if ("entered-in-error".equals(codeString))
083          return ENTEREDINERROR;
084        if (Configuration.isAcceptInvalidEnums())
085          return null;
086        else
087          throw new FHIRException("Unknown CoverageStatus code '"+codeString+"'");
088        }
089        public String toCode() {
090          switch (this) {
091            case ACTIVE: return "active";
092            case CANCELLED: return "cancelled";
093            case DRAFT: return "draft";
094            case ENTEREDINERROR: return "entered-in-error";
095            default: return "?";
096          }
097        }
098        public String getSystem() {
099          switch (this) {
100            case ACTIVE: return "http://hl7.org/fhir/fm-status";
101            case CANCELLED: return "http://hl7.org/fhir/fm-status";
102            case DRAFT: return "http://hl7.org/fhir/fm-status";
103            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
104            default: return "?";
105          }
106        }
107        public String getDefinition() {
108          switch (this) {
109            case ACTIVE: return "The instance is currently in-force.";
110            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
111            case DRAFT: return "A new instance the contents of which is not complete.";
112            case ENTEREDINERROR: return "The instance was entered in error.";
113            default: return "?";
114          }
115        }
116        public String getDisplay() {
117          switch (this) {
118            case ACTIVE: return "Active";
119            case CANCELLED: return "Cancelled";
120            case DRAFT: return "Draft";
121            case ENTEREDINERROR: return "Entered in Error";
122            default: return "?";
123          }
124        }
125    }
126
127  public static class CoverageStatusEnumFactory implements EnumFactory<CoverageStatus> {
128    public CoverageStatus fromCode(String codeString) throws IllegalArgumentException {
129      if (codeString == null || "".equals(codeString))
130            if (codeString == null || "".equals(codeString))
131                return null;
132        if ("active".equals(codeString))
133          return CoverageStatus.ACTIVE;
134        if ("cancelled".equals(codeString))
135          return CoverageStatus.CANCELLED;
136        if ("draft".equals(codeString))
137          return CoverageStatus.DRAFT;
138        if ("entered-in-error".equals(codeString))
139          return CoverageStatus.ENTEREDINERROR;
140        throw new IllegalArgumentException("Unknown CoverageStatus code '"+codeString+"'");
141        }
142        public Enumeration<CoverageStatus> fromType(Base code) throws FHIRException {
143          if (code == null)
144            return null;
145          if (code.isEmpty())
146            return new Enumeration<CoverageStatus>(this);
147          String codeString = ((PrimitiveType) code).asStringValue();
148          if (codeString == null || "".equals(codeString))
149            return null;
150        if ("active".equals(codeString))
151          return new Enumeration<CoverageStatus>(this, CoverageStatus.ACTIVE);
152        if ("cancelled".equals(codeString))
153          return new Enumeration<CoverageStatus>(this, CoverageStatus.CANCELLED);
154        if ("draft".equals(codeString))
155          return new Enumeration<CoverageStatus>(this, CoverageStatus.DRAFT);
156        if ("entered-in-error".equals(codeString))
157          return new Enumeration<CoverageStatus>(this, CoverageStatus.ENTEREDINERROR);
158        throw new FHIRException("Unknown CoverageStatus code '"+codeString+"'");
159        }
160    public String toCode(CoverageStatus code) {
161      if (code == CoverageStatus.ACTIVE)
162        return "active";
163      if (code == CoverageStatus.CANCELLED)
164        return "cancelled";
165      if (code == CoverageStatus.DRAFT)
166        return "draft";
167      if (code == CoverageStatus.ENTEREDINERROR)
168        return "entered-in-error";
169      return "?";
170      }
171    public String toSystem(CoverageStatus code) {
172      return code.getSystem();
173      }
174    }
175
176    @Block()
177    public static class GroupComponent extends BackboneElement implements IBaseBackboneElement {
178        /**
179         * Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify an employer group. May also be referred to as a Policy or Group ID.
180         */
181        @Child(name = "group", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
182        @Description(shortDefinition="An identifier for the group", formalDefinition="Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify an employer group. May also be referred to as a Policy or Group ID." )
183        protected StringType group;
184
185        /**
186         * A short description for the group.
187         */
188        @Child(name = "groupDisplay", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
189        @Description(shortDefinition="Display text for an identifier for the group", formalDefinition="A short description for the group." )
190        protected StringType groupDisplay;
191
192        /**
193         * Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a subset of an employer group.
194         */
195        @Child(name = "subGroup", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
196        @Description(shortDefinition="An identifier for the subsection of the group", formalDefinition="Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a subset of an employer group." )
197        protected StringType subGroup;
198
199        /**
200         * A short description for the subgroup.
201         */
202        @Child(name = "subGroupDisplay", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
203        @Description(shortDefinition="Display text for the subsection of the group", formalDefinition="A short description for the subgroup." )
204        protected StringType subGroupDisplay;
205
206        /**
207         * Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a collection of benefits provided to employees. May be referred to as a Section or Division ID.
208         */
209        @Child(name = "plan", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
210        @Description(shortDefinition="An identifier for the plan", formalDefinition="Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a collection of benefits provided to employees. May be referred to as a Section or Division ID." )
211        protected StringType plan;
212
213        /**
214         * A short description for the plan.
215         */
216        @Child(name = "planDisplay", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
217        @Description(shortDefinition="Display text for the plan", formalDefinition="A short description for the plan." )
218        protected StringType planDisplay;
219
220        /**
221         * Identifies a sub-style or sub-collective of coverage issued by the underwriter, for example may be used to identify a subset of a collection of benefits provided to employees.
222         */
223        @Child(name = "subPlan", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
224        @Description(shortDefinition="An identifier for the subsection of the plan", formalDefinition="Identifies a sub-style or sub-collective of coverage issued by the underwriter, for example may be used to identify a subset of a collection of benefits provided to employees." )
225        protected StringType subPlan;
226
227        /**
228         * A short description for the subplan.
229         */
230        @Child(name = "subPlanDisplay", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
231        @Description(shortDefinition="Display text for the subsection of the plan", formalDefinition="A short description for the subplan." )
232        protected StringType subPlanDisplay;
233
234        /**
235         * Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage such as a level of deductables or co-payment.
236         */
237        @Child(name = "class", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
238        @Description(shortDefinition="An identifier for the class", formalDefinition="Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage such as a level of deductables or co-payment." )
239        protected StringType class_;
240
241        /**
242         * A short description for the class.
243         */
244        @Child(name = "classDisplay", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
245        @Description(shortDefinition="Display text for the class", formalDefinition="A short description for the class." )
246        protected StringType classDisplay;
247
248        /**
249         * Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a subclass of coverage such as a sub-level of deductables or co-payment.
250         */
251        @Child(name = "subClass", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=true)
252        @Description(shortDefinition="An identifier for the subsection of the class", formalDefinition="Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a subclass of coverage such as a sub-level of deductables or co-payment." )
253        protected StringType subClass;
254
255        /**
256         * A short description for the subclass.
257         */
258        @Child(name = "subClassDisplay", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=true)
259        @Description(shortDefinition="Display text for the subsection of the subclass", formalDefinition="A short description for the subclass." )
260        protected StringType subClassDisplay;
261
262        private static final long serialVersionUID = -13147121L;
263
264    /**
265     * Constructor
266     */
267      public GroupComponent() {
268        super();
269      }
270
271        /**
272         * @return {@link #group} (Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify an employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getGroup" gives direct access to the value
273         */
274        public StringType getGroupElement() { 
275          if (this.group == null)
276            if (Configuration.errorOnAutoCreate())
277              throw new Error("Attempt to auto-create GroupComponent.group");
278            else if (Configuration.doAutoCreate())
279              this.group = new StringType(); // bb
280          return this.group;
281        }
282
283        public boolean hasGroupElement() { 
284          return this.group != null && !this.group.isEmpty();
285        }
286
287        public boolean hasGroup() { 
288          return this.group != null && !this.group.isEmpty();
289        }
290
291        /**
292         * @param value {@link #group} (Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify an employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getGroup" gives direct access to the value
293         */
294        public GroupComponent setGroupElement(StringType value) { 
295          this.group = value;
296          return this;
297        }
298
299        /**
300         * @return Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify an employer group. May also be referred to as a Policy or Group ID.
301         */
302        public String getGroup() { 
303          return this.group == null ? null : this.group.getValue();
304        }
305
306        /**
307         * @param value Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify an employer group. May also be referred to as a Policy or Group ID.
308         */
309        public GroupComponent setGroup(String value) { 
310          if (Utilities.noString(value))
311            this.group = null;
312          else {
313            if (this.group == null)
314              this.group = new StringType();
315            this.group.setValue(value);
316          }
317          return this;
318        }
319
320        /**
321         * @return {@link #groupDisplay} (A short description for the group.). This is the underlying object with id, value and extensions. The accessor "getGroupDisplay" gives direct access to the value
322         */
323        public StringType getGroupDisplayElement() { 
324          if (this.groupDisplay == null)
325            if (Configuration.errorOnAutoCreate())
326              throw new Error("Attempt to auto-create GroupComponent.groupDisplay");
327            else if (Configuration.doAutoCreate())
328              this.groupDisplay = new StringType(); // bb
329          return this.groupDisplay;
330        }
331
332        public boolean hasGroupDisplayElement() { 
333          return this.groupDisplay != null && !this.groupDisplay.isEmpty();
334        }
335
336        public boolean hasGroupDisplay() { 
337          return this.groupDisplay != null && !this.groupDisplay.isEmpty();
338        }
339
340        /**
341         * @param value {@link #groupDisplay} (A short description for the group.). This is the underlying object with id, value and extensions. The accessor "getGroupDisplay" gives direct access to the value
342         */
343        public GroupComponent setGroupDisplayElement(StringType value) { 
344          this.groupDisplay = value;
345          return this;
346        }
347
348        /**
349         * @return A short description for the group.
350         */
351        public String getGroupDisplay() { 
352          return this.groupDisplay == null ? null : this.groupDisplay.getValue();
353        }
354
355        /**
356         * @param value A short description for the group.
357         */
358        public GroupComponent setGroupDisplay(String value) { 
359          if (Utilities.noString(value))
360            this.groupDisplay = null;
361          else {
362            if (this.groupDisplay == null)
363              this.groupDisplay = new StringType();
364            this.groupDisplay.setValue(value);
365          }
366          return this;
367        }
368
369        /**
370         * @return {@link #subGroup} (Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a subset of an employer group.). This is the underlying object with id, value and extensions. The accessor "getSubGroup" gives direct access to the value
371         */
372        public StringType getSubGroupElement() { 
373          if (this.subGroup == null)
374            if (Configuration.errorOnAutoCreate())
375              throw new Error("Attempt to auto-create GroupComponent.subGroup");
376            else if (Configuration.doAutoCreate())
377              this.subGroup = new StringType(); // bb
378          return this.subGroup;
379        }
380
381        public boolean hasSubGroupElement() { 
382          return this.subGroup != null && !this.subGroup.isEmpty();
383        }
384
385        public boolean hasSubGroup() { 
386          return this.subGroup != null && !this.subGroup.isEmpty();
387        }
388
389        /**
390         * @param value {@link #subGroup} (Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a subset of an employer group.). This is the underlying object with id, value and extensions. The accessor "getSubGroup" gives direct access to the value
391         */
392        public GroupComponent setSubGroupElement(StringType value) { 
393          this.subGroup = value;
394          return this;
395        }
396
397        /**
398         * @return Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a subset of an employer group.
399         */
400        public String getSubGroup() { 
401          return this.subGroup == null ? null : this.subGroup.getValue();
402        }
403
404        /**
405         * @param value Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a subset of an employer group.
406         */
407        public GroupComponent setSubGroup(String value) { 
408          if (Utilities.noString(value))
409            this.subGroup = null;
410          else {
411            if (this.subGroup == null)
412              this.subGroup = new StringType();
413            this.subGroup.setValue(value);
414          }
415          return this;
416        }
417
418        /**
419         * @return {@link #subGroupDisplay} (A short description for the subgroup.). This is the underlying object with id, value and extensions. The accessor "getSubGroupDisplay" gives direct access to the value
420         */
421        public StringType getSubGroupDisplayElement() { 
422          if (this.subGroupDisplay == null)
423            if (Configuration.errorOnAutoCreate())
424              throw new Error("Attempt to auto-create GroupComponent.subGroupDisplay");
425            else if (Configuration.doAutoCreate())
426              this.subGroupDisplay = new StringType(); // bb
427          return this.subGroupDisplay;
428        }
429
430        public boolean hasSubGroupDisplayElement() { 
431          return this.subGroupDisplay != null && !this.subGroupDisplay.isEmpty();
432        }
433
434        public boolean hasSubGroupDisplay() { 
435          return this.subGroupDisplay != null && !this.subGroupDisplay.isEmpty();
436        }
437
438        /**
439         * @param value {@link #subGroupDisplay} (A short description for the subgroup.). This is the underlying object with id, value and extensions. The accessor "getSubGroupDisplay" gives direct access to the value
440         */
441        public GroupComponent setSubGroupDisplayElement(StringType value) { 
442          this.subGroupDisplay = value;
443          return this;
444        }
445
446        /**
447         * @return A short description for the subgroup.
448         */
449        public String getSubGroupDisplay() { 
450          return this.subGroupDisplay == null ? null : this.subGroupDisplay.getValue();
451        }
452
453        /**
454         * @param value A short description for the subgroup.
455         */
456        public GroupComponent setSubGroupDisplay(String value) { 
457          if (Utilities.noString(value))
458            this.subGroupDisplay = null;
459          else {
460            if (this.subGroupDisplay == null)
461              this.subGroupDisplay = new StringType();
462            this.subGroupDisplay.setValue(value);
463          }
464          return this;
465        }
466
467        /**
468         * @return {@link #plan} (Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a collection of benefits provided to employees. May be referred to as a Section or Division ID.). This is the underlying object with id, value and extensions. The accessor "getPlan" gives direct access to the value
469         */
470        public StringType getPlanElement() { 
471          if (this.plan == null)
472            if (Configuration.errorOnAutoCreate())
473              throw new Error("Attempt to auto-create GroupComponent.plan");
474            else if (Configuration.doAutoCreate())
475              this.plan = new StringType(); // bb
476          return this.plan;
477        }
478
479        public boolean hasPlanElement() { 
480          return this.plan != null && !this.plan.isEmpty();
481        }
482
483        public boolean hasPlan() { 
484          return this.plan != null && !this.plan.isEmpty();
485        }
486
487        /**
488         * @param value {@link #plan} (Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a collection of benefits provided to employees. May be referred to as a Section or Division ID.). This is the underlying object with id, value and extensions. The accessor "getPlan" gives direct access to the value
489         */
490        public GroupComponent setPlanElement(StringType value) { 
491          this.plan = value;
492          return this;
493        }
494
495        /**
496         * @return Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a collection of benefits provided to employees. May be referred to as a Section or Division ID.
497         */
498        public String getPlan() { 
499          return this.plan == null ? null : this.plan.getValue();
500        }
501
502        /**
503         * @param value Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a collection of benefits provided to employees. May be referred to as a Section or Division ID.
504         */
505        public GroupComponent setPlan(String value) { 
506          if (Utilities.noString(value))
507            this.plan = null;
508          else {
509            if (this.plan == null)
510              this.plan = new StringType();
511            this.plan.setValue(value);
512          }
513          return this;
514        }
515
516        /**
517         * @return {@link #planDisplay} (A short description for the plan.). This is the underlying object with id, value and extensions. The accessor "getPlanDisplay" gives direct access to the value
518         */
519        public StringType getPlanDisplayElement() { 
520          if (this.planDisplay == null)
521            if (Configuration.errorOnAutoCreate())
522              throw new Error("Attempt to auto-create GroupComponent.planDisplay");
523            else if (Configuration.doAutoCreate())
524              this.planDisplay = new StringType(); // bb
525          return this.planDisplay;
526        }
527
528        public boolean hasPlanDisplayElement() { 
529          return this.planDisplay != null && !this.planDisplay.isEmpty();
530        }
531
532        public boolean hasPlanDisplay() { 
533          return this.planDisplay != null && !this.planDisplay.isEmpty();
534        }
535
536        /**
537         * @param value {@link #planDisplay} (A short description for the plan.). This is the underlying object with id, value and extensions. The accessor "getPlanDisplay" gives direct access to the value
538         */
539        public GroupComponent setPlanDisplayElement(StringType value) { 
540          this.planDisplay = value;
541          return this;
542        }
543
544        /**
545         * @return A short description for the plan.
546         */
547        public String getPlanDisplay() { 
548          return this.planDisplay == null ? null : this.planDisplay.getValue();
549        }
550
551        /**
552         * @param value A short description for the plan.
553         */
554        public GroupComponent setPlanDisplay(String value) { 
555          if (Utilities.noString(value))
556            this.planDisplay = null;
557          else {
558            if (this.planDisplay == null)
559              this.planDisplay = new StringType();
560            this.planDisplay.setValue(value);
561          }
562          return this;
563        }
564
565        /**
566         * @return {@link #subPlan} (Identifies a sub-style or sub-collective of coverage issued by the underwriter, for example may be used to identify a subset of a collection of benefits provided to employees.). This is the underlying object with id, value and extensions. The accessor "getSubPlan" gives direct access to the value
567         */
568        public StringType getSubPlanElement() { 
569          if (this.subPlan == null)
570            if (Configuration.errorOnAutoCreate())
571              throw new Error("Attempt to auto-create GroupComponent.subPlan");
572            else if (Configuration.doAutoCreate())
573              this.subPlan = new StringType(); // bb
574          return this.subPlan;
575        }
576
577        public boolean hasSubPlanElement() { 
578          return this.subPlan != null && !this.subPlan.isEmpty();
579        }
580
581        public boolean hasSubPlan() { 
582          return this.subPlan != null && !this.subPlan.isEmpty();
583        }
584
585        /**
586         * @param value {@link #subPlan} (Identifies a sub-style or sub-collective of coverage issued by the underwriter, for example may be used to identify a subset of a collection of benefits provided to employees.). This is the underlying object with id, value and extensions. The accessor "getSubPlan" gives direct access to the value
587         */
588        public GroupComponent setSubPlanElement(StringType value) { 
589          this.subPlan = value;
590          return this;
591        }
592
593        /**
594         * @return Identifies a sub-style or sub-collective of coverage issued by the underwriter, for example may be used to identify a subset of a collection of benefits provided to employees.
595         */
596        public String getSubPlan() { 
597          return this.subPlan == null ? null : this.subPlan.getValue();
598        }
599
600        /**
601         * @param value Identifies a sub-style or sub-collective of coverage issued by the underwriter, for example may be used to identify a subset of a collection of benefits provided to employees.
602         */
603        public GroupComponent setSubPlan(String value) { 
604          if (Utilities.noString(value))
605            this.subPlan = null;
606          else {
607            if (this.subPlan == null)
608              this.subPlan = new StringType();
609            this.subPlan.setValue(value);
610          }
611          return this;
612        }
613
614        /**
615         * @return {@link #subPlanDisplay} (A short description for the subplan.). This is the underlying object with id, value and extensions. The accessor "getSubPlanDisplay" gives direct access to the value
616         */
617        public StringType getSubPlanDisplayElement() { 
618          if (this.subPlanDisplay == null)
619            if (Configuration.errorOnAutoCreate())
620              throw new Error("Attempt to auto-create GroupComponent.subPlanDisplay");
621            else if (Configuration.doAutoCreate())
622              this.subPlanDisplay = new StringType(); // bb
623          return this.subPlanDisplay;
624        }
625
626        public boolean hasSubPlanDisplayElement() { 
627          return this.subPlanDisplay != null && !this.subPlanDisplay.isEmpty();
628        }
629
630        public boolean hasSubPlanDisplay() { 
631          return this.subPlanDisplay != null && !this.subPlanDisplay.isEmpty();
632        }
633
634        /**
635         * @param value {@link #subPlanDisplay} (A short description for the subplan.). This is the underlying object with id, value and extensions. The accessor "getSubPlanDisplay" gives direct access to the value
636         */
637        public GroupComponent setSubPlanDisplayElement(StringType value) { 
638          this.subPlanDisplay = value;
639          return this;
640        }
641
642        /**
643         * @return A short description for the subplan.
644         */
645        public String getSubPlanDisplay() { 
646          return this.subPlanDisplay == null ? null : this.subPlanDisplay.getValue();
647        }
648
649        /**
650         * @param value A short description for the subplan.
651         */
652        public GroupComponent setSubPlanDisplay(String value) { 
653          if (Utilities.noString(value))
654            this.subPlanDisplay = null;
655          else {
656            if (this.subPlanDisplay == null)
657              this.subPlanDisplay = new StringType();
658            this.subPlanDisplay.setValue(value);
659          }
660          return this;
661        }
662
663        /**
664         * @return {@link #class_} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage such as a level of deductables or co-payment.). This is the underlying object with id, value and extensions. The accessor "getClass_" gives direct access to the value
665         */
666        public StringType getClass_Element() { 
667          if (this.class_ == null)
668            if (Configuration.errorOnAutoCreate())
669              throw new Error("Attempt to auto-create GroupComponent.class_");
670            else if (Configuration.doAutoCreate())
671              this.class_ = new StringType(); // bb
672          return this.class_;
673        }
674
675        public boolean hasClass_Element() { 
676          return this.class_ != null && !this.class_.isEmpty();
677        }
678
679        public boolean hasClass_() { 
680          return this.class_ != null && !this.class_.isEmpty();
681        }
682
683        /**
684         * @param value {@link #class_} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage such as a level of deductables or co-payment.). This is the underlying object with id, value and extensions. The accessor "getClass_" gives direct access to the value
685         */
686        public GroupComponent setClass_Element(StringType value) { 
687          this.class_ = value;
688          return this;
689        }
690
691        /**
692         * @return Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage such as a level of deductables or co-payment.
693         */
694        public String getClass_() { 
695          return this.class_ == null ? null : this.class_.getValue();
696        }
697
698        /**
699         * @param value Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage such as a level of deductables or co-payment.
700         */
701        public GroupComponent setClass_(String value) { 
702          if (Utilities.noString(value))
703            this.class_ = null;
704          else {
705            if (this.class_ == null)
706              this.class_ = new StringType();
707            this.class_.setValue(value);
708          }
709          return this;
710        }
711
712        /**
713         * @return {@link #classDisplay} (A short description for the class.). This is the underlying object with id, value and extensions. The accessor "getClassDisplay" gives direct access to the value
714         */
715        public StringType getClassDisplayElement() { 
716          if (this.classDisplay == null)
717            if (Configuration.errorOnAutoCreate())
718              throw new Error("Attempt to auto-create GroupComponent.classDisplay");
719            else if (Configuration.doAutoCreate())
720              this.classDisplay = new StringType(); // bb
721          return this.classDisplay;
722        }
723
724        public boolean hasClassDisplayElement() { 
725          return this.classDisplay != null && !this.classDisplay.isEmpty();
726        }
727
728        public boolean hasClassDisplay() { 
729          return this.classDisplay != null && !this.classDisplay.isEmpty();
730        }
731
732        /**
733         * @param value {@link #classDisplay} (A short description for the class.). This is the underlying object with id, value and extensions. The accessor "getClassDisplay" gives direct access to the value
734         */
735        public GroupComponent setClassDisplayElement(StringType value) { 
736          this.classDisplay = value;
737          return this;
738        }
739
740        /**
741         * @return A short description for the class.
742         */
743        public String getClassDisplay() { 
744          return this.classDisplay == null ? null : this.classDisplay.getValue();
745        }
746
747        /**
748         * @param value A short description for the class.
749         */
750        public GroupComponent setClassDisplay(String value) { 
751          if (Utilities.noString(value))
752            this.classDisplay = null;
753          else {
754            if (this.classDisplay == null)
755              this.classDisplay = new StringType();
756            this.classDisplay.setValue(value);
757          }
758          return this;
759        }
760
761        /**
762         * @return {@link #subClass} (Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a subclass of coverage such as a sub-level of deductables or co-payment.). This is the underlying object with id, value and extensions. The accessor "getSubClass" gives direct access to the value
763         */
764        public StringType getSubClassElement() { 
765          if (this.subClass == null)
766            if (Configuration.errorOnAutoCreate())
767              throw new Error("Attempt to auto-create GroupComponent.subClass");
768            else if (Configuration.doAutoCreate())
769              this.subClass = new StringType(); // bb
770          return this.subClass;
771        }
772
773        public boolean hasSubClassElement() { 
774          return this.subClass != null && !this.subClass.isEmpty();
775        }
776
777        public boolean hasSubClass() { 
778          return this.subClass != null && !this.subClass.isEmpty();
779        }
780
781        /**
782         * @param value {@link #subClass} (Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a subclass of coverage such as a sub-level of deductables or co-payment.). This is the underlying object with id, value and extensions. The accessor "getSubClass" gives direct access to the value
783         */
784        public GroupComponent setSubClassElement(StringType value) { 
785          this.subClass = value;
786          return this;
787        }
788
789        /**
790         * @return Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a subclass of coverage such as a sub-level of deductables or co-payment.
791         */
792        public String getSubClass() { 
793          return this.subClass == null ? null : this.subClass.getValue();
794        }
795
796        /**
797         * @param value Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a subclass of coverage such as a sub-level of deductables or co-payment.
798         */
799        public GroupComponent setSubClass(String value) { 
800          if (Utilities.noString(value))
801            this.subClass = null;
802          else {
803            if (this.subClass == null)
804              this.subClass = new StringType();
805            this.subClass.setValue(value);
806          }
807          return this;
808        }
809
810        /**
811         * @return {@link #subClassDisplay} (A short description for the subclass.). This is the underlying object with id, value and extensions. The accessor "getSubClassDisplay" gives direct access to the value
812         */
813        public StringType getSubClassDisplayElement() { 
814          if (this.subClassDisplay == null)
815            if (Configuration.errorOnAutoCreate())
816              throw new Error("Attempt to auto-create GroupComponent.subClassDisplay");
817            else if (Configuration.doAutoCreate())
818              this.subClassDisplay = new StringType(); // bb
819          return this.subClassDisplay;
820        }
821
822        public boolean hasSubClassDisplayElement() { 
823          return this.subClassDisplay != null && !this.subClassDisplay.isEmpty();
824        }
825
826        public boolean hasSubClassDisplay() { 
827          return this.subClassDisplay != null && !this.subClassDisplay.isEmpty();
828        }
829
830        /**
831         * @param value {@link #subClassDisplay} (A short description for the subclass.). This is the underlying object with id, value and extensions. The accessor "getSubClassDisplay" gives direct access to the value
832         */
833        public GroupComponent setSubClassDisplayElement(StringType value) { 
834          this.subClassDisplay = value;
835          return this;
836        }
837
838        /**
839         * @return A short description for the subclass.
840         */
841        public String getSubClassDisplay() { 
842          return this.subClassDisplay == null ? null : this.subClassDisplay.getValue();
843        }
844
845        /**
846         * @param value A short description for the subclass.
847         */
848        public GroupComponent setSubClassDisplay(String value) { 
849          if (Utilities.noString(value))
850            this.subClassDisplay = null;
851          else {
852            if (this.subClassDisplay == null)
853              this.subClassDisplay = new StringType();
854            this.subClassDisplay.setValue(value);
855          }
856          return this;
857        }
858
859        protected void listChildren(List<Property> children) {
860          super.listChildren(children);
861          children.add(new Property("group", "string", "Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify an employer group. May also be referred to as a Policy or Group ID.", 0, 1, group));
862          children.add(new Property("groupDisplay", "string", "A short description for the group.", 0, 1, groupDisplay));
863          children.add(new Property("subGroup", "string", "Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a subset of an employer group.", 0, 1, subGroup));
864          children.add(new Property("subGroupDisplay", "string", "A short description for the subgroup.", 0, 1, subGroupDisplay));
865          children.add(new Property("plan", "string", "Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a collection of benefits provided to employees. May be referred to as a Section or Division ID.", 0, 1, plan));
866          children.add(new Property("planDisplay", "string", "A short description for the plan.", 0, 1, planDisplay));
867          children.add(new Property("subPlan", "string", "Identifies a sub-style or sub-collective of coverage issued by the underwriter, for example may be used to identify a subset of a collection of benefits provided to employees.", 0, 1, subPlan));
868          children.add(new Property("subPlanDisplay", "string", "A short description for the subplan.", 0, 1, subPlanDisplay));
869          children.add(new Property("class", "string", "Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage such as a level of deductables or co-payment.", 0, 1, class_));
870          children.add(new Property("classDisplay", "string", "A short description for the class.", 0, 1, classDisplay));
871          children.add(new Property("subClass", "string", "Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a subclass of coverage such as a sub-level of deductables or co-payment.", 0, 1, subClass));
872          children.add(new Property("subClassDisplay", "string", "A short description for the subclass.", 0, 1, subClassDisplay));
873        }
874
875        @Override
876        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
877          switch (_hash) {
878          case 98629247: /*group*/  return new Property("group", "string", "Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify an employer group. May also be referred to as a Policy or Group ID.", 0, 1, group);
879          case 1322335555: /*groupDisplay*/  return new Property("groupDisplay", "string", "A short description for the group.", 0, 1, groupDisplay);
880          case -2101792737: /*subGroup*/  return new Property("subGroup", "string", "Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a subset of an employer group.", 0, 1, subGroup);
881          case 1051914147: /*subGroupDisplay*/  return new Property("subGroupDisplay", "string", "A short description for the subgroup.", 0, 1, subGroupDisplay);
882          case 3443497: /*plan*/  return new Property("plan", "string", "Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a collection of benefits provided to employees. May be referred to as a Section or Division ID.", 0, 1, plan);
883          case -896076455: /*planDisplay*/  return new Property("planDisplay", "string", "A short description for the plan.", 0, 1, planDisplay);
884          case -1868653175: /*subPlan*/  return new Property("subPlan", "string", "Identifies a sub-style or sub-collective of coverage issued by the underwriter, for example may be used to identify a subset of a collection of benefits provided to employees.", 0, 1, subPlan);
885          case -1736083719: /*subPlanDisplay*/  return new Property("subPlanDisplay", "string", "A short description for the subplan.", 0, 1, subPlanDisplay);
886          case 94742904: /*class*/  return new Property("class", "string", "Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage such as a level of deductables or co-payment.", 0, 1, class_);
887          case 1707405354: /*classDisplay*/  return new Property("classDisplay", "string", "A short description for the class.", 0, 1, classDisplay);
888          case -2105679080: /*subClass*/  return new Property("subClass", "string", "Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a subclass of coverage such as a sub-level of deductables or co-payment.", 0, 1, subClass);
889          case 1436983946: /*subClassDisplay*/  return new Property("subClassDisplay", "string", "A short description for the subclass.", 0, 1, subClassDisplay);
890          default: return super.getNamedProperty(_hash, _name, _checkValid);
891          }
892
893        }
894
895      @Override
896      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
897        switch (hash) {
898        case 98629247: /*group*/ return this.group == null ? new Base[0] : new Base[] {this.group}; // StringType
899        case 1322335555: /*groupDisplay*/ return this.groupDisplay == null ? new Base[0] : new Base[] {this.groupDisplay}; // StringType
900        case -2101792737: /*subGroup*/ return this.subGroup == null ? new Base[0] : new Base[] {this.subGroup}; // StringType
901        case 1051914147: /*subGroupDisplay*/ return this.subGroupDisplay == null ? new Base[0] : new Base[] {this.subGroupDisplay}; // StringType
902        case 3443497: /*plan*/ return this.plan == null ? new Base[0] : new Base[] {this.plan}; // StringType
903        case -896076455: /*planDisplay*/ return this.planDisplay == null ? new Base[0] : new Base[] {this.planDisplay}; // StringType
904        case -1868653175: /*subPlan*/ return this.subPlan == null ? new Base[0] : new Base[] {this.subPlan}; // StringType
905        case -1736083719: /*subPlanDisplay*/ return this.subPlanDisplay == null ? new Base[0] : new Base[] {this.subPlanDisplay}; // StringType
906        case 94742904: /*class*/ return this.class_ == null ? new Base[0] : new Base[] {this.class_}; // StringType
907        case 1707405354: /*classDisplay*/ return this.classDisplay == null ? new Base[0] : new Base[] {this.classDisplay}; // StringType
908        case -2105679080: /*subClass*/ return this.subClass == null ? new Base[0] : new Base[] {this.subClass}; // StringType
909        case 1436983946: /*subClassDisplay*/ return this.subClassDisplay == null ? new Base[0] : new Base[] {this.subClassDisplay}; // StringType
910        default: return super.getProperty(hash, name, checkValid);
911        }
912
913      }
914
915      @Override
916      public Base setProperty(int hash, String name, Base value) throws FHIRException {
917        switch (hash) {
918        case 98629247: // group
919          this.group = castToString(value); // StringType
920          return value;
921        case 1322335555: // groupDisplay
922          this.groupDisplay = castToString(value); // StringType
923          return value;
924        case -2101792737: // subGroup
925          this.subGroup = castToString(value); // StringType
926          return value;
927        case 1051914147: // subGroupDisplay
928          this.subGroupDisplay = castToString(value); // StringType
929          return value;
930        case 3443497: // plan
931          this.plan = castToString(value); // StringType
932          return value;
933        case -896076455: // planDisplay
934          this.planDisplay = castToString(value); // StringType
935          return value;
936        case -1868653175: // subPlan
937          this.subPlan = castToString(value); // StringType
938          return value;
939        case -1736083719: // subPlanDisplay
940          this.subPlanDisplay = castToString(value); // StringType
941          return value;
942        case 94742904: // class
943          this.class_ = castToString(value); // StringType
944          return value;
945        case 1707405354: // classDisplay
946          this.classDisplay = castToString(value); // StringType
947          return value;
948        case -2105679080: // subClass
949          this.subClass = castToString(value); // StringType
950          return value;
951        case 1436983946: // subClassDisplay
952          this.subClassDisplay = castToString(value); // StringType
953          return value;
954        default: return super.setProperty(hash, name, value);
955        }
956
957      }
958
959      @Override
960      public Base setProperty(String name, Base value) throws FHIRException {
961        if (name.equals("group")) {
962          this.group = castToString(value); // StringType
963        } else if (name.equals("groupDisplay")) {
964          this.groupDisplay = castToString(value); // StringType
965        } else if (name.equals("subGroup")) {
966          this.subGroup = castToString(value); // StringType
967        } else if (name.equals("subGroupDisplay")) {
968          this.subGroupDisplay = castToString(value); // StringType
969        } else if (name.equals("plan")) {
970          this.plan = castToString(value); // StringType
971        } else if (name.equals("planDisplay")) {
972          this.planDisplay = castToString(value); // StringType
973        } else if (name.equals("subPlan")) {
974          this.subPlan = castToString(value); // StringType
975        } else if (name.equals("subPlanDisplay")) {
976          this.subPlanDisplay = castToString(value); // StringType
977        } else if (name.equals("class")) {
978          this.class_ = castToString(value); // StringType
979        } else if (name.equals("classDisplay")) {
980          this.classDisplay = castToString(value); // StringType
981        } else if (name.equals("subClass")) {
982          this.subClass = castToString(value); // StringType
983        } else if (name.equals("subClassDisplay")) {
984          this.subClassDisplay = castToString(value); // StringType
985        } else
986          return super.setProperty(name, value);
987        return value;
988      }
989
990      @Override
991      public Base makeProperty(int hash, String name) throws FHIRException {
992        switch (hash) {
993        case 98629247:  return getGroupElement();
994        case 1322335555:  return getGroupDisplayElement();
995        case -2101792737:  return getSubGroupElement();
996        case 1051914147:  return getSubGroupDisplayElement();
997        case 3443497:  return getPlanElement();
998        case -896076455:  return getPlanDisplayElement();
999        case -1868653175:  return getSubPlanElement();
1000        case -1736083719:  return getSubPlanDisplayElement();
1001        case 94742904:  return getClass_Element();
1002        case 1707405354:  return getClassDisplayElement();
1003        case -2105679080:  return getSubClassElement();
1004        case 1436983946:  return getSubClassDisplayElement();
1005        default: return super.makeProperty(hash, name);
1006        }
1007
1008      }
1009
1010      @Override
1011      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1012        switch (hash) {
1013        case 98629247: /*group*/ return new String[] {"string"};
1014        case 1322335555: /*groupDisplay*/ return new String[] {"string"};
1015        case -2101792737: /*subGroup*/ return new String[] {"string"};
1016        case 1051914147: /*subGroupDisplay*/ return new String[] {"string"};
1017        case 3443497: /*plan*/ return new String[] {"string"};
1018        case -896076455: /*planDisplay*/ return new String[] {"string"};
1019        case -1868653175: /*subPlan*/ return new String[] {"string"};
1020        case -1736083719: /*subPlanDisplay*/ return new String[] {"string"};
1021        case 94742904: /*class*/ return new String[] {"string"};
1022        case 1707405354: /*classDisplay*/ return new String[] {"string"};
1023        case -2105679080: /*subClass*/ return new String[] {"string"};
1024        case 1436983946: /*subClassDisplay*/ return new String[] {"string"};
1025        default: return super.getTypesForProperty(hash, name);
1026        }
1027
1028      }
1029
1030      @Override
1031      public Base addChild(String name) throws FHIRException {
1032        if (name.equals("group")) {
1033          throw new FHIRException("Cannot call addChild on a primitive type Coverage.group");
1034        }
1035        else if (name.equals("groupDisplay")) {
1036          throw new FHIRException("Cannot call addChild on a primitive type Coverage.groupDisplay");
1037        }
1038        else if (name.equals("subGroup")) {
1039          throw new FHIRException("Cannot call addChild on a primitive type Coverage.subGroup");
1040        }
1041        else if (name.equals("subGroupDisplay")) {
1042          throw new FHIRException("Cannot call addChild on a primitive type Coverage.subGroupDisplay");
1043        }
1044        else if (name.equals("plan")) {
1045          throw new FHIRException("Cannot call addChild on a primitive type Coverage.plan");
1046        }
1047        else if (name.equals("planDisplay")) {
1048          throw new FHIRException("Cannot call addChild on a primitive type Coverage.planDisplay");
1049        }
1050        else if (name.equals("subPlan")) {
1051          throw new FHIRException("Cannot call addChild on a primitive type Coverage.subPlan");
1052        }
1053        else if (name.equals("subPlanDisplay")) {
1054          throw new FHIRException("Cannot call addChild on a primitive type Coverage.subPlanDisplay");
1055        }
1056        else if (name.equals("class")) {
1057          throw new FHIRException("Cannot call addChild on a primitive type Coverage.class");
1058        }
1059        else if (name.equals("classDisplay")) {
1060          throw new FHIRException("Cannot call addChild on a primitive type Coverage.classDisplay");
1061        }
1062        else if (name.equals("subClass")) {
1063          throw new FHIRException("Cannot call addChild on a primitive type Coverage.subClass");
1064        }
1065        else if (name.equals("subClassDisplay")) {
1066          throw new FHIRException("Cannot call addChild on a primitive type Coverage.subClassDisplay");
1067        }
1068        else
1069          return super.addChild(name);
1070      }
1071
1072      public GroupComponent copy() {
1073        GroupComponent dst = new GroupComponent();
1074        copyValues(dst);
1075        dst.group = group == null ? null : group.copy();
1076        dst.groupDisplay = groupDisplay == null ? null : groupDisplay.copy();
1077        dst.subGroup = subGroup == null ? null : subGroup.copy();
1078        dst.subGroupDisplay = subGroupDisplay == null ? null : subGroupDisplay.copy();
1079        dst.plan = plan == null ? null : plan.copy();
1080        dst.planDisplay = planDisplay == null ? null : planDisplay.copy();
1081        dst.subPlan = subPlan == null ? null : subPlan.copy();
1082        dst.subPlanDisplay = subPlanDisplay == null ? null : subPlanDisplay.copy();
1083        dst.class_ = class_ == null ? null : class_.copy();
1084        dst.classDisplay = classDisplay == null ? null : classDisplay.copy();
1085        dst.subClass = subClass == null ? null : subClass.copy();
1086        dst.subClassDisplay = subClassDisplay == null ? null : subClassDisplay.copy();
1087        return dst;
1088      }
1089
1090      @Override
1091      public boolean equalsDeep(Base other_) {
1092        if (!super.equalsDeep(other_))
1093          return false;
1094        if (!(other_ instanceof GroupComponent))
1095          return false;
1096        GroupComponent o = (GroupComponent) other_;
1097        return compareDeep(group, o.group, true) && compareDeep(groupDisplay, o.groupDisplay, true) && compareDeep(subGroup, o.subGroup, true)
1098           && compareDeep(subGroupDisplay, o.subGroupDisplay, true) && compareDeep(plan, o.plan, true) && compareDeep(planDisplay, o.planDisplay, true)
1099           && compareDeep(subPlan, o.subPlan, true) && compareDeep(subPlanDisplay, o.subPlanDisplay, true)
1100           && compareDeep(class_, o.class_, true) && compareDeep(classDisplay, o.classDisplay, true) && compareDeep(subClass, o.subClass, true)
1101           && compareDeep(subClassDisplay, o.subClassDisplay, true);
1102      }
1103
1104      @Override
1105      public boolean equalsShallow(Base other_) {
1106        if (!super.equalsShallow(other_))
1107          return false;
1108        if (!(other_ instanceof GroupComponent))
1109          return false;
1110        GroupComponent o = (GroupComponent) other_;
1111        return compareValues(group, o.group, true) && compareValues(groupDisplay, o.groupDisplay, true) && compareValues(subGroup, o.subGroup, true)
1112           && compareValues(subGroupDisplay, o.subGroupDisplay, true) && compareValues(plan, o.plan, true) && compareValues(planDisplay, o.planDisplay, true)
1113           && compareValues(subPlan, o.subPlan, true) && compareValues(subPlanDisplay, o.subPlanDisplay, true)
1114           && compareValues(class_, o.class_, true) && compareValues(classDisplay, o.classDisplay, true) && compareValues(subClass, o.subClass, true)
1115           && compareValues(subClassDisplay, o.subClassDisplay, true);
1116      }
1117
1118      public boolean isEmpty() {
1119        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(group, groupDisplay, subGroup
1120          , subGroupDisplay, plan, planDisplay, subPlan, subPlanDisplay, class_, classDisplay
1121          , subClass, subClassDisplay);
1122      }
1123
1124  public String fhirType() {
1125    return "Coverage.grouping";
1126
1127  }
1128
1129  }
1130
1131    /**
1132     * The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Certificate number, Personal Health Number or Case ID. May be constructed as the concatination of the Coverage.SubscriberID and the Coverage.dependant.
1133     */
1134    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1135    @Description(shortDefinition="The primary coverage ID", formalDefinition="The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Certificate number, Personal Health Number or Case ID. May be constructed as the concatination of the Coverage.SubscriberID and the Coverage.dependant." )
1136    protected List<Identifier> identifier;
1137
1138    /**
1139     * The status of the resource instance.
1140     */
1141    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
1142    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
1143    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
1144    protected Enumeration<CoverageStatus> status;
1145
1146    /**
1147     * The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.
1148     */
1149    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1150    @Description(shortDefinition="Type of coverage such as medical or accident", formalDefinition="The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization." )
1151    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/coverage-type")
1152    protected CodeableConcept type;
1153
1154    /**
1155     * The party who 'owns' the insurance policy,  may be an individual, corporation or the subscriber's employer.
1156     */
1157    @Child(name = "policyHolder", type = {Patient.class, RelatedPerson.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
1158    @Description(shortDefinition="Owner of the policy", formalDefinition="The party who 'owns' the insurance policy,  may be an individual, corporation or the subscriber's employer." )
1159    protected Reference policyHolder;
1160
1161    /**
1162     * The actual object that is the target of the reference (The party who 'owns' the insurance policy,  may be an individual, corporation or the subscriber's employer.)
1163     */
1164    protected Resource policyHolderTarget;
1165
1166    /**
1167     * The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.
1168     */
1169    @Child(name = "subscriber", type = {Patient.class, RelatedPerson.class}, order=4, min=0, max=1, modifier=false, summary=true)
1170    @Description(shortDefinition="Subscriber to the policy", formalDefinition="The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due." )
1171    protected Reference subscriber;
1172
1173    /**
1174     * The actual object that is the target of the reference (The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.)
1175     */
1176    protected Resource subscriberTarget;
1177
1178    /**
1179     * The insurer assigned ID for the Subscriber.
1180     */
1181    @Child(name = "subscriberId", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1182    @Description(shortDefinition="ID assigned to the Subscriber", formalDefinition="The insurer assigned ID for the Subscriber." )
1183    protected StringType subscriberId;
1184
1185    /**
1186     * The party who benefits from the insurance coverage., the patient when services are provided.
1187     */
1188    @Child(name = "beneficiary", type = {Patient.class}, order=6, min=0, max=1, modifier=false, summary=true)
1189    @Description(shortDefinition="Plan Beneficiary", formalDefinition="The party who benefits from the insurance coverage., the patient when services are provided." )
1190    protected Reference beneficiary;
1191
1192    /**
1193     * The actual object that is the target of the reference (The party who benefits from the insurance coverage., the patient when services are provided.)
1194     */
1195    protected Patient beneficiaryTarget;
1196
1197    /**
1198     * The relationship of beneficiary (patient) to the subscriber.
1199     */
1200    @Child(name = "relationship", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
1201    @Description(shortDefinition="Beneficiary relationship to the Subscriber", formalDefinition="The relationship of beneficiary (patient) to the subscriber." )
1202    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/policyholder-relationship")
1203    protected CodeableConcept relationship;
1204
1205    /**
1206     * Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.
1207     */
1208    @Child(name = "period", type = {Period.class}, order=8, min=0, max=1, modifier=false, summary=true)
1209    @Description(shortDefinition="Coverage start and end dates", formalDefinition="Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force." )
1210    protected Period period;
1211
1212    /**
1213     * The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements. May provide multiple identifiers such as insurance company identifier or business identifier (BIN number).
1214     */
1215    @Child(name = "payor", type = {Organization.class, Patient.class, RelatedPerson.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1216    @Description(shortDefinition="Identifier for the plan or agreement issuer", formalDefinition="The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements. May provide multiple identifiers such as insurance company identifier or business identifier (BIN number)." )
1217    protected List<Reference> payor;
1218    /**
1219     * The actual objects that are the target of the reference (The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements. May provide multiple identifiers such as insurance company identifier or business identifier (BIN number).)
1220     */
1221    protected List<Resource> payorTarget;
1222
1223
1224    /**
1225     * A suite of underwrite specific classifiers, for example may be used to identify a class of coverage or employer group, Policy, Plan.
1226     */
1227    @Child(name = "grouping", type = {}, order=10, min=0, max=1, modifier=false, summary=false)
1228    @Description(shortDefinition="Additional coverage classifications", formalDefinition="A suite of underwrite specific classifiers, for example may be used to identify a class of coverage or employer group, Policy, Plan." )
1229    protected GroupComponent grouping;
1230
1231    /**
1232     * A unique identifier for a dependent under the coverage.
1233     */
1234    @Child(name = "dependent", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=true)
1235    @Description(shortDefinition="Dependent number", formalDefinition="A unique identifier for a dependent under the coverage." )
1236    protected StringType dependent;
1237
1238    /**
1239     * An optional counter for a particular instance of the identified coverage which increments upon each renewal.
1240     */
1241    @Child(name = "sequence", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=true)
1242    @Description(shortDefinition="The plan instance or sequence counter", formalDefinition="An optional counter for a particular instance of the identified coverage which increments upon each renewal." )
1243    protected StringType sequence;
1244
1245    /**
1246     * The order of applicability of this coverage relative to other coverages which are currently inforce. Note, there may be gaps in the numbering and this does not imply primary, secondard etc. as the specific positioning of coverages depends upon the episode of care.
1247     */
1248    @Child(name = "order", type = {PositiveIntType.class}, order=13, min=0, max=1, modifier=false, summary=true)
1249    @Description(shortDefinition="Relative order of the coverage", formalDefinition="The order of applicability of this coverage relative to other coverages which are currently inforce. Note, there may be gaps in the numbering and this does not imply primary, secondard etc. as the specific positioning of coverages depends upon the episode of care." )
1250    protected PositiveIntType order;
1251
1252    /**
1253     * The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.
1254     */
1255    @Child(name = "network", type = {StringType.class}, order=14, min=0, max=1, modifier=false, summary=true)
1256    @Description(shortDefinition="Insurer network", formalDefinition="The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply." )
1257    protected StringType network;
1258
1259    /**
1260     * The policy(s) which constitute this insurance coverage.
1261     */
1262    @Child(name = "contract", type = {Contract.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1263    @Description(shortDefinition="Contract details", formalDefinition="The policy(s) which constitute this insurance coverage." )
1264    protected List<Reference> contract;
1265    /**
1266     * The actual objects that are the target of the reference (The policy(s) which constitute this insurance coverage.)
1267     */
1268    protected List<Contract> contractTarget;
1269
1270
1271    private static final long serialVersionUID = -1719168406L;
1272
1273  /**
1274   * Constructor
1275   */
1276    public Coverage() {
1277      super();
1278    }
1279
1280    /**
1281     * @return {@link #identifier} (The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Certificate number, Personal Health Number or Case ID. May be constructed as the concatination of the Coverage.SubscriberID and the Coverage.dependant.)
1282     */
1283    public List<Identifier> getIdentifier() { 
1284      if (this.identifier == null)
1285        this.identifier = new ArrayList<Identifier>();
1286      return this.identifier;
1287    }
1288
1289    /**
1290     * @return Returns a reference to <code>this</code> for easy method chaining
1291     */
1292    public Coverage setIdentifier(List<Identifier> theIdentifier) { 
1293      this.identifier = theIdentifier;
1294      return this;
1295    }
1296
1297    public boolean hasIdentifier() { 
1298      if (this.identifier == null)
1299        return false;
1300      for (Identifier item : this.identifier)
1301        if (!item.isEmpty())
1302          return true;
1303      return false;
1304    }
1305
1306    public Identifier addIdentifier() { //3
1307      Identifier t = new Identifier();
1308      if (this.identifier == null)
1309        this.identifier = new ArrayList<Identifier>();
1310      this.identifier.add(t);
1311      return t;
1312    }
1313
1314    public Coverage addIdentifier(Identifier t) { //3
1315      if (t == null)
1316        return this;
1317      if (this.identifier == null)
1318        this.identifier = new ArrayList<Identifier>();
1319      this.identifier.add(t);
1320      return this;
1321    }
1322
1323    /**
1324     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1325     */
1326    public Identifier getIdentifierFirstRep() { 
1327      if (getIdentifier().isEmpty()) {
1328        addIdentifier();
1329      }
1330      return getIdentifier().get(0);
1331    }
1332
1333    /**
1334     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1335     */
1336    public Enumeration<CoverageStatus> getStatusElement() { 
1337      if (this.status == null)
1338        if (Configuration.errorOnAutoCreate())
1339          throw new Error("Attempt to auto-create Coverage.status");
1340        else if (Configuration.doAutoCreate())
1341          this.status = new Enumeration<CoverageStatus>(new CoverageStatusEnumFactory()); // bb
1342      return this.status;
1343    }
1344
1345    public boolean hasStatusElement() { 
1346      return this.status != null && !this.status.isEmpty();
1347    }
1348
1349    public boolean hasStatus() { 
1350      return this.status != null && !this.status.isEmpty();
1351    }
1352
1353    /**
1354     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1355     */
1356    public Coverage setStatusElement(Enumeration<CoverageStatus> value) { 
1357      this.status = value;
1358      return this;
1359    }
1360
1361    /**
1362     * @return The status of the resource instance.
1363     */
1364    public CoverageStatus getStatus() { 
1365      return this.status == null ? null : this.status.getValue();
1366    }
1367
1368    /**
1369     * @param value The status of the resource instance.
1370     */
1371    public Coverage setStatus(CoverageStatus value) { 
1372      if (value == null)
1373        this.status = null;
1374      else {
1375        if (this.status == null)
1376          this.status = new Enumeration<CoverageStatus>(new CoverageStatusEnumFactory());
1377        this.status.setValue(value);
1378      }
1379      return this;
1380    }
1381
1382    /**
1383     * @return {@link #type} (The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.)
1384     */
1385    public CodeableConcept getType() { 
1386      if (this.type == null)
1387        if (Configuration.errorOnAutoCreate())
1388          throw new Error("Attempt to auto-create Coverage.type");
1389        else if (Configuration.doAutoCreate())
1390          this.type = new CodeableConcept(); // cc
1391      return this.type;
1392    }
1393
1394    public boolean hasType() { 
1395      return this.type != null && !this.type.isEmpty();
1396    }
1397
1398    /**
1399     * @param value {@link #type} (The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.)
1400     */
1401    public Coverage setType(CodeableConcept value)  { 
1402      this.type = value;
1403      return this;
1404    }
1405
1406    /**
1407     * @return {@link #policyHolder} (The party who 'owns' the insurance policy,  may be an individual, corporation or the subscriber's employer.)
1408     */
1409    public Reference getPolicyHolder() { 
1410      if (this.policyHolder == null)
1411        if (Configuration.errorOnAutoCreate())
1412          throw new Error("Attempt to auto-create Coverage.policyHolder");
1413        else if (Configuration.doAutoCreate())
1414          this.policyHolder = new Reference(); // cc
1415      return this.policyHolder;
1416    }
1417
1418    public boolean hasPolicyHolder() { 
1419      return this.policyHolder != null && !this.policyHolder.isEmpty();
1420    }
1421
1422    /**
1423     * @param value {@link #policyHolder} (The party who 'owns' the insurance policy,  may be an individual, corporation or the subscriber's employer.)
1424     */
1425    public Coverage setPolicyHolder(Reference value)  { 
1426      this.policyHolder = value;
1427      return this;
1428    }
1429
1430    /**
1431     * @return {@link #policyHolder} 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. (The party who 'owns' the insurance policy,  may be an individual, corporation or the subscriber's employer.)
1432     */
1433    public Resource getPolicyHolderTarget() { 
1434      return this.policyHolderTarget;
1435    }
1436
1437    /**
1438     * @param value {@link #policyHolder} 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. (The party who 'owns' the insurance policy,  may be an individual, corporation or the subscriber's employer.)
1439     */
1440    public Coverage setPolicyHolderTarget(Resource value) { 
1441      this.policyHolderTarget = value;
1442      return this;
1443    }
1444
1445    /**
1446     * @return {@link #subscriber} (The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.)
1447     */
1448    public Reference getSubscriber() { 
1449      if (this.subscriber == null)
1450        if (Configuration.errorOnAutoCreate())
1451          throw new Error("Attempt to auto-create Coverage.subscriber");
1452        else if (Configuration.doAutoCreate())
1453          this.subscriber = new Reference(); // cc
1454      return this.subscriber;
1455    }
1456
1457    public boolean hasSubscriber() { 
1458      return this.subscriber != null && !this.subscriber.isEmpty();
1459    }
1460
1461    /**
1462     * @param value {@link #subscriber} (The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.)
1463     */
1464    public Coverage setSubscriber(Reference value)  { 
1465      this.subscriber = value;
1466      return this;
1467    }
1468
1469    /**
1470     * @return {@link #subscriber} 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. (The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.)
1471     */
1472    public Resource getSubscriberTarget() { 
1473      return this.subscriberTarget;
1474    }
1475
1476    /**
1477     * @param value {@link #subscriber} 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. (The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.)
1478     */
1479    public Coverage setSubscriberTarget(Resource value) { 
1480      this.subscriberTarget = value;
1481      return this;
1482    }
1483
1484    /**
1485     * @return {@link #subscriberId} (The insurer assigned ID for the Subscriber.). This is the underlying object with id, value and extensions. The accessor "getSubscriberId" gives direct access to the value
1486     */
1487    public StringType getSubscriberIdElement() { 
1488      if (this.subscriberId == null)
1489        if (Configuration.errorOnAutoCreate())
1490          throw new Error("Attempt to auto-create Coverage.subscriberId");
1491        else if (Configuration.doAutoCreate())
1492          this.subscriberId = new StringType(); // bb
1493      return this.subscriberId;
1494    }
1495
1496    public boolean hasSubscriberIdElement() { 
1497      return this.subscriberId != null && !this.subscriberId.isEmpty();
1498    }
1499
1500    public boolean hasSubscriberId() { 
1501      return this.subscriberId != null && !this.subscriberId.isEmpty();
1502    }
1503
1504    /**
1505     * @param value {@link #subscriberId} (The insurer assigned ID for the Subscriber.). This is the underlying object with id, value and extensions. The accessor "getSubscriberId" gives direct access to the value
1506     */
1507    public Coverage setSubscriberIdElement(StringType value) { 
1508      this.subscriberId = value;
1509      return this;
1510    }
1511
1512    /**
1513     * @return The insurer assigned ID for the Subscriber.
1514     */
1515    public String getSubscriberId() { 
1516      return this.subscriberId == null ? null : this.subscriberId.getValue();
1517    }
1518
1519    /**
1520     * @param value The insurer assigned ID for the Subscriber.
1521     */
1522    public Coverage setSubscriberId(String value) { 
1523      if (Utilities.noString(value))
1524        this.subscriberId = null;
1525      else {
1526        if (this.subscriberId == null)
1527          this.subscriberId = new StringType();
1528        this.subscriberId.setValue(value);
1529      }
1530      return this;
1531    }
1532
1533    /**
1534     * @return {@link #beneficiary} (The party who benefits from the insurance coverage., the patient when services are provided.)
1535     */
1536    public Reference getBeneficiary() { 
1537      if (this.beneficiary == null)
1538        if (Configuration.errorOnAutoCreate())
1539          throw new Error("Attempt to auto-create Coverage.beneficiary");
1540        else if (Configuration.doAutoCreate())
1541          this.beneficiary = new Reference(); // cc
1542      return this.beneficiary;
1543    }
1544
1545    public boolean hasBeneficiary() { 
1546      return this.beneficiary != null && !this.beneficiary.isEmpty();
1547    }
1548
1549    /**
1550     * @param value {@link #beneficiary} (The party who benefits from the insurance coverage., the patient when services are provided.)
1551     */
1552    public Coverage setBeneficiary(Reference value)  { 
1553      this.beneficiary = value;
1554      return this;
1555    }
1556
1557    /**
1558     * @return {@link #beneficiary} 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. (The party who benefits from the insurance coverage., the patient when services are provided.)
1559     */
1560    public Patient getBeneficiaryTarget() { 
1561      if (this.beneficiaryTarget == null)
1562        if (Configuration.errorOnAutoCreate())
1563          throw new Error("Attempt to auto-create Coverage.beneficiary");
1564        else if (Configuration.doAutoCreate())
1565          this.beneficiaryTarget = new Patient(); // aa
1566      return this.beneficiaryTarget;
1567    }
1568
1569    /**
1570     * @param value {@link #beneficiary} 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. (The party who benefits from the insurance coverage., the patient when services are provided.)
1571     */
1572    public Coverage setBeneficiaryTarget(Patient value) { 
1573      this.beneficiaryTarget = value;
1574      return this;
1575    }
1576
1577    /**
1578     * @return {@link #relationship} (The relationship of beneficiary (patient) to the subscriber.)
1579     */
1580    public CodeableConcept getRelationship() { 
1581      if (this.relationship == null)
1582        if (Configuration.errorOnAutoCreate())
1583          throw new Error("Attempt to auto-create Coverage.relationship");
1584        else if (Configuration.doAutoCreate())
1585          this.relationship = new CodeableConcept(); // cc
1586      return this.relationship;
1587    }
1588
1589    public boolean hasRelationship() { 
1590      return this.relationship != null && !this.relationship.isEmpty();
1591    }
1592
1593    /**
1594     * @param value {@link #relationship} (The relationship of beneficiary (patient) to the subscriber.)
1595     */
1596    public Coverage setRelationship(CodeableConcept value)  { 
1597      this.relationship = value;
1598      return this;
1599    }
1600
1601    /**
1602     * @return {@link #period} (Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.)
1603     */
1604    public Period getPeriod() { 
1605      if (this.period == null)
1606        if (Configuration.errorOnAutoCreate())
1607          throw new Error("Attempt to auto-create Coverage.period");
1608        else if (Configuration.doAutoCreate())
1609          this.period = new Period(); // cc
1610      return this.period;
1611    }
1612
1613    public boolean hasPeriod() { 
1614      return this.period != null && !this.period.isEmpty();
1615    }
1616
1617    /**
1618     * @param value {@link #period} (Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.)
1619     */
1620    public Coverage setPeriod(Period value)  { 
1621      this.period = value;
1622      return this;
1623    }
1624
1625    /**
1626     * @return {@link #payor} (The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements. May provide multiple identifiers such as insurance company identifier or business identifier (BIN number).)
1627     */
1628    public List<Reference> getPayor() { 
1629      if (this.payor == null)
1630        this.payor = new ArrayList<Reference>();
1631      return this.payor;
1632    }
1633
1634    /**
1635     * @return Returns a reference to <code>this</code> for easy method chaining
1636     */
1637    public Coverage setPayor(List<Reference> thePayor) { 
1638      this.payor = thePayor;
1639      return this;
1640    }
1641
1642    public boolean hasPayor() { 
1643      if (this.payor == null)
1644        return false;
1645      for (Reference item : this.payor)
1646        if (!item.isEmpty())
1647          return true;
1648      return false;
1649    }
1650
1651    public Reference addPayor() { //3
1652      Reference t = new Reference();
1653      if (this.payor == null)
1654        this.payor = new ArrayList<Reference>();
1655      this.payor.add(t);
1656      return t;
1657    }
1658
1659    public Coverage addPayor(Reference t) { //3
1660      if (t == null)
1661        return this;
1662      if (this.payor == null)
1663        this.payor = new ArrayList<Reference>();
1664      this.payor.add(t);
1665      return this;
1666    }
1667
1668    /**
1669     * @return The first repetition of repeating field {@link #payor}, creating it if it does not already exist
1670     */
1671    public Reference getPayorFirstRep() { 
1672      if (getPayor().isEmpty()) {
1673        addPayor();
1674      }
1675      return getPayor().get(0);
1676    }
1677
1678    /**
1679     * @deprecated Use Reference#setResource(IBaseResource) instead
1680     */
1681    @Deprecated
1682    public List<Resource> getPayorTarget() { 
1683      if (this.payorTarget == null)
1684        this.payorTarget = new ArrayList<Resource>();
1685      return this.payorTarget;
1686    }
1687
1688    /**
1689     * @return {@link #grouping} (A suite of underwrite specific classifiers, for example may be used to identify a class of coverage or employer group, Policy, Plan.)
1690     */
1691    public GroupComponent getGrouping() { 
1692      if (this.grouping == null)
1693        if (Configuration.errorOnAutoCreate())
1694          throw new Error("Attempt to auto-create Coverage.grouping");
1695        else if (Configuration.doAutoCreate())
1696          this.grouping = new GroupComponent(); // cc
1697      return this.grouping;
1698    }
1699
1700    public boolean hasGrouping() { 
1701      return this.grouping != null && !this.grouping.isEmpty();
1702    }
1703
1704    /**
1705     * @param value {@link #grouping} (A suite of underwrite specific classifiers, for example may be used to identify a class of coverage or employer group, Policy, Plan.)
1706     */
1707    public Coverage setGrouping(GroupComponent value)  { 
1708      this.grouping = value;
1709      return this;
1710    }
1711
1712    /**
1713     * @return {@link #dependent} (A unique identifier for a dependent under the coverage.). This is the underlying object with id, value and extensions. The accessor "getDependent" gives direct access to the value
1714     */
1715    public StringType getDependentElement() { 
1716      if (this.dependent == null)
1717        if (Configuration.errorOnAutoCreate())
1718          throw new Error("Attempt to auto-create Coverage.dependent");
1719        else if (Configuration.doAutoCreate())
1720          this.dependent = new StringType(); // bb
1721      return this.dependent;
1722    }
1723
1724    public boolean hasDependentElement() { 
1725      return this.dependent != null && !this.dependent.isEmpty();
1726    }
1727
1728    public boolean hasDependent() { 
1729      return this.dependent != null && !this.dependent.isEmpty();
1730    }
1731
1732    /**
1733     * @param value {@link #dependent} (A unique identifier for a dependent under the coverage.). This is the underlying object with id, value and extensions. The accessor "getDependent" gives direct access to the value
1734     */
1735    public Coverage setDependentElement(StringType value) { 
1736      this.dependent = value;
1737      return this;
1738    }
1739
1740    /**
1741     * @return A unique identifier for a dependent under the coverage.
1742     */
1743    public String getDependent() { 
1744      return this.dependent == null ? null : this.dependent.getValue();
1745    }
1746
1747    /**
1748     * @param value A unique identifier for a dependent under the coverage.
1749     */
1750    public Coverage setDependent(String value) { 
1751      if (Utilities.noString(value))
1752        this.dependent = null;
1753      else {
1754        if (this.dependent == null)
1755          this.dependent = new StringType();
1756        this.dependent.setValue(value);
1757      }
1758      return this;
1759    }
1760
1761    /**
1762     * @return {@link #sequence} (An optional counter for a particular instance of the identified coverage which increments upon each renewal.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1763     */
1764    public StringType getSequenceElement() { 
1765      if (this.sequence == null)
1766        if (Configuration.errorOnAutoCreate())
1767          throw new Error("Attempt to auto-create Coverage.sequence");
1768        else if (Configuration.doAutoCreate())
1769          this.sequence = new StringType(); // bb
1770      return this.sequence;
1771    }
1772
1773    public boolean hasSequenceElement() { 
1774      return this.sequence != null && !this.sequence.isEmpty();
1775    }
1776
1777    public boolean hasSequence() { 
1778      return this.sequence != null && !this.sequence.isEmpty();
1779    }
1780
1781    /**
1782     * @param value {@link #sequence} (An optional counter for a particular instance of the identified coverage which increments upon each renewal.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
1783     */
1784    public Coverage setSequenceElement(StringType value) { 
1785      this.sequence = value;
1786      return this;
1787    }
1788
1789    /**
1790     * @return An optional counter for a particular instance of the identified coverage which increments upon each renewal.
1791     */
1792    public String getSequence() { 
1793      return this.sequence == null ? null : this.sequence.getValue();
1794    }
1795
1796    /**
1797     * @param value An optional counter for a particular instance of the identified coverage which increments upon each renewal.
1798     */
1799    public Coverage setSequence(String value) { 
1800      if (Utilities.noString(value))
1801        this.sequence = null;
1802      else {
1803        if (this.sequence == null)
1804          this.sequence = new StringType();
1805        this.sequence.setValue(value);
1806      }
1807      return this;
1808    }
1809
1810    /**
1811     * @return {@link #order} (The order of applicability of this coverage relative to other coverages which are currently inforce. Note, there may be gaps in the numbering and this does not imply primary, secondard etc. as the specific positioning of coverages depends upon the episode of care.). This is the underlying object with id, value and extensions. The accessor "getOrder" gives direct access to the value
1812     */
1813    public PositiveIntType getOrderElement() { 
1814      if (this.order == null)
1815        if (Configuration.errorOnAutoCreate())
1816          throw new Error("Attempt to auto-create Coverage.order");
1817        else if (Configuration.doAutoCreate())
1818          this.order = new PositiveIntType(); // bb
1819      return this.order;
1820    }
1821
1822    public boolean hasOrderElement() { 
1823      return this.order != null && !this.order.isEmpty();
1824    }
1825
1826    public boolean hasOrder() { 
1827      return this.order != null && !this.order.isEmpty();
1828    }
1829
1830    /**
1831     * @param value {@link #order} (The order of applicability of this coverage relative to other coverages which are currently inforce. Note, there may be gaps in the numbering and this does not imply primary, secondard etc. as the specific positioning of coverages depends upon the episode of care.). This is the underlying object with id, value and extensions. The accessor "getOrder" gives direct access to the value
1832     */
1833    public Coverage setOrderElement(PositiveIntType value) { 
1834      this.order = value;
1835      return this;
1836    }
1837
1838    /**
1839     * @return The order of applicability of this coverage relative to other coverages which are currently inforce. Note, there may be gaps in the numbering and this does not imply primary, secondard etc. as the specific positioning of coverages depends upon the episode of care.
1840     */
1841    public int getOrder() { 
1842      return this.order == null || this.order.isEmpty() ? 0 : this.order.getValue();
1843    }
1844
1845    /**
1846     * @param value The order of applicability of this coverage relative to other coverages which are currently inforce. Note, there may be gaps in the numbering and this does not imply primary, secondard etc. as the specific positioning of coverages depends upon the episode of care.
1847     */
1848    public Coverage setOrder(int value) { 
1849        if (this.order == null)
1850          this.order = new PositiveIntType();
1851        this.order.setValue(value);
1852      return this;
1853    }
1854
1855    /**
1856     * @return {@link #network} (The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.). This is the underlying object with id, value and extensions. The accessor "getNetwork" gives direct access to the value
1857     */
1858    public StringType getNetworkElement() { 
1859      if (this.network == null)
1860        if (Configuration.errorOnAutoCreate())
1861          throw new Error("Attempt to auto-create Coverage.network");
1862        else if (Configuration.doAutoCreate())
1863          this.network = new StringType(); // bb
1864      return this.network;
1865    }
1866
1867    public boolean hasNetworkElement() { 
1868      return this.network != null && !this.network.isEmpty();
1869    }
1870
1871    public boolean hasNetwork() { 
1872      return this.network != null && !this.network.isEmpty();
1873    }
1874
1875    /**
1876     * @param value {@link #network} (The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.). This is the underlying object with id, value and extensions. The accessor "getNetwork" gives direct access to the value
1877     */
1878    public Coverage setNetworkElement(StringType value) { 
1879      this.network = value;
1880      return this;
1881    }
1882
1883    /**
1884     * @return The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.
1885     */
1886    public String getNetwork() { 
1887      return this.network == null ? null : this.network.getValue();
1888    }
1889
1890    /**
1891     * @param value The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.
1892     */
1893    public Coverage setNetwork(String value) { 
1894      if (Utilities.noString(value))
1895        this.network = null;
1896      else {
1897        if (this.network == null)
1898          this.network = new StringType();
1899        this.network.setValue(value);
1900      }
1901      return this;
1902    }
1903
1904    /**
1905     * @return {@link #contract} (The policy(s) which constitute this insurance coverage.)
1906     */
1907    public List<Reference> getContract() { 
1908      if (this.contract == null)
1909        this.contract = new ArrayList<Reference>();
1910      return this.contract;
1911    }
1912
1913    /**
1914     * @return Returns a reference to <code>this</code> for easy method chaining
1915     */
1916    public Coverage setContract(List<Reference> theContract) { 
1917      this.contract = theContract;
1918      return this;
1919    }
1920
1921    public boolean hasContract() { 
1922      if (this.contract == null)
1923        return false;
1924      for (Reference item : this.contract)
1925        if (!item.isEmpty())
1926          return true;
1927      return false;
1928    }
1929
1930    public Reference addContract() { //3
1931      Reference t = new Reference();
1932      if (this.contract == null)
1933        this.contract = new ArrayList<Reference>();
1934      this.contract.add(t);
1935      return t;
1936    }
1937
1938    public Coverage addContract(Reference t) { //3
1939      if (t == null)
1940        return this;
1941      if (this.contract == null)
1942        this.contract = new ArrayList<Reference>();
1943      this.contract.add(t);
1944      return this;
1945    }
1946
1947    /**
1948     * @return The first repetition of repeating field {@link #contract}, creating it if it does not already exist
1949     */
1950    public Reference getContractFirstRep() { 
1951      if (getContract().isEmpty()) {
1952        addContract();
1953      }
1954      return getContract().get(0);
1955    }
1956
1957    /**
1958     * @deprecated Use Reference#setResource(IBaseResource) instead
1959     */
1960    @Deprecated
1961    public List<Contract> getContractTarget() { 
1962      if (this.contractTarget == null)
1963        this.contractTarget = new ArrayList<Contract>();
1964      return this.contractTarget;
1965    }
1966
1967    /**
1968     * @deprecated Use Reference#setResource(IBaseResource) instead
1969     */
1970    @Deprecated
1971    public Contract addContractTarget() { 
1972      Contract r = new Contract();
1973      if (this.contractTarget == null)
1974        this.contractTarget = new ArrayList<Contract>();
1975      this.contractTarget.add(r);
1976      return r;
1977    }
1978
1979      protected void listChildren(List<Property> children) {
1980        super.listChildren(children);
1981        children.add(new Property("identifier", "Identifier", "The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Certificate number, Personal Health Number or Case ID. May be constructed as the concatination of the Coverage.SubscriberID and the Coverage.dependant.", 0, java.lang.Integer.MAX_VALUE, identifier));
1982        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
1983        children.add(new Property("type", "CodeableConcept", "The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.", 0, 1, type));
1984        children.add(new Property("policyHolder", "Reference(Patient|RelatedPerson|Organization)", "The party who 'owns' the insurance policy,  may be an individual, corporation or the subscriber's employer.", 0, 1, policyHolder));
1985        children.add(new Property("subscriber", "Reference(Patient|RelatedPerson)", "The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.", 0, 1, subscriber));
1986        children.add(new Property("subscriberId", "string", "The insurer assigned ID for the Subscriber.", 0, 1, subscriberId));
1987        children.add(new Property("beneficiary", "Reference(Patient)", "The party who benefits from the insurance coverage., the patient when services are provided.", 0, 1, beneficiary));
1988        children.add(new Property("relationship", "CodeableConcept", "The relationship of beneficiary (patient) to the subscriber.", 0, 1, relationship));
1989        children.add(new Property("period", "Period", "Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.", 0, 1, period));
1990        children.add(new Property("payor", "Reference(Organization|Patient|RelatedPerson)", "The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements. May provide multiple identifiers such as insurance company identifier or business identifier (BIN number).", 0, java.lang.Integer.MAX_VALUE, payor));
1991        children.add(new Property("grouping", "", "A suite of underwrite specific classifiers, for example may be used to identify a class of coverage or employer group, Policy, Plan.", 0, 1, grouping));
1992        children.add(new Property("dependent", "string", "A unique identifier for a dependent under the coverage.", 0, 1, dependent));
1993        children.add(new Property("sequence", "string", "An optional counter for a particular instance of the identified coverage which increments upon each renewal.", 0, 1, sequence));
1994        children.add(new Property("order", "positiveInt", "The order of applicability of this coverage relative to other coverages which are currently inforce. Note, there may be gaps in the numbering and this does not imply primary, secondard etc. as the specific positioning of coverages depends upon the episode of care.", 0, 1, order));
1995        children.add(new Property("network", "string", "The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.", 0, 1, network));
1996        children.add(new Property("contract", "Reference(Contract)", "The policy(s) which constitute this insurance coverage.", 0, java.lang.Integer.MAX_VALUE, contract));
1997      }
1998
1999      @Override
2000      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2001        switch (_hash) {
2002        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Certificate number, Personal Health Number or Case ID. May be constructed as the concatination of the Coverage.SubscriberID and the Coverage.dependant.", 0, java.lang.Integer.MAX_VALUE, identifier);
2003        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
2004        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.", 0, 1, type);
2005        case 2046898558: /*policyHolder*/  return new Property("policyHolder", "Reference(Patient|RelatedPerson|Organization)", "The party who 'owns' the insurance policy,  may be an individual, corporation or the subscriber's employer.", 0, 1, policyHolder);
2006        case -1219769240: /*subscriber*/  return new Property("subscriber", "Reference(Patient|RelatedPerson)", "The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.", 0, 1, subscriber);
2007        case 327834531: /*subscriberId*/  return new Property("subscriberId", "string", "The insurer assigned ID for the Subscriber.", 0, 1, subscriberId);
2008        case -565102875: /*beneficiary*/  return new Property("beneficiary", "Reference(Patient)", "The party who benefits from the insurance coverage., the patient when services are provided.", 0, 1, beneficiary);
2009        case -261851592: /*relationship*/  return new Property("relationship", "CodeableConcept", "The relationship of beneficiary (patient) to the subscriber.", 0, 1, relationship);
2010        case -991726143: /*period*/  return new Property("period", "Period", "Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.", 0, 1, period);
2011        case 106443915: /*payor*/  return new Property("payor", "Reference(Organization|Patient|RelatedPerson)", "The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements. May provide multiple identifiers such as insurance company identifier or business identifier (BIN number).", 0, java.lang.Integer.MAX_VALUE, payor);
2012        case 506371331: /*grouping*/  return new Property("grouping", "", "A suite of underwrite specific classifiers, for example may be used to identify a class of coverage or employer group, Policy, Plan.", 0, 1, grouping);
2013        case -1109226753: /*dependent*/  return new Property("dependent", "string", "A unique identifier for a dependent under the coverage.", 0, 1, dependent);
2014        case 1349547969: /*sequence*/  return new Property("sequence", "string", "An optional counter for a particular instance of the identified coverage which increments upon each renewal.", 0, 1, sequence);
2015        case 106006350: /*order*/  return new Property("order", "positiveInt", "The order of applicability of this coverage relative to other coverages which are currently inforce. Note, there may be gaps in the numbering and this does not imply primary, secondard etc. as the specific positioning of coverages depends upon the episode of care.", 0, 1, order);
2016        case 1843485230: /*network*/  return new Property("network", "string", "The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.", 0, 1, network);
2017        case -566947566: /*contract*/  return new Property("contract", "Reference(Contract)", "The policy(s) which constitute this insurance coverage.", 0, java.lang.Integer.MAX_VALUE, contract);
2018        default: return super.getNamedProperty(_hash, _name, _checkValid);
2019        }
2020
2021      }
2022
2023      @Override
2024      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2025        switch (hash) {
2026        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2027        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CoverageStatus>
2028        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2029        case 2046898558: /*policyHolder*/ return this.policyHolder == null ? new Base[0] : new Base[] {this.policyHolder}; // Reference
2030        case -1219769240: /*subscriber*/ return this.subscriber == null ? new Base[0] : new Base[] {this.subscriber}; // Reference
2031        case 327834531: /*subscriberId*/ return this.subscriberId == null ? new Base[0] : new Base[] {this.subscriberId}; // StringType
2032        case -565102875: /*beneficiary*/ return this.beneficiary == null ? new Base[0] : new Base[] {this.beneficiary}; // Reference
2033        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept
2034        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
2035        case 106443915: /*payor*/ return this.payor == null ? new Base[0] : this.payor.toArray(new Base[this.payor.size()]); // Reference
2036        case 506371331: /*grouping*/ return this.grouping == null ? new Base[0] : new Base[] {this.grouping}; // GroupComponent
2037        case -1109226753: /*dependent*/ return this.dependent == null ? new Base[0] : new Base[] {this.dependent}; // StringType
2038        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // StringType
2039        case 106006350: /*order*/ return this.order == null ? new Base[0] : new Base[] {this.order}; // PositiveIntType
2040        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // StringType
2041        case -566947566: /*contract*/ return this.contract == null ? new Base[0] : this.contract.toArray(new Base[this.contract.size()]); // Reference
2042        default: return super.getProperty(hash, name, checkValid);
2043        }
2044
2045      }
2046
2047      @Override
2048      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2049        switch (hash) {
2050        case -1618432855: // identifier
2051          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2052          return value;
2053        case -892481550: // status
2054          value = new CoverageStatusEnumFactory().fromType(castToCode(value));
2055          this.status = (Enumeration) value; // Enumeration<CoverageStatus>
2056          return value;
2057        case 3575610: // type
2058          this.type = castToCodeableConcept(value); // CodeableConcept
2059          return value;
2060        case 2046898558: // policyHolder
2061          this.policyHolder = castToReference(value); // Reference
2062          return value;
2063        case -1219769240: // subscriber
2064          this.subscriber = castToReference(value); // Reference
2065          return value;
2066        case 327834531: // subscriberId
2067          this.subscriberId = castToString(value); // StringType
2068          return value;
2069        case -565102875: // beneficiary
2070          this.beneficiary = castToReference(value); // Reference
2071          return value;
2072        case -261851592: // relationship
2073          this.relationship = castToCodeableConcept(value); // CodeableConcept
2074          return value;
2075        case -991726143: // period
2076          this.period = castToPeriod(value); // Period
2077          return value;
2078        case 106443915: // payor
2079          this.getPayor().add(castToReference(value)); // Reference
2080          return value;
2081        case 506371331: // grouping
2082          this.grouping = (GroupComponent) value; // GroupComponent
2083          return value;
2084        case -1109226753: // dependent
2085          this.dependent = castToString(value); // StringType
2086          return value;
2087        case 1349547969: // sequence
2088          this.sequence = castToString(value); // StringType
2089          return value;
2090        case 106006350: // order
2091          this.order = castToPositiveInt(value); // PositiveIntType
2092          return value;
2093        case 1843485230: // network
2094          this.network = castToString(value); // StringType
2095          return value;
2096        case -566947566: // contract
2097          this.getContract().add(castToReference(value)); // Reference
2098          return value;
2099        default: return super.setProperty(hash, name, value);
2100        }
2101
2102      }
2103
2104      @Override
2105      public Base setProperty(String name, Base value) throws FHIRException {
2106        if (name.equals("identifier")) {
2107          this.getIdentifier().add(castToIdentifier(value));
2108        } else if (name.equals("status")) {
2109          value = new CoverageStatusEnumFactory().fromType(castToCode(value));
2110          this.status = (Enumeration) value; // Enumeration<CoverageStatus>
2111        } else if (name.equals("type")) {
2112          this.type = castToCodeableConcept(value); // CodeableConcept
2113        } else if (name.equals("policyHolder")) {
2114          this.policyHolder = castToReference(value); // Reference
2115        } else if (name.equals("subscriber")) {
2116          this.subscriber = castToReference(value); // Reference
2117        } else if (name.equals("subscriberId")) {
2118          this.subscriberId = castToString(value); // StringType
2119        } else if (name.equals("beneficiary")) {
2120          this.beneficiary = castToReference(value); // Reference
2121        } else if (name.equals("relationship")) {
2122          this.relationship = castToCodeableConcept(value); // CodeableConcept
2123        } else if (name.equals("period")) {
2124          this.period = castToPeriod(value); // Period
2125        } else if (name.equals("payor")) {
2126          this.getPayor().add(castToReference(value));
2127        } else if (name.equals("grouping")) {
2128          this.grouping = (GroupComponent) value; // GroupComponent
2129        } else if (name.equals("dependent")) {
2130          this.dependent = castToString(value); // StringType
2131        } else if (name.equals("sequence")) {
2132          this.sequence = castToString(value); // StringType
2133        } else if (name.equals("order")) {
2134          this.order = castToPositiveInt(value); // PositiveIntType
2135        } else if (name.equals("network")) {
2136          this.network = castToString(value); // StringType
2137        } else if (name.equals("contract")) {
2138          this.getContract().add(castToReference(value));
2139        } else
2140          return super.setProperty(name, value);
2141        return value;
2142      }
2143
2144      @Override
2145      public Base makeProperty(int hash, String name) throws FHIRException {
2146        switch (hash) {
2147        case -1618432855:  return addIdentifier(); 
2148        case -892481550:  return getStatusElement();
2149        case 3575610:  return getType(); 
2150        case 2046898558:  return getPolicyHolder(); 
2151        case -1219769240:  return getSubscriber(); 
2152        case 327834531:  return getSubscriberIdElement();
2153        case -565102875:  return getBeneficiary(); 
2154        case -261851592:  return getRelationship(); 
2155        case -991726143:  return getPeriod(); 
2156        case 106443915:  return addPayor(); 
2157        case 506371331:  return getGrouping(); 
2158        case -1109226753:  return getDependentElement();
2159        case 1349547969:  return getSequenceElement();
2160        case 106006350:  return getOrderElement();
2161        case 1843485230:  return getNetworkElement();
2162        case -566947566:  return addContract(); 
2163        default: return super.makeProperty(hash, name);
2164        }
2165
2166      }
2167
2168      @Override
2169      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2170        switch (hash) {
2171        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2172        case -892481550: /*status*/ return new String[] {"code"};
2173        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2174        case 2046898558: /*policyHolder*/ return new String[] {"Reference"};
2175        case -1219769240: /*subscriber*/ return new String[] {"Reference"};
2176        case 327834531: /*subscriberId*/ return new String[] {"string"};
2177        case -565102875: /*beneficiary*/ return new String[] {"Reference"};
2178        case -261851592: /*relationship*/ return new String[] {"CodeableConcept"};
2179        case -991726143: /*period*/ return new String[] {"Period"};
2180        case 106443915: /*payor*/ return new String[] {"Reference"};
2181        case 506371331: /*grouping*/ return new String[] {};
2182        case -1109226753: /*dependent*/ return new String[] {"string"};
2183        case 1349547969: /*sequence*/ return new String[] {"string"};
2184        case 106006350: /*order*/ return new String[] {"positiveInt"};
2185        case 1843485230: /*network*/ return new String[] {"string"};
2186        case -566947566: /*contract*/ return new String[] {"Reference"};
2187        default: return super.getTypesForProperty(hash, name);
2188        }
2189
2190      }
2191
2192      @Override
2193      public Base addChild(String name) throws FHIRException {
2194        if (name.equals("identifier")) {
2195          return addIdentifier();
2196        }
2197        else if (name.equals("status")) {
2198          throw new FHIRException("Cannot call addChild on a primitive type Coverage.status");
2199        }
2200        else if (name.equals("type")) {
2201          this.type = new CodeableConcept();
2202          return this.type;
2203        }
2204        else if (name.equals("policyHolder")) {
2205          this.policyHolder = new Reference();
2206          return this.policyHolder;
2207        }
2208        else if (name.equals("subscriber")) {
2209          this.subscriber = new Reference();
2210          return this.subscriber;
2211        }
2212        else if (name.equals("subscriberId")) {
2213          throw new FHIRException("Cannot call addChild on a primitive type Coverage.subscriberId");
2214        }
2215        else if (name.equals("beneficiary")) {
2216          this.beneficiary = new Reference();
2217          return this.beneficiary;
2218        }
2219        else if (name.equals("relationship")) {
2220          this.relationship = new CodeableConcept();
2221          return this.relationship;
2222        }
2223        else if (name.equals("period")) {
2224          this.period = new Period();
2225          return this.period;
2226        }
2227        else if (name.equals("payor")) {
2228          return addPayor();
2229        }
2230        else if (name.equals("grouping")) {
2231          this.grouping = new GroupComponent();
2232          return this.grouping;
2233        }
2234        else if (name.equals("dependent")) {
2235          throw new FHIRException("Cannot call addChild on a primitive type Coverage.dependent");
2236        }
2237        else if (name.equals("sequence")) {
2238          throw new FHIRException("Cannot call addChild on a primitive type Coverage.sequence");
2239        }
2240        else if (name.equals("order")) {
2241          throw new FHIRException("Cannot call addChild on a primitive type Coverage.order");
2242        }
2243        else if (name.equals("network")) {
2244          throw new FHIRException("Cannot call addChild on a primitive type Coverage.network");
2245        }
2246        else if (name.equals("contract")) {
2247          return addContract();
2248        }
2249        else
2250          return super.addChild(name);
2251      }
2252
2253  public String fhirType() {
2254    return "Coverage";
2255
2256  }
2257
2258      public Coverage copy() {
2259        Coverage dst = new Coverage();
2260        copyValues(dst);
2261        if (identifier != null) {
2262          dst.identifier = new ArrayList<Identifier>();
2263          for (Identifier i : identifier)
2264            dst.identifier.add(i.copy());
2265        };
2266        dst.status = status == null ? null : status.copy();
2267        dst.type = type == null ? null : type.copy();
2268        dst.policyHolder = policyHolder == null ? null : policyHolder.copy();
2269        dst.subscriber = subscriber == null ? null : subscriber.copy();
2270        dst.subscriberId = subscriberId == null ? null : subscriberId.copy();
2271        dst.beneficiary = beneficiary == null ? null : beneficiary.copy();
2272        dst.relationship = relationship == null ? null : relationship.copy();
2273        dst.period = period == null ? null : period.copy();
2274        if (payor != null) {
2275          dst.payor = new ArrayList<Reference>();
2276          for (Reference i : payor)
2277            dst.payor.add(i.copy());
2278        };
2279        dst.grouping = grouping == null ? null : grouping.copy();
2280        dst.dependent = dependent == null ? null : dependent.copy();
2281        dst.sequence = sequence == null ? null : sequence.copy();
2282        dst.order = order == null ? null : order.copy();
2283        dst.network = network == null ? null : network.copy();
2284        if (contract != null) {
2285          dst.contract = new ArrayList<Reference>();
2286          for (Reference i : contract)
2287            dst.contract.add(i.copy());
2288        };
2289        return dst;
2290      }
2291
2292      protected Coverage typedCopy() {
2293        return copy();
2294      }
2295
2296      @Override
2297      public boolean equalsDeep(Base other_) {
2298        if (!super.equalsDeep(other_))
2299          return false;
2300        if (!(other_ instanceof Coverage))
2301          return false;
2302        Coverage o = (Coverage) other_;
2303        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
2304           && compareDeep(policyHolder, o.policyHolder, true) && compareDeep(subscriber, o.subscriber, true)
2305           && compareDeep(subscriberId, o.subscriberId, true) && compareDeep(beneficiary, o.beneficiary, true)
2306           && compareDeep(relationship, o.relationship, true) && compareDeep(period, o.period, true) && compareDeep(payor, o.payor, true)
2307           && compareDeep(grouping, o.grouping, true) && compareDeep(dependent, o.dependent, true) && compareDeep(sequence, o.sequence, true)
2308           && compareDeep(order, o.order, true) && compareDeep(network, o.network, true) && compareDeep(contract, o.contract, true)
2309          ;
2310      }
2311
2312      @Override
2313      public boolean equalsShallow(Base other_) {
2314        if (!super.equalsShallow(other_))
2315          return false;
2316        if (!(other_ instanceof Coverage))
2317          return false;
2318        Coverage o = (Coverage) other_;
2319        return compareValues(status, o.status, true) && compareValues(subscriberId, o.subscriberId, true) && compareValues(dependent, o.dependent, true)
2320           && compareValues(sequence, o.sequence, true) && compareValues(order, o.order, true) && compareValues(network, o.network, true)
2321          ;
2322      }
2323
2324      public boolean isEmpty() {
2325        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
2326          , policyHolder, subscriber, subscriberId, beneficiary, relationship, period, payor
2327          , grouping, dependent, sequence, order, network, contract);
2328      }
2329
2330  @Override
2331  public ResourceType getResourceType() {
2332    return ResourceType.Coverage;
2333   }
2334
2335 /**
2336   * Search parameter: <b>identifier</b>
2337   * <p>
2338   * Description: <b>The primary identifier of the insured and the coverage</b><br>
2339   * Type: <b>token</b><br>
2340   * Path: <b>Coverage.identifier</b><br>
2341   * </p>
2342   */
2343  @SearchParamDefinition(name="identifier", path="Coverage.identifier", description="The primary identifier of the insured and the coverage", type="token" )
2344  public static final String SP_IDENTIFIER = "identifier";
2345 /**
2346   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2347   * <p>
2348   * Description: <b>The primary identifier of the insured and the coverage</b><br>
2349   * Type: <b>token</b><br>
2350   * Path: <b>Coverage.identifier</b><br>
2351   * </p>
2352   */
2353  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2354
2355 /**
2356   * Search parameter: <b>subgroup</b>
2357   * <p>
2358   * Description: <b>Sub-group identifier</b><br>
2359   * Type: <b>string</b><br>
2360   * Path: <b>Coverage.grouping.subGroup</b><br>
2361   * </p>
2362   */
2363  @SearchParamDefinition(name="subgroup", path="Coverage.grouping.subGroup", description="Sub-group identifier", type="string" )
2364  public static final String SP_SUBGROUP = "subgroup";
2365 /**
2366   * <b>Fluent Client</b> search parameter constant for <b>subgroup</b>
2367   * <p>
2368   * Description: <b>Sub-group identifier</b><br>
2369   * Type: <b>string</b><br>
2370   * Path: <b>Coverage.grouping.subGroup</b><br>
2371   * </p>
2372   */
2373  public static final ca.uhn.fhir.rest.gclient.StringClientParam SUBGROUP = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_SUBGROUP);
2374
2375 /**
2376   * Search parameter: <b>subscriber</b>
2377   * <p>
2378   * Description: <b>Reference to the subscriber</b><br>
2379   * Type: <b>reference</b><br>
2380   * Path: <b>Coverage.subscriber</b><br>
2381   * </p>
2382   */
2383  @SearchParamDefinition(name="subscriber", path="Coverage.subscriber", description="Reference to the subscriber", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Patient.class, RelatedPerson.class } )
2384  public static final String SP_SUBSCRIBER = "subscriber";
2385 /**
2386   * <b>Fluent Client</b> search parameter constant for <b>subscriber</b>
2387   * <p>
2388   * Description: <b>Reference to the subscriber</b><br>
2389   * Type: <b>reference</b><br>
2390   * Path: <b>Coverage.subscriber</b><br>
2391   * </p>
2392   */
2393  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBSCRIBER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBSCRIBER);
2394
2395/**
2396   * Constant for fluent queries to be used to add include statements. Specifies
2397   * the path value of "<b>Coverage:subscriber</b>".
2398   */
2399  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBSCRIBER = new ca.uhn.fhir.model.api.Include("Coverage:subscriber").toLocked();
2400
2401 /**
2402   * Search parameter: <b>subplan</b>
2403   * <p>
2404   * Description: <b>Sub-plan identifier</b><br>
2405   * Type: <b>string</b><br>
2406   * Path: <b>Coverage.grouping.subPlan</b><br>
2407   * </p>
2408   */
2409  @SearchParamDefinition(name="subplan", path="Coverage.grouping.subPlan", description="Sub-plan identifier", type="string" )
2410  public static final String SP_SUBPLAN = "subplan";
2411 /**
2412   * <b>Fluent Client</b> search parameter constant for <b>subplan</b>
2413   * <p>
2414   * Description: <b>Sub-plan identifier</b><br>
2415   * Type: <b>string</b><br>
2416   * Path: <b>Coverage.grouping.subPlan</b><br>
2417   * </p>
2418   */
2419  public static final ca.uhn.fhir.rest.gclient.StringClientParam SUBPLAN = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_SUBPLAN);
2420
2421 /**
2422   * Search parameter: <b>type</b>
2423   * <p>
2424   * Description: <b>The kind of coverage (health plan, auto, Workers Compensation)</b><br>
2425   * Type: <b>token</b><br>
2426   * Path: <b>Coverage.type</b><br>
2427   * </p>
2428   */
2429  @SearchParamDefinition(name="type", path="Coverage.type", description="The kind of coverage (health plan, auto, Workers Compensation)", type="token" )
2430  public static final String SP_TYPE = "type";
2431 /**
2432   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2433   * <p>
2434   * Description: <b>The kind of coverage (health plan, auto, Workers Compensation)</b><br>
2435   * Type: <b>token</b><br>
2436   * Path: <b>Coverage.type</b><br>
2437   * </p>
2438   */
2439  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2440
2441 /**
2442   * Search parameter: <b>sequence</b>
2443   * <p>
2444   * Description: <b>Sequence number</b><br>
2445   * Type: <b>string</b><br>
2446   * Path: <b>Coverage.sequence</b><br>
2447   * </p>
2448   */
2449  @SearchParamDefinition(name="sequence", path="Coverage.sequence", description="Sequence number", type="string" )
2450  public static final String SP_SEQUENCE = "sequence";
2451 /**
2452   * <b>Fluent Client</b> search parameter constant for <b>sequence</b>
2453   * <p>
2454   * Description: <b>Sequence number</b><br>
2455   * Type: <b>string</b><br>
2456   * Path: <b>Coverage.sequence</b><br>
2457   * </p>
2458   */
2459  public static final ca.uhn.fhir.rest.gclient.StringClientParam SEQUENCE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_SEQUENCE);
2460
2461 /**
2462   * Search parameter: <b>payor</b>
2463   * <p>
2464   * Description: <b>The identity of the insurer or party paying for services</b><br>
2465   * Type: <b>reference</b><br>
2466   * Path: <b>Coverage.payor</b><br>
2467   * </p>
2468   */
2469  @SearchParamDefinition(name="payor", path="Coverage.payor", description="The identity of the insurer or party paying for services", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Organization.class, Patient.class, RelatedPerson.class } )
2470  public static final String SP_PAYOR = "payor";
2471 /**
2472   * <b>Fluent Client</b> search parameter constant for <b>payor</b>
2473   * <p>
2474   * Description: <b>The identity of the insurer or party paying for services</b><br>
2475   * Type: <b>reference</b><br>
2476   * Path: <b>Coverage.payor</b><br>
2477   * </p>
2478   */
2479  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PAYOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PAYOR);
2480
2481/**
2482   * Constant for fluent queries to be used to add include statements. Specifies
2483   * the path value of "<b>Coverage:payor</b>".
2484   */
2485  public static final ca.uhn.fhir.model.api.Include INCLUDE_PAYOR = new ca.uhn.fhir.model.api.Include("Coverage:payor").toLocked();
2486
2487 /**
2488   * Search parameter: <b>beneficiary</b>
2489   * <p>
2490   * Description: <b>Covered party</b><br>
2491   * Type: <b>reference</b><br>
2492   * Path: <b>Coverage.beneficiary</b><br>
2493   * </p>
2494   */
2495  @SearchParamDefinition(name="beneficiary", path="Coverage.beneficiary", description="Covered party", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
2496  public static final String SP_BENEFICIARY = "beneficiary";
2497 /**
2498   * <b>Fluent Client</b> search parameter constant for <b>beneficiary</b>
2499   * <p>
2500   * Description: <b>Covered party</b><br>
2501   * Type: <b>reference</b><br>
2502   * Path: <b>Coverage.beneficiary</b><br>
2503   * </p>
2504   */
2505  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BENEFICIARY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BENEFICIARY);
2506
2507/**
2508   * Constant for fluent queries to be used to add include statements. Specifies
2509   * the path value of "<b>Coverage:beneficiary</b>".
2510   */
2511  public static final ca.uhn.fhir.model.api.Include INCLUDE_BENEFICIARY = new ca.uhn.fhir.model.api.Include("Coverage:beneficiary").toLocked();
2512
2513 /**
2514   * Search parameter: <b>subclass</b>
2515   * <p>
2516   * Description: <b>Sub-class identifier</b><br>
2517   * Type: <b>string</b><br>
2518   * Path: <b>Coverage.grouping.subClass</b><br>
2519   * </p>
2520   */
2521  @SearchParamDefinition(name="subclass", path="Coverage.grouping.subClass", description="Sub-class identifier", type="string" )
2522  public static final String SP_SUBCLASS = "subclass";
2523 /**
2524   * <b>Fluent Client</b> search parameter constant for <b>subclass</b>
2525   * <p>
2526   * Description: <b>Sub-class identifier</b><br>
2527   * Type: <b>string</b><br>
2528   * Path: <b>Coverage.grouping.subClass</b><br>
2529   * </p>
2530   */
2531  public static final ca.uhn.fhir.rest.gclient.StringClientParam SUBCLASS = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_SUBCLASS);
2532
2533 /**
2534   * Search parameter: <b>plan</b>
2535   * <p>
2536   * Description: <b>A plan or policy identifier</b><br>
2537   * Type: <b>string</b><br>
2538   * Path: <b>Coverage.grouping.plan</b><br>
2539   * </p>
2540   */
2541  @SearchParamDefinition(name="plan", path="Coverage.grouping.plan", description="A plan or policy identifier", type="string" )
2542  public static final String SP_PLAN = "plan";
2543 /**
2544   * <b>Fluent Client</b> search parameter constant for <b>plan</b>
2545   * <p>
2546   * Description: <b>A plan or policy identifier</b><br>
2547   * Type: <b>string</b><br>
2548   * Path: <b>Coverage.grouping.plan</b><br>
2549   * </p>
2550   */
2551  public static final ca.uhn.fhir.rest.gclient.StringClientParam PLAN = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PLAN);
2552
2553 /**
2554   * Search parameter: <b>class</b>
2555   * <p>
2556   * Description: <b>Class identifier</b><br>
2557   * Type: <b>string</b><br>
2558   * Path: <b>Coverage.grouping.class</b><br>
2559   * </p>
2560   */
2561  @SearchParamDefinition(name="class", path="Coverage.grouping.class", description="Class identifier", type="string" )
2562  public static final String SP_CLASS = "class";
2563 /**
2564   * <b>Fluent Client</b> search parameter constant for <b>class</b>
2565   * <p>
2566   * Description: <b>Class identifier</b><br>
2567   * Type: <b>string</b><br>
2568   * Path: <b>Coverage.grouping.class</b><br>
2569   * </p>
2570   */
2571  public static final ca.uhn.fhir.rest.gclient.StringClientParam CLASS = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_CLASS);
2572
2573 /**
2574   * Search parameter: <b>dependent</b>
2575   * <p>
2576   * Description: <b>Dependent number</b><br>
2577   * Type: <b>string</b><br>
2578   * Path: <b>Coverage.dependent</b><br>
2579   * </p>
2580   */
2581  @SearchParamDefinition(name="dependent", path="Coverage.dependent", description="Dependent number", type="string" )
2582  public static final String SP_DEPENDENT = "dependent";
2583 /**
2584   * <b>Fluent Client</b> search parameter constant for <b>dependent</b>
2585   * <p>
2586   * Description: <b>Dependent number</b><br>
2587   * Type: <b>string</b><br>
2588   * Path: <b>Coverage.dependent</b><br>
2589   * </p>
2590   */
2591  public static final ca.uhn.fhir.rest.gclient.StringClientParam DEPENDENT = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DEPENDENT);
2592
2593 /**
2594   * Search parameter: <b>group</b>
2595   * <p>
2596   * Description: <b>Group identifier</b><br>
2597   * Type: <b>string</b><br>
2598   * Path: <b>Coverage.grouping.group</b><br>
2599   * </p>
2600   */
2601  @SearchParamDefinition(name="group", path="Coverage.grouping.group", description="Group identifier", type="string" )
2602  public static final String SP_GROUP = "group";
2603 /**
2604   * <b>Fluent Client</b> search parameter constant for <b>group</b>
2605   * <p>
2606   * Description: <b>Group identifier</b><br>
2607   * Type: <b>string</b><br>
2608   * Path: <b>Coverage.grouping.group</b><br>
2609   * </p>
2610   */
2611  public static final ca.uhn.fhir.rest.gclient.StringClientParam GROUP = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_GROUP);
2612
2613 /**
2614   * Search parameter: <b>policy-holder</b>
2615   * <p>
2616   * Description: <b>Reference to the policyholder</b><br>
2617   * Type: <b>reference</b><br>
2618   * Path: <b>Coverage.policyHolder</b><br>
2619   * </p>
2620   */
2621  @SearchParamDefinition(name="policy-holder", path="Coverage.policyHolder", description="Reference to the policyholder", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Organization.class, Patient.class, RelatedPerson.class } )
2622  public static final String SP_POLICY_HOLDER = "policy-holder";
2623 /**
2624   * <b>Fluent Client</b> search parameter constant for <b>policy-holder</b>
2625   * <p>
2626   * Description: <b>Reference to the policyholder</b><br>
2627   * Type: <b>reference</b><br>
2628   * Path: <b>Coverage.policyHolder</b><br>
2629   * </p>
2630   */
2631  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam POLICY_HOLDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_POLICY_HOLDER);
2632
2633/**
2634   * Constant for fluent queries to be used to add include statements. Specifies
2635   * the path value of "<b>Coverage:policy-holder</b>".
2636   */
2637  public static final ca.uhn.fhir.model.api.Include INCLUDE_POLICY_HOLDER = new ca.uhn.fhir.model.api.Include("Coverage:policy-holder").toLocked();
2638
2639
2640}
2641