001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import java.math.*;
060import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
061import org.hl7.fhir.utilities.Utilities;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069/**
070 * An authorization for the provision of glasses and/or contact lenses to a patient.
071 */
072@ResourceDef(name="VisionPrescription", profile="http://hl7.org/fhir/StructureDefinition/VisionPrescription")
073public class VisionPrescription extends DomainResource {
074
075    public enum VisionStatus {
076        /**
077         * The instance is currently in-force.
078         */
079        ACTIVE, 
080        /**
081         * The instance is withdrawn, rescinded or reversed.
082         */
083        CANCELLED, 
084        /**
085         * A new instance the contents of which is not complete.
086         */
087        DRAFT, 
088        /**
089         * The instance was entered in error.
090         */
091        ENTEREDINERROR, 
092        /**
093         * added to help the parsers with the generic types
094         */
095        NULL;
096        public static VisionStatus fromCode(String codeString) throws FHIRException {
097            if (codeString == null || "".equals(codeString))
098                return null;
099        if ("active".equals(codeString))
100          return ACTIVE;
101        if ("cancelled".equals(codeString))
102          return CANCELLED;
103        if ("draft".equals(codeString))
104          return DRAFT;
105        if ("entered-in-error".equals(codeString))
106          return ENTEREDINERROR;
107        if (Configuration.isAcceptInvalidEnums())
108          return null;
109        else
110          throw new FHIRException("Unknown VisionStatus code '"+codeString+"'");
111        }
112        public String toCode() {
113          switch (this) {
114            case ACTIVE: return "active";
115            case CANCELLED: return "cancelled";
116            case DRAFT: return "draft";
117            case ENTEREDINERROR: return "entered-in-error";
118            default: return "?";
119          }
120        }
121        public String getSystem() {
122          switch (this) {
123            case ACTIVE: return "http://hl7.org/fhir/fm-status";
124            case CANCELLED: return "http://hl7.org/fhir/fm-status";
125            case DRAFT: return "http://hl7.org/fhir/fm-status";
126            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
127            default: return "?";
128          }
129        }
130        public String getDefinition() {
131          switch (this) {
132            case ACTIVE: return "The instance is currently in-force.";
133            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
134            case DRAFT: return "A new instance the contents of which is not complete.";
135            case ENTEREDINERROR: return "The instance was entered in error.";
136            default: return "?";
137          }
138        }
139        public String getDisplay() {
140          switch (this) {
141            case ACTIVE: return "Active";
142            case CANCELLED: return "Cancelled";
143            case DRAFT: return "Draft";
144            case ENTEREDINERROR: return "Entered in Error";
145            default: return "?";
146          }
147        }
148    }
149
150  public static class VisionStatusEnumFactory implements EnumFactory<VisionStatus> {
151    public VisionStatus fromCode(String codeString) throws IllegalArgumentException {
152      if (codeString == null || "".equals(codeString))
153            if (codeString == null || "".equals(codeString))
154                return null;
155        if ("active".equals(codeString))
156          return VisionStatus.ACTIVE;
157        if ("cancelled".equals(codeString))
158          return VisionStatus.CANCELLED;
159        if ("draft".equals(codeString))
160          return VisionStatus.DRAFT;
161        if ("entered-in-error".equals(codeString))
162          return VisionStatus.ENTEREDINERROR;
163        throw new IllegalArgumentException("Unknown VisionStatus code '"+codeString+"'");
164        }
165        public Enumeration<VisionStatus> fromType(Base code) throws FHIRException {
166          if (code == null)
167            return null;
168          if (code.isEmpty())
169            return new Enumeration<VisionStatus>(this);
170          String codeString = ((PrimitiveType) code).asStringValue();
171          if (codeString == null || "".equals(codeString))
172            return null;
173        if ("active".equals(codeString))
174          return new Enumeration<VisionStatus>(this, VisionStatus.ACTIVE);
175        if ("cancelled".equals(codeString))
176          return new Enumeration<VisionStatus>(this, VisionStatus.CANCELLED);
177        if ("draft".equals(codeString))
178          return new Enumeration<VisionStatus>(this, VisionStatus.DRAFT);
179        if ("entered-in-error".equals(codeString))
180          return new Enumeration<VisionStatus>(this, VisionStatus.ENTEREDINERROR);
181        throw new FHIRException("Unknown VisionStatus code '"+codeString+"'");
182        }
183    public String toCode(VisionStatus code) {
184      if (code == VisionStatus.ACTIVE)
185        return "active";
186      if (code == VisionStatus.CANCELLED)
187        return "cancelled";
188      if (code == VisionStatus.DRAFT)
189        return "draft";
190      if (code == VisionStatus.ENTEREDINERROR)
191        return "entered-in-error";
192      return "?";
193      }
194    public String toSystem(VisionStatus code) {
195      return code.getSystem();
196      }
197    }
198
199    public enum VisionEyes {
200        /**
201         * Right Eye.
202         */
203        RIGHT, 
204        /**
205         * Left Eye.
206         */
207        LEFT, 
208        /**
209         * added to help the parsers with the generic types
210         */
211        NULL;
212        public static VisionEyes fromCode(String codeString) throws FHIRException {
213            if (codeString == null || "".equals(codeString))
214                return null;
215        if ("right".equals(codeString))
216          return RIGHT;
217        if ("left".equals(codeString))
218          return LEFT;
219        if (Configuration.isAcceptInvalidEnums())
220          return null;
221        else
222          throw new FHIRException("Unknown VisionEyes code '"+codeString+"'");
223        }
224        public String toCode() {
225          switch (this) {
226            case RIGHT: return "right";
227            case LEFT: return "left";
228            default: return "?";
229          }
230        }
231        public String getSystem() {
232          switch (this) {
233            case RIGHT: return "http://hl7.org/fhir/vision-eye-codes";
234            case LEFT: return "http://hl7.org/fhir/vision-eye-codes";
235            default: return "?";
236          }
237        }
238        public String getDefinition() {
239          switch (this) {
240            case RIGHT: return "Right Eye.";
241            case LEFT: return "Left Eye.";
242            default: return "?";
243          }
244        }
245        public String getDisplay() {
246          switch (this) {
247            case RIGHT: return "Right Eye";
248            case LEFT: return "Left Eye";
249            default: return "?";
250          }
251        }
252    }
253
254  public static class VisionEyesEnumFactory implements EnumFactory<VisionEyes> {
255    public VisionEyes fromCode(String codeString) throws IllegalArgumentException {
256      if (codeString == null || "".equals(codeString))
257            if (codeString == null || "".equals(codeString))
258                return null;
259        if ("right".equals(codeString))
260          return VisionEyes.RIGHT;
261        if ("left".equals(codeString))
262          return VisionEyes.LEFT;
263        throw new IllegalArgumentException("Unknown VisionEyes code '"+codeString+"'");
264        }
265        public Enumeration<VisionEyes> fromType(Base code) throws FHIRException {
266          if (code == null)
267            return null;
268          if (code.isEmpty())
269            return new Enumeration<VisionEyes>(this);
270          String codeString = ((PrimitiveType) code).asStringValue();
271          if (codeString == null || "".equals(codeString))
272            return null;
273        if ("right".equals(codeString))
274          return new Enumeration<VisionEyes>(this, VisionEyes.RIGHT);
275        if ("left".equals(codeString))
276          return new Enumeration<VisionEyes>(this, VisionEyes.LEFT);
277        throw new FHIRException("Unknown VisionEyes code '"+codeString+"'");
278        }
279    public String toCode(VisionEyes code) {
280      if (code == VisionEyes.RIGHT)
281        return "right";
282      if (code == VisionEyes.LEFT)
283        return "left";
284      return "?";
285      }
286    public String toSystem(VisionEyes code) {
287      return code.getSystem();
288      }
289    }
290
291    public enum VisionBase {
292        /**
293         * top.
294         */
295        UP, 
296        /**
297         * bottom.
298         */
299        DOWN, 
300        /**
301         * inner edge.
302         */
303        IN, 
304        /**
305         * outer edge.
306         */
307        OUT, 
308        /**
309         * added to help the parsers with the generic types
310         */
311        NULL;
312        public static VisionBase fromCode(String codeString) throws FHIRException {
313            if (codeString == null || "".equals(codeString))
314                return null;
315        if ("up".equals(codeString))
316          return UP;
317        if ("down".equals(codeString))
318          return DOWN;
319        if ("in".equals(codeString))
320          return IN;
321        if ("out".equals(codeString))
322          return OUT;
323        if (Configuration.isAcceptInvalidEnums())
324          return null;
325        else
326          throw new FHIRException("Unknown VisionBase code '"+codeString+"'");
327        }
328        public String toCode() {
329          switch (this) {
330            case UP: return "up";
331            case DOWN: return "down";
332            case IN: return "in";
333            case OUT: return "out";
334            default: return "?";
335          }
336        }
337        public String getSystem() {
338          switch (this) {
339            case UP: return "http://hl7.org/fhir/vision-base-codes";
340            case DOWN: return "http://hl7.org/fhir/vision-base-codes";
341            case IN: return "http://hl7.org/fhir/vision-base-codes";
342            case OUT: return "http://hl7.org/fhir/vision-base-codes";
343            default: return "?";
344          }
345        }
346        public String getDefinition() {
347          switch (this) {
348            case UP: return "top.";
349            case DOWN: return "bottom.";
350            case IN: return "inner edge.";
351            case OUT: return "outer edge.";
352            default: return "?";
353          }
354        }
355        public String getDisplay() {
356          switch (this) {
357            case UP: return "Up";
358            case DOWN: return "Down";
359            case IN: return "In";
360            case OUT: return "Out";
361            default: return "?";
362          }
363        }
364    }
365
366  public static class VisionBaseEnumFactory implements EnumFactory<VisionBase> {
367    public VisionBase fromCode(String codeString) throws IllegalArgumentException {
368      if (codeString == null || "".equals(codeString))
369            if (codeString == null || "".equals(codeString))
370                return null;
371        if ("up".equals(codeString))
372          return VisionBase.UP;
373        if ("down".equals(codeString))
374          return VisionBase.DOWN;
375        if ("in".equals(codeString))
376          return VisionBase.IN;
377        if ("out".equals(codeString))
378          return VisionBase.OUT;
379        throw new IllegalArgumentException("Unknown VisionBase code '"+codeString+"'");
380        }
381        public Enumeration<VisionBase> fromType(Base code) throws FHIRException {
382          if (code == null)
383            return null;
384          if (code.isEmpty())
385            return new Enumeration<VisionBase>(this);
386          String codeString = ((PrimitiveType) code).asStringValue();
387          if (codeString == null || "".equals(codeString))
388            return null;
389        if ("up".equals(codeString))
390          return new Enumeration<VisionBase>(this, VisionBase.UP);
391        if ("down".equals(codeString))
392          return new Enumeration<VisionBase>(this, VisionBase.DOWN);
393        if ("in".equals(codeString))
394          return new Enumeration<VisionBase>(this, VisionBase.IN);
395        if ("out".equals(codeString))
396          return new Enumeration<VisionBase>(this, VisionBase.OUT);
397        throw new FHIRException("Unknown VisionBase code '"+codeString+"'");
398        }
399    public String toCode(VisionBase code) {
400      if (code == VisionBase.UP)
401        return "up";
402      if (code == VisionBase.DOWN)
403        return "down";
404      if (code == VisionBase.IN)
405        return "in";
406      if (code == VisionBase.OUT)
407        return "out";
408      return "?";
409      }
410    public String toSystem(VisionBase code) {
411      return code.getSystem();
412      }
413    }
414
415    @Block()
416    public static class VisionPrescriptionLensSpecificationComponent extends BackboneElement implements IBaseBackboneElement {
417        /**
418         * Identifies the type of vision correction product which is required for the patient.
419         */
420        @Child(name = "product", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
421        @Description(shortDefinition="Product to be supplied", formalDefinition="Identifies the type of vision correction product which is required for the patient." )
422        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vision-product")
423        protected CodeableConcept product;
424
425        /**
426         * The eye for which the lens specification applies.
427         */
428        @Child(name = "eye", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
429        @Description(shortDefinition="right | left", formalDefinition="The eye for which the lens specification applies." )
430        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vision-eye-codes")
431        protected Enumeration<VisionEyes> eye;
432
433        /**
434         * Lens power measured in dioptres (0.25 units).
435         */
436        @Child(name = "sphere", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=false)
437        @Description(shortDefinition="Power of the lens", formalDefinition="Lens power measured in dioptres (0.25 units)." )
438        protected DecimalType sphere;
439
440        /**
441         * Power adjustment for astigmatism measured in dioptres (0.25 units).
442         */
443        @Child(name = "cylinder", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
444        @Description(shortDefinition="Lens power for astigmatism", formalDefinition="Power adjustment for astigmatism measured in dioptres (0.25 units)." )
445        protected DecimalType cylinder;
446
447        /**
448         * Adjustment for astigmatism measured in integer degrees.
449         */
450        @Child(name = "axis", type = {IntegerType.class}, order=5, min=0, max=1, modifier=false, summary=false)
451        @Description(shortDefinition="Lens meridian which contain no power for astigmatism", formalDefinition="Adjustment for astigmatism measured in integer degrees." )
452        protected IntegerType axis;
453
454        /**
455         * Allows for adjustment on two axis.
456         */
457        @Child(name = "prism", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
458        @Description(shortDefinition="Eye alignment compensation", formalDefinition="Allows for adjustment on two axis." )
459        protected List<PrismComponent> prism;
460
461        /**
462         * Power adjustment for multifocal lenses measured in dioptres (0.25 units).
463         */
464        @Child(name = "add", type = {DecimalType.class}, order=7, min=0, max=1, modifier=false, summary=false)
465        @Description(shortDefinition="Added power for multifocal levels", formalDefinition="Power adjustment for multifocal lenses measured in dioptres (0.25 units)." )
466        protected DecimalType add;
467
468        /**
469         * Contact lens power measured in dioptres (0.25 units).
470         */
471        @Child(name = "power", type = {DecimalType.class}, order=8, min=0, max=1, modifier=false, summary=false)
472        @Description(shortDefinition="Contact lens power", formalDefinition="Contact lens power measured in dioptres (0.25 units)." )
473        protected DecimalType power;
474
475        /**
476         * Back curvature measured in millimetres.
477         */
478        @Child(name = "backCurve", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
479        @Description(shortDefinition="Contact lens back curvature", formalDefinition="Back curvature measured in millimetres." )
480        protected DecimalType backCurve;
481
482        /**
483         * Contact lens diameter measured in millimetres.
484         */
485        @Child(name = "diameter", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
486        @Description(shortDefinition="Contact lens diameter", formalDefinition="Contact lens diameter measured in millimetres." )
487        protected DecimalType diameter;
488
489        /**
490         * The recommended maximum wear period for the lens.
491         */
492        @Child(name = "duration", type = {Quantity.class}, order=11, min=0, max=1, modifier=false, summary=false)
493        @Description(shortDefinition="Lens wear duration", formalDefinition="The recommended maximum wear period for the lens." )
494        protected Quantity duration;
495
496        /**
497         * Special color or pattern.
498         */
499        @Child(name = "color", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
500        @Description(shortDefinition="Color required", formalDefinition="Special color or pattern." )
501        protected StringType color;
502
503        /**
504         * Brand recommendations or restrictions.
505         */
506        @Child(name = "brand", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=false)
507        @Description(shortDefinition="Brand required", formalDefinition="Brand recommendations or restrictions." )
508        protected StringType brand;
509
510        /**
511         * Notes for special requirements such as coatings and lens materials.
512         */
513        @Child(name = "note", type = {Annotation.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
514        @Description(shortDefinition="Notes for coatings", formalDefinition="Notes for special requirements such as coatings and lens materials." )
515        protected List<Annotation> note;
516
517        private static final long serialVersionUID = 688924460L;
518
519    /**
520     * Constructor
521     */
522      public VisionPrescriptionLensSpecificationComponent() {
523        super();
524      }
525
526    /**
527     * Constructor
528     */
529      public VisionPrescriptionLensSpecificationComponent(CodeableConcept product, Enumeration<VisionEyes> eye) {
530        super();
531        this.product = product;
532        this.eye = eye;
533      }
534
535        /**
536         * @return {@link #product} (Identifies the type of vision correction product which is required for the patient.)
537         */
538        public CodeableConcept getProduct() { 
539          if (this.product == null)
540            if (Configuration.errorOnAutoCreate())
541              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.product");
542            else if (Configuration.doAutoCreate())
543              this.product = new CodeableConcept(); // cc
544          return this.product;
545        }
546
547        public boolean hasProduct() { 
548          return this.product != null && !this.product.isEmpty();
549        }
550
551        /**
552         * @param value {@link #product} (Identifies the type of vision correction product which is required for the patient.)
553         */
554        public VisionPrescriptionLensSpecificationComponent setProduct(CodeableConcept value) { 
555          this.product = value;
556          return this;
557        }
558
559        /**
560         * @return {@link #eye} (The eye for which the lens specification applies.). This is the underlying object with id, value and extensions. The accessor "getEye" gives direct access to the value
561         */
562        public Enumeration<VisionEyes> getEyeElement() { 
563          if (this.eye == null)
564            if (Configuration.errorOnAutoCreate())
565              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.eye");
566            else if (Configuration.doAutoCreate())
567              this.eye = new Enumeration<VisionEyes>(new VisionEyesEnumFactory()); // bb
568          return this.eye;
569        }
570
571        public boolean hasEyeElement() { 
572          return this.eye != null && !this.eye.isEmpty();
573        }
574
575        public boolean hasEye() { 
576          return this.eye != null && !this.eye.isEmpty();
577        }
578
579        /**
580         * @param value {@link #eye} (The eye for which the lens specification applies.). This is the underlying object with id, value and extensions. The accessor "getEye" gives direct access to the value
581         */
582        public VisionPrescriptionLensSpecificationComponent setEyeElement(Enumeration<VisionEyes> value) { 
583          this.eye = value;
584          return this;
585        }
586
587        /**
588         * @return The eye for which the lens specification applies.
589         */
590        public VisionEyes getEye() { 
591          return this.eye == null ? null : this.eye.getValue();
592        }
593
594        /**
595         * @param value The eye for which the lens specification applies.
596         */
597        public VisionPrescriptionLensSpecificationComponent setEye(VisionEyes value) { 
598            if (this.eye == null)
599              this.eye = new Enumeration<VisionEyes>(new VisionEyesEnumFactory());
600            this.eye.setValue(value);
601          return this;
602        }
603
604        /**
605         * @return {@link #sphere} (Lens power measured in dioptres (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getSphere" gives direct access to the value
606         */
607        public DecimalType getSphereElement() { 
608          if (this.sphere == null)
609            if (Configuration.errorOnAutoCreate())
610              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.sphere");
611            else if (Configuration.doAutoCreate())
612              this.sphere = new DecimalType(); // bb
613          return this.sphere;
614        }
615
616        public boolean hasSphereElement() { 
617          return this.sphere != null && !this.sphere.isEmpty();
618        }
619
620        public boolean hasSphere() { 
621          return this.sphere != null && !this.sphere.isEmpty();
622        }
623
624        /**
625         * @param value {@link #sphere} (Lens power measured in dioptres (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getSphere" gives direct access to the value
626         */
627        public VisionPrescriptionLensSpecificationComponent setSphereElement(DecimalType value) { 
628          this.sphere = value;
629          return this;
630        }
631
632        /**
633         * @return Lens power measured in dioptres (0.25 units).
634         */
635        public BigDecimal getSphere() { 
636          return this.sphere == null ? null : this.sphere.getValue();
637        }
638
639        /**
640         * @param value Lens power measured in dioptres (0.25 units).
641         */
642        public VisionPrescriptionLensSpecificationComponent setSphere(BigDecimal value) { 
643          if (value == null)
644            this.sphere = null;
645          else {
646            if (this.sphere == null)
647              this.sphere = new DecimalType();
648            this.sphere.setValue(value);
649          }
650          return this;
651        }
652
653        /**
654         * @param value Lens power measured in dioptres (0.25 units).
655         */
656        public VisionPrescriptionLensSpecificationComponent setSphere(long value) { 
657              this.sphere = new DecimalType();
658            this.sphere.setValue(value);
659          return this;
660        }
661
662        /**
663         * @param value Lens power measured in dioptres (0.25 units).
664         */
665        public VisionPrescriptionLensSpecificationComponent setSphere(double value) { 
666              this.sphere = new DecimalType();
667            this.sphere.setValue(value);
668          return this;
669        }
670
671        /**
672         * @return {@link #cylinder} (Power adjustment for astigmatism measured in dioptres (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getCylinder" gives direct access to the value
673         */
674        public DecimalType getCylinderElement() { 
675          if (this.cylinder == null)
676            if (Configuration.errorOnAutoCreate())
677              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.cylinder");
678            else if (Configuration.doAutoCreate())
679              this.cylinder = new DecimalType(); // bb
680          return this.cylinder;
681        }
682
683        public boolean hasCylinderElement() { 
684          return this.cylinder != null && !this.cylinder.isEmpty();
685        }
686
687        public boolean hasCylinder() { 
688          return this.cylinder != null && !this.cylinder.isEmpty();
689        }
690
691        /**
692         * @param value {@link #cylinder} (Power adjustment for astigmatism measured in dioptres (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getCylinder" gives direct access to the value
693         */
694        public VisionPrescriptionLensSpecificationComponent setCylinderElement(DecimalType value) { 
695          this.cylinder = value;
696          return this;
697        }
698
699        /**
700         * @return Power adjustment for astigmatism measured in dioptres (0.25 units).
701         */
702        public BigDecimal getCylinder() { 
703          return this.cylinder == null ? null : this.cylinder.getValue();
704        }
705
706        /**
707         * @param value Power adjustment for astigmatism measured in dioptres (0.25 units).
708         */
709        public VisionPrescriptionLensSpecificationComponent setCylinder(BigDecimal value) { 
710          if (value == null)
711            this.cylinder = null;
712          else {
713            if (this.cylinder == null)
714              this.cylinder = new DecimalType();
715            this.cylinder.setValue(value);
716          }
717          return this;
718        }
719
720        /**
721         * @param value Power adjustment for astigmatism measured in dioptres (0.25 units).
722         */
723        public VisionPrescriptionLensSpecificationComponent setCylinder(long value) { 
724              this.cylinder = new DecimalType();
725            this.cylinder.setValue(value);
726          return this;
727        }
728
729        /**
730         * @param value Power adjustment for astigmatism measured in dioptres (0.25 units).
731         */
732        public VisionPrescriptionLensSpecificationComponent setCylinder(double value) { 
733              this.cylinder = new DecimalType();
734            this.cylinder.setValue(value);
735          return this;
736        }
737
738        /**
739         * @return {@link #axis} (Adjustment for astigmatism measured in integer degrees.). This is the underlying object with id, value and extensions. The accessor "getAxis" gives direct access to the value
740         */
741        public IntegerType getAxisElement() { 
742          if (this.axis == null)
743            if (Configuration.errorOnAutoCreate())
744              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.axis");
745            else if (Configuration.doAutoCreate())
746              this.axis = new IntegerType(); // bb
747          return this.axis;
748        }
749
750        public boolean hasAxisElement() { 
751          return this.axis != null && !this.axis.isEmpty();
752        }
753
754        public boolean hasAxis() { 
755          return this.axis != null && !this.axis.isEmpty();
756        }
757
758        /**
759         * @param value {@link #axis} (Adjustment for astigmatism measured in integer degrees.). This is the underlying object with id, value and extensions. The accessor "getAxis" gives direct access to the value
760         */
761        public VisionPrescriptionLensSpecificationComponent setAxisElement(IntegerType value) { 
762          this.axis = value;
763          return this;
764        }
765
766        /**
767         * @return Adjustment for astigmatism measured in integer degrees.
768         */
769        public int getAxis() { 
770          return this.axis == null || this.axis.isEmpty() ? 0 : this.axis.getValue();
771        }
772
773        /**
774         * @param value Adjustment for astigmatism measured in integer degrees.
775         */
776        public VisionPrescriptionLensSpecificationComponent setAxis(int value) { 
777            if (this.axis == null)
778              this.axis = new IntegerType();
779            this.axis.setValue(value);
780          return this;
781        }
782
783        /**
784         * @return {@link #prism} (Allows for adjustment on two axis.)
785         */
786        public List<PrismComponent> getPrism() { 
787          if (this.prism == null)
788            this.prism = new ArrayList<PrismComponent>();
789          return this.prism;
790        }
791
792        /**
793         * @return Returns a reference to <code>this</code> for easy method chaining
794         */
795        public VisionPrescriptionLensSpecificationComponent setPrism(List<PrismComponent> thePrism) { 
796          this.prism = thePrism;
797          return this;
798        }
799
800        public boolean hasPrism() { 
801          if (this.prism == null)
802            return false;
803          for (PrismComponent item : this.prism)
804            if (!item.isEmpty())
805              return true;
806          return false;
807        }
808
809        public PrismComponent addPrism() { //3
810          PrismComponent t = new PrismComponent();
811          if (this.prism == null)
812            this.prism = new ArrayList<PrismComponent>();
813          this.prism.add(t);
814          return t;
815        }
816
817        public VisionPrescriptionLensSpecificationComponent addPrism(PrismComponent t) { //3
818          if (t == null)
819            return this;
820          if (this.prism == null)
821            this.prism = new ArrayList<PrismComponent>();
822          this.prism.add(t);
823          return this;
824        }
825
826        /**
827         * @return The first repetition of repeating field {@link #prism}, creating it if it does not already exist
828         */
829        public PrismComponent getPrismFirstRep() { 
830          if (getPrism().isEmpty()) {
831            addPrism();
832          }
833          return getPrism().get(0);
834        }
835
836        /**
837         * @return {@link #add} (Power adjustment for multifocal lenses measured in dioptres (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getAdd" gives direct access to the value
838         */
839        public DecimalType getAddElement() { 
840          if (this.add == null)
841            if (Configuration.errorOnAutoCreate())
842              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.add");
843            else if (Configuration.doAutoCreate())
844              this.add = new DecimalType(); // bb
845          return this.add;
846        }
847
848        public boolean hasAddElement() { 
849          return this.add != null && !this.add.isEmpty();
850        }
851
852        public boolean hasAdd() { 
853          return this.add != null && !this.add.isEmpty();
854        }
855
856        /**
857         * @param value {@link #add} (Power adjustment for multifocal lenses measured in dioptres (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getAdd" gives direct access to the value
858         */
859        public VisionPrescriptionLensSpecificationComponent setAddElement(DecimalType value) { 
860          this.add = value;
861          return this;
862        }
863
864        /**
865         * @return Power adjustment for multifocal lenses measured in dioptres (0.25 units).
866         */
867        public BigDecimal getAdd() { 
868          return this.add == null ? null : this.add.getValue();
869        }
870
871        /**
872         * @param value Power adjustment for multifocal lenses measured in dioptres (0.25 units).
873         */
874        public VisionPrescriptionLensSpecificationComponent setAdd(BigDecimal value) { 
875          if (value == null)
876            this.add = null;
877          else {
878            if (this.add == null)
879              this.add = new DecimalType();
880            this.add.setValue(value);
881          }
882          return this;
883        }
884
885        /**
886         * @param value Power adjustment for multifocal lenses measured in dioptres (0.25 units).
887         */
888        public VisionPrescriptionLensSpecificationComponent setAdd(long value) { 
889              this.add = new DecimalType();
890            this.add.setValue(value);
891          return this;
892        }
893
894        /**
895         * @param value Power adjustment for multifocal lenses measured in dioptres (0.25 units).
896         */
897        public VisionPrescriptionLensSpecificationComponent setAdd(double value) { 
898              this.add = new DecimalType();
899            this.add.setValue(value);
900          return this;
901        }
902
903        /**
904         * @return {@link #power} (Contact lens power measured in dioptres (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getPower" gives direct access to the value
905         */
906        public DecimalType getPowerElement() { 
907          if (this.power == null)
908            if (Configuration.errorOnAutoCreate())
909              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.power");
910            else if (Configuration.doAutoCreate())
911              this.power = new DecimalType(); // bb
912          return this.power;
913        }
914
915        public boolean hasPowerElement() { 
916          return this.power != null && !this.power.isEmpty();
917        }
918
919        public boolean hasPower() { 
920          return this.power != null && !this.power.isEmpty();
921        }
922
923        /**
924         * @param value {@link #power} (Contact lens power measured in dioptres (0.25 units).). This is the underlying object with id, value and extensions. The accessor "getPower" gives direct access to the value
925         */
926        public VisionPrescriptionLensSpecificationComponent setPowerElement(DecimalType value) { 
927          this.power = value;
928          return this;
929        }
930
931        /**
932         * @return Contact lens power measured in dioptres (0.25 units).
933         */
934        public BigDecimal getPower() { 
935          return this.power == null ? null : this.power.getValue();
936        }
937
938        /**
939         * @param value Contact lens power measured in dioptres (0.25 units).
940         */
941        public VisionPrescriptionLensSpecificationComponent setPower(BigDecimal value) { 
942          if (value == null)
943            this.power = null;
944          else {
945            if (this.power == null)
946              this.power = new DecimalType();
947            this.power.setValue(value);
948          }
949          return this;
950        }
951
952        /**
953         * @param value Contact lens power measured in dioptres (0.25 units).
954         */
955        public VisionPrescriptionLensSpecificationComponent setPower(long value) { 
956              this.power = new DecimalType();
957            this.power.setValue(value);
958          return this;
959        }
960
961        /**
962         * @param value Contact lens power measured in dioptres (0.25 units).
963         */
964        public VisionPrescriptionLensSpecificationComponent setPower(double value) { 
965              this.power = new DecimalType();
966            this.power.setValue(value);
967          return this;
968        }
969
970        /**
971         * @return {@link #backCurve} (Back curvature measured in millimetres.). This is the underlying object with id, value and extensions. The accessor "getBackCurve" gives direct access to the value
972         */
973        public DecimalType getBackCurveElement() { 
974          if (this.backCurve == null)
975            if (Configuration.errorOnAutoCreate())
976              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.backCurve");
977            else if (Configuration.doAutoCreate())
978              this.backCurve = new DecimalType(); // bb
979          return this.backCurve;
980        }
981
982        public boolean hasBackCurveElement() { 
983          return this.backCurve != null && !this.backCurve.isEmpty();
984        }
985
986        public boolean hasBackCurve() { 
987          return this.backCurve != null && !this.backCurve.isEmpty();
988        }
989
990        /**
991         * @param value {@link #backCurve} (Back curvature measured in millimetres.). This is the underlying object with id, value and extensions. The accessor "getBackCurve" gives direct access to the value
992         */
993        public VisionPrescriptionLensSpecificationComponent setBackCurveElement(DecimalType value) { 
994          this.backCurve = value;
995          return this;
996        }
997
998        /**
999         * @return Back curvature measured in millimetres.
1000         */
1001        public BigDecimal getBackCurve() { 
1002          return this.backCurve == null ? null : this.backCurve.getValue();
1003        }
1004
1005        /**
1006         * @param value Back curvature measured in millimetres.
1007         */
1008        public VisionPrescriptionLensSpecificationComponent setBackCurve(BigDecimal value) { 
1009          if (value == null)
1010            this.backCurve = null;
1011          else {
1012            if (this.backCurve == null)
1013              this.backCurve = new DecimalType();
1014            this.backCurve.setValue(value);
1015          }
1016          return this;
1017        }
1018
1019        /**
1020         * @param value Back curvature measured in millimetres.
1021         */
1022        public VisionPrescriptionLensSpecificationComponent setBackCurve(long value) { 
1023              this.backCurve = new DecimalType();
1024            this.backCurve.setValue(value);
1025          return this;
1026        }
1027
1028        /**
1029         * @param value Back curvature measured in millimetres.
1030         */
1031        public VisionPrescriptionLensSpecificationComponent setBackCurve(double value) { 
1032              this.backCurve = new DecimalType();
1033            this.backCurve.setValue(value);
1034          return this;
1035        }
1036
1037        /**
1038         * @return {@link #diameter} (Contact lens diameter measured in millimetres.). This is the underlying object with id, value and extensions. The accessor "getDiameter" gives direct access to the value
1039         */
1040        public DecimalType getDiameterElement() { 
1041          if (this.diameter == null)
1042            if (Configuration.errorOnAutoCreate())
1043              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.diameter");
1044            else if (Configuration.doAutoCreate())
1045              this.diameter = new DecimalType(); // bb
1046          return this.diameter;
1047        }
1048
1049        public boolean hasDiameterElement() { 
1050          return this.diameter != null && !this.diameter.isEmpty();
1051        }
1052
1053        public boolean hasDiameter() { 
1054          return this.diameter != null && !this.diameter.isEmpty();
1055        }
1056
1057        /**
1058         * @param value {@link #diameter} (Contact lens diameter measured in millimetres.). This is the underlying object with id, value and extensions. The accessor "getDiameter" gives direct access to the value
1059         */
1060        public VisionPrescriptionLensSpecificationComponent setDiameterElement(DecimalType value) { 
1061          this.diameter = value;
1062          return this;
1063        }
1064
1065        /**
1066         * @return Contact lens diameter measured in millimetres.
1067         */
1068        public BigDecimal getDiameter() { 
1069          return this.diameter == null ? null : this.diameter.getValue();
1070        }
1071
1072        /**
1073         * @param value Contact lens diameter measured in millimetres.
1074         */
1075        public VisionPrescriptionLensSpecificationComponent setDiameter(BigDecimal value) { 
1076          if (value == null)
1077            this.diameter = null;
1078          else {
1079            if (this.diameter == null)
1080              this.diameter = new DecimalType();
1081            this.diameter.setValue(value);
1082          }
1083          return this;
1084        }
1085
1086        /**
1087         * @param value Contact lens diameter measured in millimetres.
1088         */
1089        public VisionPrescriptionLensSpecificationComponent setDiameter(long value) { 
1090              this.diameter = new DecimalType();
1091            this.diameter.setValue(value);
1092          return this;
1093        }
1094
1095        /**
1096         * @param value Contact lens diameter measured in millimetres.
1097         */
1098        public VisionPrescriptionLensSpecificationComponent setDiameter(double value) { 
1099              this.diameter = new DecimalType();
1100            this.diameter.setValue(value);
1101          return this;
1102        }
1103
1104        /**
1105         * @return {@link #duration} (The recommended maximum wear period for the lens.)
1106         */
1107        public Quantity getDuration() { 
1108          if (this.duration == null)
1109            if (Configuration.errorOnAutoCreate())
1110              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.duration");
1111            else if (Configuration.doAutoCreate())
1112              this.duration = new Quantity(); // cc
1113          return this.duration;
1114        }
1115
1116        public boolean hasDuration() { 
1117          return this.duration != null && !this.duration.isEmpty();
1118        }
1119
1120        /**
1121         * @param value {@link #duration} (The recommended maximum wear period for the lens.)
1122         */
1123        public VisionPrescriptionLensSpecificationComponent setDuration(Quantity value) { 
1124          this.duration = value;
1125          return this;
1126        }
1127
1128        /**
1129         * @return {@link #color} (Special color or pattern.). This is the underlying object with id, value and extensions. The accessor "getColor" gives direct access to the value
1130         */
1131        public StringType getColorElement() { 
1132          if (this.color == null)
1133            if (Configuration.errorOnAutoCreate())
1134              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.color");
1135            else if (Configuration.doAutoCreate())
1136              this.color = new StringType(); // bb
1137          return this.color;
1138        }
1139
1140        public boolean hasColorElement() { 
1141          return this.color != null && !this.color.isEmpty();
1142        }
1143
1144        public boolean hasColor() { 
1145          return this.color != null && !this.color.isEmpty();
1146        }
1147
1148        /**
1149         * @param value {@link #color} (Special color or pattern.). This is the underlying object with id, value and extensions. The accessor "getColor" gives direct access to the value
1150         */
1151        public VisionPrescriptionLensSpecificationComponent setColorElement(StringType value) { 
1152          this.color = value;
1153          return this;
1154        }
1155
1156        /**
1157         * @return Special color or pattern.
1158         */
1159        public String getColor() { 
1160          return this.color == null ? null : this.color.getValue();
1161        }
1162
1163        /**
1164         * @param value Special color or pattern.
1165         */
1166        public VisionPrescriptionLensSpecificationComponent setColor(String value) { 
1167          if (Utilities.noString(value))
1168            this.color = null;
1169          else {
1170            if (this.color == null)
1171              this.color = new StringType();
1172            this.color.setValue(value);
1173          }
1174          return this;
1175        }
1176
1177        /**
1178         * @return {@link #brand} (Brand recommendations or restrictions.). This is the underlying object with id, value and extensions. The accessor "getBrand" gives direct access to the value
1179         */
1180        public StringType getBrandElement() { 
1181          if (this.brand == null)
1182            if (Configuration.errorOnAutoCreate())
1183              throw new Error("Attempt to auto-create VisionPrescriptionLensSpecificationComponent.brand");
1184            else if (Configuration.doAutoCreate())
1185              this.brand = new StringType(); // bb
1186          return this.brand;
1187        }
1188
1189        public boolean hasBrandElement() { 
1190          return this.brand != null && !this.brand.isEmpty();
1191        }
1192
1193        public boolean hasBrand() { 
1194          return this.brand != null && !this.brand.isEmpty();
1195        }
1196
1197        /**
1198         * @param value {@link #brand} (Brand recommendations or restrictions.). This is the underlying object with id, value and extensions. The accessor "getBrand" gives direct access to the value
1199         */
1200        public VisionPrescriptionLensSpecificationComponent setBrandElement(StringType value) { 
1201          this.brand = value;
1202          return this;
1203        }
1204
1205        /**
1206         * @return Brand recommendations or restrictions.
1207         */
1208        public String getBrand() { 
1209          return this.brand == null ? null : this.brand.getValue();
1210        }
1211
1212        /**
1213         * @param value Brand recommendations or restrictions.
1214         */
1215        public VisionPrescriptionLensSpecificationComponent setBrand(String value) { 
1216          if (Utilities.noString(value))
1217            this.brand = null;
1218          else {
1219            if (this.brand == null)
1220              this.brand = new StringType();
1221            this.brand.setValue(value);
1222          }
1223          return this;
1224        }
1225
1226        /**
1227         * @return {@link #note} (Notes for special requirements such as coatings and lens materials.)
1228         */
1229        public List<Annotation> getNote() { 
1230          if (this.note == null)
1231            this.note = new ArrayList<Annotation>();
1232          return this.note;
1233        }
1234
1235        /**
1236         * @return Returns a reference to <code>this</code> for easy method chaining
1237         */
1238        public VisionPrescriptionLensSpecificationComponent setNote(List<Annotation> theNote) { 
1239          this.note = theNote;
1240          return this;
1241        }
1242
1243        public boolean hasNote() { 
1244          if (this.note == null)
1245            return false;
1246          for (Annotation item : this.note)
1247            if (!item.isEmpty())
1248              return true;
1249          return false;
1250        }
1251
1252        public Annotation addNote() { //3
1253          Annotation t = new Annotation();
1254          if (this.note == null)
1255            this.note = new ArrayList<Annotation>();
1256          this.note.add(t);
1257          return t;
1258        }
1259
1260        public VisionPrescriptionLensSpecificationComponent addNote(Annotation t) { //3
1261          if (t == null)
1262            return this;
1263          if (this.note == null)
1264            this.note = new ArrayList<Annotation>();
1265          this.note.add(t);
1266          return this;
1267        }
1268
1269        /**
1270         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
1271         */
1272        public Annotation getNoteFirstRep() { 
1273          if (getNote().isEmpty()) {
1274            addNote();
1275          }
1276          return getNote().get(0);
1277        }
1278
1279        protected void listChildren(List<Property> children) {
1280          super.listChildren(children);
1281          children.add(new Property("product", "CodeableConcept", "Identifies the type of vision correction product which is required for the patient.", 0, 1, product));
1282          children.add(new Property("eye", "code", "The eye for which the lens specification applies.", 0, 1, eye));
1283          children.add(new Property("sphere", "decimal", "Lens power measured in dioptres (0.25 units).", 0, 1, sphere));
1284          children.add(new Property("cylinder", "decimal", "Power adjustment for astigmatism measured in dioptres (0.25 units).", 0, 1, cylinder));
1285          children.add(new Property("axis", "integer", "Adjustment for astigmatism measured in integer degrees.", 0, 1, axis));
1286          children.add(new Property("prism", "", "Allows for adjustment on two axis.", 0, java.lang.Integer.MAX_VALUE, prism));
1287          children.add(new Property("add", "decimal", "Power adjustment for multifocal lenses measured in dioptres (0.25 units).", 0, 1, add));
1288          children.add(new Property("power", "decimal", "Contact lens power measured in dioptres (0.25 units).", 0, 1, power));
1289          children.add(new Property("backCurve", "decimal", "Back curvature measured in millimetres.", 0, 1, backCurve));
1290          children.add(new Property("diameter", "decimal", "Contact lens diameter measured in millimetres.", 0, 1, diameter));
1291          children.add(new Property("duration", "SimpleQuantity", "The recommended maximum wear period for the lens.", 0, 1, duration));
1292          children.add(new Property("color", "string", "Special color or pattern.", 0, 1, color));
1293          children.add(new Property("brand", "string", "Brand recommendations or restrictions.", 0, 1, brand));
1294          children.add(new Property("note", "Annotation", "Notes for special requirements such as coatings and lens materials.", 0, java.lang.Integer.MAX_VALUE, note));
1295        }
1296
1297        @Override
1298        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1299          switch (_hash) {
1300          case -309474065: /*product*/  return new Property("product", "CodeableConcept", "Identifies the type of vision correction product which is required for the patient.", 0, 1, product);
1301          case 100913: /*eye*/  return new Property("eye", "code", "The eye for which the lens specification applies.", 0, 1, eye);
1302          case -895981619: /*sphere*/  return new Property("sphere", "decimal", "Lens power measured in dioptres (0.25 units).", 0, 1, sphere);
1303          case -349378602: /*cylinder*/  return new Property("cylinder", "decimal", "Power adjustment for astigmatism measured in dioptres (0.25 units).", 0, 1, cylinder);
1304          case 3008417: /*axis*/  return new Property("axis", "integer", "Adjustment for astigmatism measured in integer degrees.", 0, 1, axis);
1305          case 106935105: /*prism*/  return new Property("prism", "", "Allows for adjustment on two axis.", 0, java.lang.Integer.MAX_VALUE, prism);
1306          case 96417: /*add*/  return new Property("add", "decimal", "Power adjustment for multifocal lenses measured in dioptres (0.25 units).", 0, 1, add);
1307          case 106858757: /*power*/  return new Property("power", "decimal", "Contact lens power measured in dioptres (0.25 units).", 0, 1, power);
1308          case 1309344840: /*backCurve*/  return new Property("backCurve", "decimal", "Back curvature measured in millimetres.", 0, 1, backCurve);
1309          case -233204595: /*diameter*/  return new Property("diameter", "decimal", "Contact lens diameter measured in millimetres.", 0, 1, diameter);
1310          case -1992012396: /*duration*/  return new Property("duration", "SimpleQuantity", "The recommended maximum wear period for the lens.", 0, 1, duration);
1311          case 94842723: /*color*/  return new Property("color", "string", "Special color or pattern.", 0, 1, color);
1312          case 93997959: /*brand*/  return new Property("brand", "string", "Brand recommendations or restrictions.", 0, 1, brand);
1313          case 3387378: /*note*/  return new Property("note", "Annotation", "Notes for special requirements such as coatings and lens materials.", 0, java.lang.Integer.MAX_VALUE, note);
1314          default: return super.getNamedProperty(_hash, _name, _checkValid);
1315          }
1316
1317        }
1318
1319      @Override
1320      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1321        switch (hash) {
1322        case -309474065: /*product*/ return this.product == null ? new Base[0] : new Base[] {this.product}; // CodeableConcept
1323        case 100913: /*eye*/ return this.eye == null ? new Base[0] : new Base[] {this.eye}; // Enumeration<VisionEyes>
1324        case -895981619: /*sphere*/ return this.sphere == null ? new Base[0] : new Base[] {this.sphere}; // DecimalType
1325        case -349378602: /*cylinder*/ return this.cylinder == null ? new Base[0] : new Base[] {this.cylinder}; // DecimalType
1326        case 3008417: /*axis*/ return this.axis == null ? new Base[0] : new Base[] {this.axis}; // IntegerType
1327        case 106935105: /*prism*/ return this.prism == null ? new Base[0] : this.prism.toArray(new Base[this.prism.size()]); // PrismComponent
1328        case 96417: /*add*/ return this.add == null ? new Base[0] : new Base[] {this.add}; // DecimalType
1329        case 106858757: /*power*/ return this.power == null ? new Base[0] : new Base[] {this.power}; // DecimalType
1330        case 1309344840: /*backCurve*/ return this.backCurve == null ? new Base[0] : new Base[] {this.backCurve}; // DecimalType
1331        case -233204595: /*diameter*/ return this.diameter == null ? new Base[0] : new Base[] {this.diameter}; // DecimalType
1332        case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // Quantity
1333        case 94842723: /*color*/ return this.color == null ? new Base[0] : new Base[] {this.color}; // StringType
1334        case 93997959: /*brand*/ return this.brand == null ? new Base[0] : new Base[] {this.brand}; // StringType
1335        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1336        default: return super.getProperty(hash, name, checkValid);
1337        }
1338
1339      }
1340
1341      @Override
1342      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1343        switch (hash) {
1344        case -309474065: // product
1345          this.product = castToCodeableConcept(value); // CodeableConcept
1346          return value;
1347        case 100913: // eye
1348          value = new VisionEyesEnumFactory().fromType(castToCode(value));
1349          this.eye = (Enumeration) value; // Enumeration<VisionEyes>
1350          return value;
1351        case -895981619: // sphere
1352          this.sphere = castToDecimal(value); // DecimalType
1353          return value;
1354        case -349378602: // cylinder
1355          this.cylinder = castToDecimal(value); // DecimalType
1356          return value;
1357        case 3008417: // axis
1358          this.axis = castToInteger(value); // IntegerType
1359          return value;
1360        case 106935105: // prism
1361          this.getPrism().add((PrismComponent) value); // PrismComponent
1362          return value;
1363        case 96417: // add
1364          this.add = castToDecimal(value); // DecimalType
1365          return value;
1366        case 106858757: // power
1367          this.power = castToDecimal(value); // DecimalType
1368          return value;
1369        case 1309344840: // backCurve
1370          this.backCurve = castToDecimal(value); // DecimalType
1371          return value;
1372        case -233204595: // diameter
1373          this.diameter = castToDecimal(value); // DecimalType
1374          return value;
1375        case -1992012396: // duration
1376          this.duration = castToQuantity(value); // Quantity
1377          return value;
1378        case 94842723: // color
1379          this.color = castToString(value); // StringType
1380          return value;
1381        case 93997959: // brand
1382          this.brand = castToString(value); // StringType
1383          return value;
1384        case 3387378: // note
1385          this.getNote().add(castToAnnotation(value)); // Annotation
1386          return value;
1387        default: return super.setProperty(hash, name, value);
1388        }
1389
1390      }
1391
1392      @Override
1393      public Base setProperty(String name, Base value) throws FHIRException {
1394        if (name.equals("product")) {
1395          this.product = castToCodeableConcept(value); // CodeableConcept
1396        } else if (name.equals("eye")) {
1397          value = new VisionEyesEnumFactory().fromType(castToCode(value));
1398          this.eye = (Enumeration) value; // Enumeration<VisionEyes>
1399        } else if (name.equals("sphere")) {
1400          this.sphere = castToDecimal(value); // DecimalType
1401        } else if (name.equals("cylinder")) {
1402          this.cylinder = castToDecimal(value); // DecimalType
1403        } else if (name.equals("axis")) {
1404          this.axis = castToInteger(value); // IntegerType
1405        } else if (name.equals("prism")) {
1406          this.getPrism().add((PrismComponent) value);
1407        } else if (name.equals("add")) {
1408          this.add = castToDecimal(value); // DecimalType
1409        } else if (name.equals("power")) {
1410          this.power = castToDecimal(value); // DecimalType
1411        } else if (name.equals("backCurve")) {
1412          this.backCurve = castToDecimal(value); // DecimalType
1413        } else if (name.equals("diameter")) {
1414          this.diameter = castToDecimal(value); // DecimalType
1415        } else if (name.equals("duration")) {
1416          this.duration = castToQuantity(value); // Quantity
1417        } else if (name.equals("color")) {
1418          this.color = castToString(value); // StringType
1419        } else if (name.equals("brand")) {
1420          this.brand = castToString(value); // StringType
1421        } else if (name.equals("note")) {
1422          this.getNote().add(castToAnnotation(value));
1423        } else
1424          return super.setProperty(name, value);
1425        return value;
1426      }
1427
1428      @Override
1429      public Base makeProperty(int hash, String name) throws FHIRException {
1430        switch (hash) {
1431        case -309474065:  return getProduct();
1432        case 100913:  return getEyeElement();
1433        case -895981619:  return getSphereElement();
1434        case -349378602:  return getCylinderElement();
1435        case 3008417:  return getAxisElement();
1436        case 106935105:  return addPrism(); 
1437        case 96417:  return getAddElement();
1438        case 106858757:  return getPowerElement();
1439        case 1309344840:  return getBackCurveElement();
1440        case -233204595:  return getDiameterElement();
1441        case -1992012396:  return getDuration();
1442        case 94842723:  return getColorElement();
1443        case 93997959:  return getBrandElement();
1444        case 3387378:  return addNote(); 
1445        default: return super.makeProperty(hash, name);
1446        }
1447
1448      }
1449
1450      @Override
1451      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1452        switch (hash) {
1453        case -309474065: /*product*/ return new String[] {"CodeableConcept"};
1454        case 100913: /*eye*/ return new String[] {"code"};
1455        case -895981619: /*sphere*/ return new String[] {"decimal"};
1456        case -349378602: /*cylinder*/ return new String[] {"decimal"};
1457        case 3008417: /*axis*/ return new String[] {"integer"};
1458        case 106935105: /*prism*/ return new String[] {};
1459        case 96417: /*add*/ return new String[] {"decimal"};
1460        case 106858757: /*power*/ return new String[] {"decimal"};
1461        case 1309344840: /*backCurve*/ return new String[] {"decimal"};
1462        case -233204595: /*diameter*/ return new String[] {"decimal"};
1463        case -1992012396: /*duration*/ return new String[] {"SimpleQuantity"};
1464        case 94842723: /*color*/ return new String[] {"string"};
1465        case 93997959: /*brand*/ return new String[] {"string"};
1466        case 3387378: /*note*/ return new String[] {"Annotation"};
1467        default: return super.getTypesForProperty(hash, name);
1468        }
1469
1470      }
1471
1472      @Override
1473      public Base addChild(String name) throws FHIRException {
1474        if (name.equals("product")) {
1475          this.product = new CodeableConcept();
1476          return this.product;
1477        }
1478        else if (name.equals("eye")) {
1479          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.eye");
1480        }
1481        else if (name.equals("sphere")) {
1482          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.sphere");
1483        }
1484        else if (name.equals("cylinder")) {
1485          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.cylinder");
1486        }
1487        else if (name.equals("axis")) {
1488          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.axis");
1489        }
1490        else if (name.equals("prism")) {
1491          return addPrism();
1492        }
1493        else if (name.equals("add")) {
1494          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.add");
1495        }
1496        else if (name.equals("power")) {
1497          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.power");
1498        }
1499        else if (name.equals("backCurve")) {
1500          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.backCurve");
1501        }
1502        else if (name.equals("diameter")) {
1503          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.diameter");
1504        }
1505        else if (name.equals("duration")) {
1506          this.duration = new Quantity();
1507          return this.duration;
1508        }
1509        else if (name.equals("color")) {
1510          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.color");
1511        }
1512        else if (name.equals("brand")) {
1513          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.brand");
1514        }
1515        else if (name.equals("note")) {
1516          return addNote();
1517        }
1518        else
1519          return super.addChild(name);
1520      }
1521
1522      public VisionPrescriptionLensSpecificationComponent copy() {
1523        VisionPrescriptionLensSpecificationComponent dst = new VisionPrescriptionLensSpecificationComponent();
1524        copyValues(dst);
1525        return dst;
1526      }
1527
1528      public void copyValues(VisionPrescriptionLensSpecificationComponent dst) {
1529        super.copyValues(dst);
1530        dst.product = product == null ? null : product.copy();
1531        dst.eye = eye == null ? null : eye.copy();
1532        dst.sphere = sphere == null ? null : sphere.copy();
1533        dst.cylinder = cylinder == null ? null : cylinder.copy();
1534        dst.axis = axis == null ? null : axis.copy();
1535        if (prism != null) {
1536          dst.prism = new ArrayList<PrismComponent>();
1537          for (PrismComponent i : prism)
1538            dst.prism.add(i.copy());
1539        };
1540        dst.add = add == null ? null : add.copy();
1541        dst.power = power == null ? null : power.copy();
1542        dst.backCurve = backCurve == null ? null : backCurve.copy();
1543        dst.diameter = diameter == null ? null : diameter.copy();
1544        dst.duration = duration == null ? null : duration.copy();
1545        dst.color = color == null ? null : color.copy();
1546        dst.brand = brand == null ? null : brand.copy();
1547        if (note != null) {
1548          dst.note = new ArrayList<Annotation>();
1549          for (Annotation i : note)
1550            dst.note.add(i.copy());
1551        };
1552      }
1553
1554      @Override
1555      public boolean equalsDeep(Base other_) {
1556        if (!super.equalsDeep(other_))
1557          return false;
1558        if (!(other_ instanceof VisionPrescriptionLensSpecificationComponent))
1559          return false;
1560        VisionPrescriptionLensSpecificationComponent o = (VisionPrescriptionLensSpecificationComponent) other_;
1561        return compareDeep(product, o.product, true) && compareDeep(eye, o.eye, true) && compareDeep(sphere, o.sphere, true)
1562           && compareDeep(cylinder, o.cylinder, true) && compareDeep(axis, o.axis, true) && compareDeep(prism, o.prism, true)
1563           && compareDeep(add, o.add, true) && compareDeep(power, o.power, true) && compareDeep(backCurve, o.backCurve, true)
1564           && compareDeep(diameter, o.diameter, true) && compareDeep(duration, o.duration, true) && compareDeep(color, o.color, true)
1565           && compareDeep(brand, o.brand, true) && compareDeep(note, o.note, true);
1566      }
1567
1568      @Override
1569      public boolean equalsShallow(Base other_) {
1570        if (!super.equalsShallow(other_))
1571          return false;
1572        if (!(other_ instanceof VisionPrescriptionLensSpecificationComponent))
1573          return false;
1574        VisionPrescriptionLensSpecificationComponent o = (VisionPrescriptionLensSpecificationComponent) other_;
1575        return compareValues(eye, o.eye, true) && compareValues(sphere, o.sphere, true) && compareValues(cylinder, o.cylinder, true)
1576           && compareValues(axis, o.axis, true) && compareValues(add, o.add, true) && compareValues(power, o.power, true)
1577           && compareValues(backCurve, o.backCurve, true) && compareValues(diameter, o.diameter, true) && compareValues(color, o.color, true)
1578           && compareValues(brand, o.brand, true);
1579      }
1580
1581      public boolean isEmpty() {
1582        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(product, eye, sphere, cylinder
1583          , axis, prism, add, power, backCurve, diameter, duration, color, brand, note
1584          );
1585      }
1586
1587  public String fhirType() {
1588    return "VisionPrescription.lensSpecification";
1589
1590  }
1591
1592  }
1593
1594    @Block()
1595    public static class PrismComponent extends BackboneElement implements IBaseBackboneElement {
1596        /**
1597         * Amount of prism to compensate for eye alignment in fractional units.
1598         */
1599        @Child(name = "amount", type = {DecimalType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1600        @Description(shortDefinition="Amount of adjustment", formalDefinition="Amount of prism to compensate for eye alignment in fractional units." )
1601        protected DecimalType amount;
1602
1603        /**
1604         * The relative base, or reference lens edge, for the prism.
1605         */
1606        @Child(name = "base", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1607        @Description(shortDefinition="up | down | in | out", formalDefinition="The relative base, or reference lens edge, for the prism." )
1608        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/vision-base-codes")
1609        protected Enumeration<VisionBase> base;
1610
1611        private static final long serialVersionUID = 1677247628L;
1612
1613    /**
1614     * Constructor
1615     */
1616      public PrismComponent() {
1617        super();
1618      }
1619
1620    /**
1621     * Constructor
1622     */
1623      public PrismComponent(DecimalType amount, Enumeration<VisionBase> base) {
1624        super();
1625        this.amount = amount;
1626        this.base = base;
1627      }
1628
1629        /**
1630         * @return {@link #amount} (Amount of prism to compensate for eye alignment in fractional units.). This is the underlying object with id, value and extensions. The accessor "getAmount" gives direct access to the value
1631         */
1632        public DecimalType getAmountElement() { 
1633          if (this.amount == null)
1634            if (Configuration.errorOnAutoCreate())
1635              throw new Error("Attempt to auto-create PrismComponent.amount");
1636            else if (Configuration.doAutoCreate())
1637              this.amount = new DecimalType(); // bb
1638          return this.amount;
1639        }
1640
1641        public boolean hasAmountElement() { 
1642          return this.amount != null && !this.amount.isEmpty();
1643        }
1644
1645        public boolean hasAmount() { 
1646          return this.amount != null && !this.amount.isEmpty();
1647        }
1648
1649        /**
1650         * @param value {@link #amount} (Amount of prism to compensate for eye alignment in fractional units.). This is the underlying object with id, value and extensions. The accessor "getAmount" gives direct access to the value
1651         */
1652        public PrismComponent setAmountElement(DecimalType value) { 
1653          this.amount = value;
1654          return this;
1655        }
1656
1657        /**
1658         * @return Amount of prism to compensate for eye alignment in fractional units.
1659         */
1660        public BigDecimal getAmount() { 
1661          return this.amount == null ? null : this.amount.getValue();
1662        }
1663
1664        /**
1665         * @param value Amount of prism to compensate for eye alignment in fractional units.
1666         */
1667        public PrismComponent setAmount(BigDecimal value) { 
1668            if (this.amount == null)
1669              this.amount = new DecimalType();
1670            this.amount.setValue(value);
1671          return this;
1672        }
1673
1674        /**
1675         * @param value Amount of prism to compensate for eye alignment in fractional units.
1676         */
1677        public PrismComponent setAmount(long value) { 
1678              this.amount = new DecimalType();
1679            this.amount.setValue(value);
1680          return this;
1681        }
1682
1683        /**
1684         * @param value Amount of prism to compensate for eye alignment in fractional units.
1685         */
1686        public PrismComponent setAmount(double value) { 
1687              this.amount = new DecimalType();
1688            this.amount.setValue(value);
1689          return this;
1690        }
1691
1692        /**
1693         * @return {@link #base} (The relative base, or reference lens edge, for the prism.). This is the underlying object with id, value and extensions. The accessor "getBase" gives direct access to the value
1694         */
1695        public Enumeration<VisionBase> getBaseElement() { 
1696          if (this.base == null)
1697            if (Configuration.errorOnAutoCreate())
1698              throw new Error("Attempt to auto-create PrismComponent.base");
1699            else if (Configuration.doAutoCreate())
1700              this.base = new Enumeration<VisionBase>(new VisionBaseEnumFactory()); // bb
1701          return this.base;
1702        }
1703
1704        public boolean hasBaseElement() { 
1705          return this.base != null && !this.base.isEmpty();
1706        }
1707
1708        public boolean hasBase() { 
1709          return this.base != null && !this.base.isEmpty();
1710        }
1711
1712        /**
1713         * @param value {@link #base} (The relative base, or reference lens edge, for the prism.). This is the underlying object with id, value and extensions. The accessor "getBase" gives direct access to the value
1714         */
1715        public PrismComponent setBaseElement(Enumeration<VisionBase> value) { 
1716          this.base = value;
1717          return this;
1718        }
1719
1720        /**
1721         * @return The relative base, or reference lens edge, for the prism.
1722         */
1723        public VisionBase getBase() { 
1724          return this.base == null ? null : this.base.getValue();
1725        }
1726
1727        /**
1728         * @param value The relative base, or reference lens edge, for the prism.
1729         */
1730        public PrismComponent setBase(VisionBase value) { 
1731            if (this.base == null)
1732              this.base = new Enumeration<VisionBase>(new VisionBaseEnumFactory());
1733            this.base.setValue(value);
1734          return this;
1735        }
1736
1737        protected void listChildren(List<Property> children) {
1738          super.listChildren(children);
1739          children.add(new Property("amount", "decimal", "Amount of prism to compensate for eye alignment in fractional units.", 0, 1, amount));
1740          children.add(new Property("base", "code", "The relative base, or reference lens edge, for the prism.", 0, 1, base));
1741        }
1742
1743        @Override
1744        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1745          switch (_hash) {
1746          case -1413853096: /*amount*/  return new Property("amount", "decimal", "Amount of prism to compensate for eye alignment in fractional units.", 0, 1, amount);
1747          case 3016401: /*base*/  return new Property("base", "code", "The relative base, or reference lens edge, for the prism.", 0, 1, base);
1748          default: return super.getNamedProperty(_hash, _name, _checkValid);
1749          }
1750
1751        }
1752
1753      @Override
1754      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1755        switch (hash) {
1756        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // DecimalType
1757        case 3016401: /*base*/ return this.base == null ? new Base[0] : new Base[] {this.base}; // Enumeration<VisionBase>
1758        default: return super.getProperty(hash, name, checkValid);
1759        }
1760
1761      }
1762
1763      @Override
1764      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1765        switch (hash) {
1766        case -1413853096: // amount
1767          this.amount = castToDecimal(value); // DecimalType
1768          return value;
1769        case 3016401: // base
1770          value = new VisionBaseEnumFactory().fromType(castToCode(value));
1771          this.base = (Enumeration) value; // Enumeration<VisionBase>
1772          return value;
1773        default: return super.setProperty(hash, name, value);
1774        }
1775
1776      }
1777
1778      @Override
1779      public Base setProperty(String name, Base value) throws FHIRException {
1780        if (name.equals("amount")) {
1781          this.amount = castToDecimal(value); // DecimalType
1782        } else if (name.equals("base")) {
1783          value = new VisionBaseEnumFactory().fromType(castToCode(value));
1784          this.base = (Enumeration) value; // Enumeration<VisionBase>
1785        } else
1786          return super.setProperty(name, value);
1787        return value;
1788      }
1789
1790      @Override
1791      public Base makeProperty(int hash, String name) throws FHIRException {
1792        switch (hash) {
1793        case -1413853096:  return getAmountElement();
1794        case 3016401:  return getBaseElement();
1795        default: return super.makeProperty(hash, name);
1796        }
1797
1798      }
1799
1800      @Override
1801      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1802        switch (hash) {
1803        case -1413853096: /*amount*/ return new String[] {"decimal"};
1804        case 3016401: /*base*/ return new String[] {"code"};
1805        default: return super.getTypesForProperty(hash, name);
1806        }
1807
1808      }
1809
1810      @Override
1811      public Base addChild(String name) throws FHIRException {
1812        if (name.equals("amount")) {
1813          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.amount");
1814        }
1815        else if (name.equals("base")) {
1816          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.base");
1817        }
1818        else
1819          return super.addChild(name);
1820      }
1821
1822      public PrismComponent copy() {
1823        PrismComponent dst = new PrismComponent();
1824        copyValues(dst);
1825        return dst;
1826      }
1827
1828      public void copyValues(PrismComponent dst) {
1829        super.copyValues(dst);
1830        dst.amount = amount == null ? null : amount.copy();
1831        dst.base = base == null ? null : base.copy();
1832      }
1833
1834      @Override
1835      public boolean equalsDeep(Base other_) {
1836        if (!super.equalsDeep(other_))
1837          return false;
1838        if (!(other_ instanceof PrismComponent))
1839          return false;
1840        PrismComponent o = (PrismComponent) other_;
1841        return compareDeep(amount, o.amount, true) && compareDeep(base, o.base, true);
1842      }
1843
1844      @Override
1845      public boolean equalsShallow(Base other_) {
1846        if (!super.equalsShallow(other_))
1847          return false;
1848        if (!(other_ instanceof PrismComponent))
1849          return false;
1850        PrismComponent o = (PrismComponent) other_;
1851        return compareValues(amount, o.amount, true) && compareValues(base, o.base, true);
1852      }
1853
1854      public boolean isEmpty() {
1855        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(amount, base);
1856      }
1857
1858  public String fhirType() {
1859    return "VisionPrescription.lensSpecification.prism";
1860
1861  }
1862
1863  }
1864
1865    /**
1866     * A unique identifier assigned to this vision prescription.
1867     */
1868    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1869    @Description(shortDefinition="Business Identifier for vision prescription", formalDefinition="A unique identifier assigned to this vision prescription." )
1870    protected List<Identifier> identifier;
1871
1872    /**
1873     * The status of the resource instance.
1874     */
1875    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1876    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
1877    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
1878    protected Enumeration<VisionStatus> status;
1879
1880    /**
1881     * The date this resource was created.
1882     */
1883    @Child(name = "created", type = {DateTimeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1884    @Description(shortDefinition="Response creation date", formalDefinition="The date this resource was created." )
1885    protected DateTimeType created;
1886
1887    /**
1888     * A resource reference to the person to whom the vision prescription applies.
1889     */
1890    @Child(name = "patient", type = {Patient.class}, order=3, min=1, max=1, modifier=false, summary=true)
1891    @Description(shortDefinition="Who prescription is for", formalDefinition="A resource reference to the person to whom the vision prescription applies." )
1892    protected Reference patient;
1893
1894    /**
1895     * A reference to a resource that identifies the particular occurrence of contact between patient and health care provider during which the prescription was issued.
1896     */
1897    @Child(name = "encounter", type = {Encounter.class}, order=4, min=0, max=1, modifier=false, summary=false)
1898    @Description(shortDefinition="Created during encounter / admission / stay", formalDefinition="A reference to a resource that identifies the particular occurrence of contact between patient and health care provider during which the prescription was issued." )
1899    protected Reference encounter;
1900
1901    /**
1902     * The date (and perhaps time) when the prescription was written.
1903     */
1904    @Child(name = "dateWritten", type = {DateTimeType.class}, order=5, min=1, max=1, modifier=false, summary=true)
1905    @Description(shortDefinition="When prescription was authorized", formalDefinition="The date (and perhaps time) when the prescription was written." )
1906    protected DateTimeType dateWritten;
1907
1908    /**
1909     * The healthcare professional responsible for authorizing the prescription.
1910     */
1911    @Child(name = "prescriber", type = {Practitioner.class, PractitionerRole.class}, order=6, min=1, max=1, modifier=false, summary=true)
1912    @Description(shortDefinition="Who authorized the vision prescription", formalDefinition="The healthcare professional responsible for authorizing the prescription." )
1913    protected Reference prescriber;
1914
1915    /**
1916     * Contain the details of  the individual lens specifications and serves as the authorization for the fullfillment by certified professionals.
1917     */
1918    @Child(name = "lensSpecification", type = {}, order=7, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1919    @Description(shortDefinition="Vision lens authorization", formalDefinition="Contain the details of  the individual lens specifications and serves as the authorization for the fullfillment by certified professionals." )
1920    protected List<VisionPrescriptionLensSpecificationComponent> lensSpecification;
1921
1922    private static final long serialVersionUID = 252562003L;
1923
1924  /**
1925   * Constructor
1926   */
1927    public VisionPrescription() {
1928      super();
1929    }
1930
1931  /**
1932   * Constructor
1933   */
1934    public VisionPrescription(Enumeration<VisionStatus> status, DateTimeType created, Reference patient, DateTimeType dateWritten, Reference prescriber) {
1935      super();
1936      this.status = status;
1937      this.created = created;
1938      this.patient = patient;
1939      this.dateWritten = dateWritten;
1940      this.prescriber = prescriber;
1941    }
1942
1943    /**
1944     * @return {@link #identifier} (A unique identifier assigned to this vision prescription.)
1945     */
1946    public List<Identifier> getIdentifier() { 
1947      if (this.identifier == null)
1948        this.identifier = new ArrayList<Identifier>();
1949      return this.identifier;
1950    }
1951
1952    /**
1953     * @return Returns a reference to <code>this</code> for easy method chaining
1954     */
1955    public VisionPrescription setIdentifier(List<Identifier> theIdentifier) { 
1956      this.identifier = theIdentifier;
1957      return this;
1958    }
1959
1960    public boolean hasIdentifier() { 
1961      if (this.identifier == null)
1962        return false;
1963      for (Identifier item : this.identifier)
1964        if (!item.isEmpty())
1965          return true;
1966      return false;
1967    }
1968
1969    public Identifier addIdentifier() { //3
1970      Identifier t = new Identifier();
1971      if (this.identifier == null)
1972        this.identifier = new ArrayList<Identifier>();
1973      this.identifier.add(t);
1974      return t;
1975    }
1976
1977    public VisionPrescription addIdentifier(Identifier t) { //3
1978      if (t == null)
1979        return this;
1980      if (this.identifier == null)
1981        this.identifier = new ArrayList<Identifier>();
1982      this.identifier.add(t);
1983      return this;
1984    }
1985
1986    /**
1987     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1988     */
1989    public Identifier getIdentifierFirstRep() { 
1990      if (getIdentifier().isEmpty()) {
1991        addIdentifier();
1992      }
1993      return getIdentifier().get(0);
1994    }
1995
1996    /**
1997     * @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
1998     */
1999    public Enumeration<VisionStatus> getStatusElement() { 
2000      if (this.status == null)
2001        if (Configuration.errorOnAutoCreate())
2002          throw new Error("Attempt to auto-create VisionPrescription.status");
2003        else if (Configuration.doAutoCreate())
2004          this.status = new Enumeration<VisionStatus>(new VisionStatusEnumFactory()); // bb
2005      return this.status;
2006    }
2007
2008    public boolean hasStatusElement() { 
2009      return this.status != null && !this.status.isEmpty();
2010    }
2011
2012    public boolean hasStatus() { 
2013      return this.status != null && !this.status.isEmpty();
2014    }
2015
2016    /**
2017     * @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
2018     */
2019    public VisionPrescription setStatusElement(Enumeration<VisionStatus> value) { 
2020      this.status = value;
2021      return this;
2022    }
2023
2024    /**
2025     * @return The status of the resource instance.
2026     */
2027    public VisionStatus getStatus() { 
2028      return this.status == null ? null : this.status.getValue();
2029    }
2030
2031    /**
2032     * @param value The status of the resource instance.
2033     */
2034    public VisionPrescription setStatus(VisionStatus value) { 
2035        if (this.status == null)
2036          this.status = new Enumeration<VisionStatus>(new VisionStatusEnumFactory());
2037        this.status.setValue(value);
2038      return this;
2039    }
2040
2041    /**
2042     * @return {@link #created} (The date this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
2043     */
2044    public DateTimeType getCreatedElement() { 
2045      if (this.created == null)
2046        if (Configuration.errorOnAutoCreate())
2047          throw new Error("Attempt to auto-create VisionPrescription.created");
2048        else if (Configuration.doAutoCreate())
2049          this.created = new DateTimeType(); // bb
2050      return this.created;
2051    }
2052
2053    public boolean hasCreatedElement() { 
2054      return this.created != null && !this.created.isEmpty();
2055    }
2056
2057    public boolean hasCreated() { 
2058      return this.created != null && !this.created.isEmpty();
2059    }
2060
2061    /**
2062     * @param value {@link #created} (The date this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
2063     */
2064    public VisionPrescription setCreatedElement(DateTimeType value) { 
2065      this.created = value;
2066      return this;
2067    }
2068
2069    /**
2070     * @return The date this resource was created.
2071     */
2072    public Date getCreated() { 
2073      return this.created == null ? null : this.created.getValue();
2074    }
2075
2076    /**
2077     * @param value The date this resource was created.
2078     */
2079    public VisionPrescription setCreated(Date value) { 
2080        if (this.created == null)
2081          this.created = new DateTimeType();
2082        this.created.setValue(value);
2083      return this;
2084    }
2085
2086    /**
2087     * @return {@link #patient} (A resource reference to the person to whom the vision prescription applies.)
2088     */
2089    public Reference getPatient() { 
2090      if (this.patient == null)
2091        if (Configuration.errorOnAutoCreate())
2092          throw new Error("Attempt to auto-create VisionPrescription.patient");
2093        else if (Configuration.doAutoCreate())
2094          this.patient = new Reference(); // cc
2095      return this.patient;
2096    }
2097
2098    public boolean hasPatient() { 
2099      return this.patient != null && !this.patient.isEmpty();
2100    }
2101
2102    /**
2103     * @param value {@link #patient} (A resource reference to the person to whom the vision prescription applies.)
2104     */
2105    public VisionPrescription setPatient(Reference value) { 
2106      this.patient = value;
2107      return this;
2108    }
2109
2110    /**
2111     * @return {@link #encounter} (A reference to a resource that identifies the particular occurrence of contact between patient and health care provider during which the prescription was issued.)
2112     */
2113    public Reference getEncounter() { 
2114      if (this.encounter == null)
2115        if (Configuration.errorOnAutoCreate())
2116          throw new Error("Attempt to auto-create VisionPrescription.encounter");
2117        else if (Configuration.doAutoCreate())
2118          this.encounter = new Reference(); // cc
2119      return this.encounter;
2120    }
2121
2122    public boolean hasEncounter() { 
2123      return this.encounter != null && !this.encounter.isEmpty();
2124    }
2125
2126    /**
2127     * @param value {@link #encounter} (A reference to a resource that identifies the particular occurrence of contact between patient and health care provider during which the prescription was issued.)
2128     */
2129    public VisionPrescription setEncounter(Reference value) { 
2130      this.encounter = value;
2131      return this;
2132    }
2133
2134    /**
2135     * @return {@link #dateWritten} (The date (and perhaps time) when the prescription was written.). This is the underlying object with id, value and extensions. The accessor "getDateWritten" gives direct access to the value
2136     */
2137    public DateTimeType getDateWrittenElement() { 
2138      if (this.dateWritten == null)
2139        if (Configuration.errorOnAutoCreate())
2140          throw new Error("Attempt to auto-create VisionPrescription.dateWritten");
2141        else if (Configuration.doAutoCreate())
2142          this.dateWritten = new DateTimeType(); // bb
2143      return this.dateWritten;
2144    }
2145
2146    public boolean hasDateWrittenElement() { 
2147      return this.dateWritten != null && !this.dateWritten.isEmpty();
2148    }
2149
2150    public boolean hasDateWritten() { 
2151      return this.dateWritten != null && !this.dateWritten.isEmpty();
2152    }
2153
2154    /**
2155     * @param value {@link #dateWritten} (The date (and perhaps time) when the prescription was written.). This is the underlying object with id, value and extensions. The accessor "getDateWritten" gives direct access to the value
2156     */
2157    public VisionPrescription setDateWrittenElement(DateTimeType value) { 
2158      this.dateWritten = value;
2159      return this;
2160    }
2161
2162    /**
2163     * @return The date (and perhaps time) when the prescription was written.
2164     */
2165    public Date getDateWritten() { 
2166      return this.dateWritten == null ? null : this.dateWritten.getValue();
2167    }
2168
2169    /**
2170     * @param value The date (and perhaps time) when the prescription was written.
2171     */
2172    public VisionPrescription setDateWritten(Date value) { 
2173        if (this.dateWritten == null)
2174          this.dateWritten = new DateTimeType();
2175        this.dateWritten.setValue(value);
2176      return this;
2177    }
2178
2179    /**
2180     * @return {@link #prescriber} (The healthcare professional responsible for authorizing the prescription.)
2181     */
2182    public Reference getPrescriber() { 
2183      if (this.prescriber == null)
2184        if (Configuration.errorOnAutoCreate())
2185          throw new Error("Attempt to auto-create VisionPrescription.prescriber");
2186        else if (Configuration.doAutoCreate())
2187          this.prescriber = new Reference(); // cc
2188      return this.prescriber;
2189    }
2190
2191    public boolean hasPrescriber() { 
2192      return this.prescriber != null && !this.prescriber.isEmpty();
2193    }
2194
2195    /**
2196     * @param value {@link #prescriber} (The healthcare professional responsible for authorizing the prescription.)
2197     */
2198    public VisionPrescription setPrescriber(Reference value) { 
2199      this.prescriber = value;
2200      return this;
2201    }
2202
2203    /**
2204     * @return {@link #lensSpecification} (Contain the details of  the individual lens specifications and serves as the authorization for the fullfillment by certified professionals.)
2205     */
2206    public List<VisionPrescriptionLensSpecificationComponent> getLensSpecification() { 
2207      if (this.lensSpecification == null)
2208        this.lensSpecification = new ArrayList<VisionPrescriptionLensSpecificationComponent>();
2209      return this.lensSpecification;
2210    }
2211
2212    /**
2213     * @return Returns a reference to <code>this</code> for easy method chaining
2214     */
2215    public VisionPrescription setLensSpecification(List<VisionPrescriptionLensSpecificationComponent> theLensSpecification) { 
2216      this.lensSpecification = theLensSpecification;
2217      return this;
2218    }
2219
2220    public boolean hasLensSpecification() { 
2221      if (this.lensSpecification == null)
2222        return false;
2223      for (VisionPrescriptionLensSpecificationComponent item : this.lensSpecification)
2224        if (!item.isEmpty())
2225          return true;
2226      return false;
2227    }
2228
2229    public VisionPrescriptionLensSpecificationComponent addLensSpecification() { //3
2230      VisionPrescriptionLensSpecificationComponent t = new VisionPrescriptionLensSpecificationComponent();
2231      if (this.lensSpecification == null)
2232        this.lensSpecification = new ArrayList<VisionPrescriptionLensSpecificationComponent>();
2233      this.lensSpecification.add(t);
2234      return t;
2235    }
2236
2237    public VisionPrescription addLensSpecification(VisionPrescriptionLensSpecificationComponent t) { //3
2238      if (t == null)
2239        return this;
2240      if (this.lensSpecification == null)
2241        this.lensSpecification = new ArrayList<VisionPrescriptionLensSpecificationComponent>();
2242      this.lensSpecification.add(t);
2243      return this;
2244    }
2245
2246    /**
2247     * @return The first repetition of repeating field {@link #lensSpecification}, creating it if it does not already exist
2248     */
2249    public VisionPrescriptionLensSpecificationComponent getLensSpecificationFirstRep() { 
2250      if (getLensSpecification().isEmpty()) {
2251        addLensSpecification();
2252      }
2253      return getLensSpecification().get(0);
2254    }
2255
2256      protected void listChildren(List<Property> children) {
2257        super.listChildren(children);
2258        children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this vision prescription.", 0, java.lang.Integer.MAX_VALUE, identifier));
2259        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
2260        children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
2261        children.add(new Property("patient", "Reference(Patient)", "A resource reference to the person to whom the vision prescription applies.", 0, 1, patient));
2262        children.add(new Property("encounter", "Reference(Encounter)", "A reference to a resource that identifies the particular occurrence of contact between patient and health care provider during which the prescription was issued.", 0, 1, encounter));
2263        children.add(new Property("dateWritten", "dateTime", "The date (and perhaps time) when the prescription was written.", 0, 1, dateWritten));
2264        children.add(new Property("prescriber", "Reference(Practitioner|PractitionerRole)", "The healthcare professional responsible for authorizing the prescription.", 0, 1, prescriber));
2265        children.add(new Property("lensSpecification", "", "Contain the details of  the individual lens specifications and serves as the authorization for the fullfillment by certified professionals.", 0, java.lang.Integer.MAX_VALUE, lensSpecification));
2266      }
2267
2268      @Override
2269      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2270        switch (_hash) {
2271        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier assigned to this vision prescription.", 0, java.lang.Integer.MAX_VALUE, identifier);
2272        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
2273        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
2274        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "A resource reference to the person to whom the vision prescription applies.", 0, 1, patient);
2275        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "A reference to a resource that identifies the particular occurrence of contact between patient and health care provider during which the prescription was issued.", 0, 1, encounter);
2276        case -1496880759: /*dateWritten*/  return new Property("dateWritten", "dateTime", "The date (and perhaps time) when the prescription was written.", 0, 1, dateWritten);
2277        case 1430631077: /*prescriber*/  return new Property("prescriber", "Reference(Practitioner|PractitionerRole)", "The healthcare professional responsible for authorizing the prescription.", 0, 1, prescriber);
2278        case -1767318363: /*lensSpecification*/  return new Property("lensSpecification", "", "Contain the details of  the individual lens specifications and serves as the authorization for the fullfillment by certified professionals.", 0, java.lang.Integer.MAX_VALUE, lensSpecification);
2279        default: return super.getNamedProperty(_hash, _name, _checkValid);
2280        }
2281
2282      }
2283
2284      @Override
2285      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2286        switch (hash) {
2287        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2288        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<VisionStatus>
2289        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
2290        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2291        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2292        case -1496880759: /*dateWritten*/ return this.dateWritten == null ? new Base[0] : new Base[] {this.dateWritten}; // DateTimeType
2293        case 1430631077: /*prescriber*/ return this.prescriber == null ? new Base[0] : new Base[] {this.prescriber}; // Reference
2294        case -1767318363: /*lensSpecification*/ return this.lensSpecification == null ? new Base[0] : this.lensSpecification.toArray(new Base[this.lensSpecification.size()]); // VisionPrescriptionLensSpecificationComponent
2295        default: return super.getProperty(hash, name, checkValid);
2296        }
2297
2298      }
2299
2300      @Override
2301      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2302        switch (hash) {
2303        case -1618432855: // identifier
2304          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2305          return value;
2306        case -892481550: // status
2307          value = new VisionStatusEnumFactory().fromType(castToCode(value));
2308          this.status = (Enumeration) value; // Enumeration<VisionStatus>
2309          return value;
2310        case 1028554472: // created
2311          this.created = castToDateTime(value); // DateTimeType
2312          return value;
2313        case -791418107: // patient
2314          this.patient = castToReference(value); // Reference
2315          return value;
2316        case 1524132147: // encounter
2317          this.encounter = castToReference(value); // Reference
2318          return value;
2319        case -1496880759: // dateWritten
2320          this.dateWritten = castToDateTime(value); // DateTimeType
2321          return value;
2322        case 1430631077: // prescriber
2323          this.prescriber = castToReference(value); // Reference
2324          return value;
2325        case -1767318363: // lensSpecification
2326          this.getLensSpecification().add((VisionPrescriptionLensSpecificationComponent) value); // VisionPrescriptionLensSpecificationComponent
2327          return value;
2328        default: return super.setProperty(hash, name, value);
2329        }
2330
2331      }
2332
2333      @Override
2334      public Base setProperty(String name, Base value) throws FHIRException {
2335        if (name.equals("identifier")) {
2336          this.getIdentifier().add(castToIdentifier(value));
2337        } else if (name.equals("status")) {
2338          value = new VisionStatusEnumFactory().fromType(castToCode(value));
2339          this.status = (Enumeration) value; // Enumeration<VisionStatus>
2340        } else if (name.equals("created")) {
2341          this.created = castToDateTime(value); // DateTimeType
2342        } else if (name.equals("patient")) {
2343          this.patient = castToReference(value); // Reference
2344        } else if (name.equals("encounter")) {
2345          this.encounter = castToReference(value); // Reference
2346        } else if (name.equals("dateWritten")) {
2347          this.dateWritten = castToDateTime(value); // DateTimeType
2348        } else if (name.equals("prescriber")) {
2349          this.prescriber = castToReference(value); // Reference
2350        } else if (name.equals("lensSpecification")) {
2351          this.getLensSpecification().add((VisionPrescriptionLensSpecificationComponent) value);
2352        } else
2353          return super.setProperty(name, value);
2354        return value;
2355      }
2356
2357      @Override
2358      public Base makeProperty(int hash, String name) throws FHIRException {
2359        switch (hash) {
2360        case -1618432855:  return addIdentifier(); 
2361        case -892481550:  return getStatusElement();
2362        case 1028554472:  return getCreatedElement();
2363        case -791418107:  return getPatient();
2364        case 1524132147:  return getEncounter();
2365        case -1496880759:  return getDateWrittenElement();
2366        case 1430631077:  return getPrescriber();
2367        case -1767318363:  return addLensSpecification(); 
2368        default: return super.makeProperty(hash, name);
2369        }
2370
2371      }
2372
2373      @Override
2374      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2375        switch (hash) {
2376        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2377        case -892481550: /*status*/ return new String[] {"code"};
2378        case 1028554472: /*created*/ return new String[] {"dateTime"};
2379        case -791418107: /*patient*/ return new String[] {"Reference"};
2380        case 1524132147: /*encounter*/ return new String[] {"Reference"};
2381        case -1496880759: /*dateWritten*/ return new String[] {"dateTime"};
2382        case 1430631077: /*prescriber*/ return new String[] {"Reference"};
2383        case -1767318363: /*lensSpecification*/ return new String[] {};
2384        default: return super.getTypesForProperty(hash, name);
2385        }
2386
2387      }
2388
2389      @Override
2390      public Base addChild(String name) throws FHIRException {
2391        if (name.equals("identifier")) {
2392          return addIdentifier();
2393        }
2394        else if (name.equals("status")) {
2395          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.status");
2396        }
2397        else if (name.equals("created")) {
2398          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.created");
2399        }
2400        else if (name.equals("patient")) {
2401          this.patient = new Reference();
2402          return this.patient;
2403        }
2404        else if (name.equals("encounter")) {
2405          this.encounter = new Reference();
2406          return this.encounter;
2407        }
2408        else if (name.equals("dateWritten")) {
2409          throw new FHIRException("Cannot call addChild on a primitive type VisionPrescription.dateWritten");
2410        }
2411        else if (name.equals("prescriber")) {
2412          this.prescriber = new Reference();
2413          return this.prescriber;
2414        }
2415        else if (name.equals("lensSpecification")) {
2416          return addLensSpecification();
2417        }
2418        else
2419          return super.addChild(name);
2420      }
2421
2422  public String fhirType() {
2423    return "VisionPrescription";
2424
2425  }
2426
2427      public VisionPrescription copy() {
2428        VisionPrescription dst = new VisionPrescription();
2429        copyValues(dst);
2430        return dst;
2431      }
2432
2433      public void copyValues(VisionPrescription dst) {
2434        super.copyValues(dst);
2435        if (identifier != null) {
2436          dst.identifier = new ArrayList<Identifier>();
2437          for (Identifier i : identifier)
2438            dst.identifier.add(i.copy());
2439        };
2440        dst.status = status == null ? null : status.copy();
2441        dst.created = created == null ? null : created.copy();
2442        dst.patient = patient == null ? null : patient.copy();
2443        dst.encounter = encounter == null ? null : encounter.copy();
2444        dst.dateWritten = dateWritten == null ? null : dateWritten.copy();
2445        dst.prescriber = prescriber == null ? null : prescriber.copy();
2446        if (lensSpecification != null) {
2447          dst.lensSpecification = new ArrayList<VisionPrescriptionLensSpecificationComponent>();
2448          for (VisionPrescriptionLensSpecificationComponent i : lensSpecification)
2449            dst.lensSpecification.add(i.copy());
2450        };
2451      }
2452
2453      protected VisionPrescription typedCopy() {
2454        return copy();
2455      }
2456
2457      @Override
2458      public boolean equalsDeep(Base other_) {
2459        if (!super.equalsDeep(other_))
2460          return false;
2461        if (!(other_ instanceof VisionPrescription))
2462          return false;
2463        VisionPrescription o = (VisionPrescription) other_;
2464        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(created, o.created, true)
2465           && compareDeep(patient, o.patient, true) && compareDeep(encounter, o.encounter, true) && compareDeep(dateWritten, o.dateWritten, true)
2466           && compareDeep(prescriber, o.prescriber, true) && compareDeep(lensSpecification, o.lensSpecification, true)
2467          ;
2468      }
2469
2470      @Override
2471      public boolean equalsShallow(Base other_) {
2472        if (!super.equalsShallow(other_))
2473          return false;
2474        if (!(other_ instanceof VisionPrescription))
2475          return false;
2476        VisionPrescription o = (VisionPrescription) other_;
2477        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(dateWritten, o.dateWritten, true)
2478          ;
2479      }
2480
2481      public boolean isEmpty() {
2482        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, created
2483          , patient, encounter, dateWritten, prescriber, lensSpecification);
2484      }
2485
2486  @Override
2487  public ResourceType getResourceType() {
2488    return ResourceType.VisionPrescription;
2489   }
2490
2491 /**
2492   * Search parameter: <b>prescriber</b>
2493   * <p>
2494   * Description: <b>Who authorized the vision prescription</b><br>
2495   * Type: <b>reference</b><br>
2496   * Path: <b>VisionPrescription.prescriber</b><br>
2497   * </p>
2498   */
2499  @SearchParamDefinition(name="prescriber", path="VisionPrescription.prescriber", description="Who authorized the vision prescription", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class, PractitionerRole.class } )
2500  public static final String SP_PRESCRIBER = "prescriber";
2501 /**
2502   * <b>Fluent Client</b> search parameter constant for <b>prescriber</b>
2503   * <p>
2504   * Description: <b>Who authorized the vision prescription</b><br>
2505   * Type: <b>reference</b><br>
2506   * Path: <b>VisionPrescription.prescriber</b><br>
2507   * </p>
2508   */
2509  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRESCRIBER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRESCRIBER);
2510
2511/**
2512   * Constant for fluent queries to be used to add include statements. Specifies
2513   * the path value of "<b>VisionPrescription:prescriber</b>".
2514   */
2515  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRESCRIBER = new ca.uhn.fhir.model.api.Include("VisionPrescription:prescriber").toLocked();
2516
2517 /**
2518   * Search parameter: <b>identifier</b>
2519   * <p>
2520   * Description: <b>Return prescriptions with this external identifier</b><br>
2521   * Type: <b>token</b><br>
2522   * Path: <b>VisionPrescription.identifier</b><br>
2523   * </p>
2524   */
2525  @SearchParamDefinition(name="identifier", path="VisionPrescription.identifier", description="Return prescriptions with this external identifier", type="token" )
2526  public static final String SP_IDENTIFIER = "identifier";
2527 /**
2528   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2529   * <p>
2530   * Description: <b>Return prescriptions with this external identifier</b><br>
2531   * Type: <b>token</b><br>
2532   * Path: <b>VisionPrescription.identifier</b><br>
2533   * </p>
2534   */
2535  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2536
2537 /**
2538   * Search parameter: <b>patient</b>
2539   * <p>
2540   * Description: <b>The identity of a patient to list dispenses for</b><br>
2541   * Type: <b>reference</b><br>
2542   * Path: <b>VisionPrescription.patient</b><br>
2543   * </p>
2544   */
2545  @SearchParamDefinition(name="patient", path="VisionPrescription.patient", description="The identity of a patient to list dispenses for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
2546  public static final String SP_PATIENT = "patient";
2547 /**
2548   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2549   * <p>
2550   * Description: <b>The identity of a patient to list dispenses for</b><br>
2551   * Type: <b>reference</b><br>
2552   * Path: <b>VisionPrescription.patient</b><br>
2553   * </p>
2554   */
2555  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2556
2557/**
2558   * Constant for fluent queries to be used to add include statements. Specifies
2559   * the path value of "<b>VisionPrescription:patient</b>".
2560   */
2561  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("VisionPrescription:patient").toLocked();
2562
2563 /**
2564   * Search parameter: <b>datewritten</b>
2565   * <p>
2566   * Description: <b>Return prescriptions written on this date</b><br>
2567   * Type: <b>date</b><br>
2568   * Path: <b>VisionPrescription.dateWritten</b><br>
2569   * </p>
2570   */
2571  @SearchParamDefinition(name="datewritten", path="VisionPrescription.dateWritten", description="Return prescriptions written on this date", type="date" )
2572  public static final String SP_DATEWRITTEN = "datewritten";
2573 /**
2574   * <b>Fluent Client</b> search parameter constant for <b>datewritten</b>
2575   * <p>
2576   * Description: <b>Return prescriptions written on this date</b><br>
2577   * Type: <b>date</b><br>
2578   * Path: <b>VisionPrescription.dateWritten</b><br>
2579   * </p>
2580   */
2581  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATEWRITTEN = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATEWRITTEN);
2582
2583 /**
2584   * Search parameter: <b>encounter</b>
2585   * <p>
2586   * Description: <b>Return prescriptions with this encounter identifier</b><br>
2587   * Type: <b>reference</b><br>
2588   * Path: <b>VisionPrescription.encounter</b><br>
2589   * </p>
2590   */
2591  @SearchParamDefinition(name="encounter", path="VisionPrescription.encounter", description="Return prescriptions with this encounter identifier", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
2592  public static final String SP_ENCOUNTER = "encounter";
2593 /**
2594   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2595   * <p>
2596   * Description: <b>Return prescriptions with this encounter identifier</b><br>
2597   * Type: <b>reference</b><br>
2598   * Path: <b>VisionPrescription.encounter</b><br>
2599   * </p>
2600   */
2601  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2602
2603/**
2604   * Constant for fluent queries to be used to add include statements. Specifies
2605   * the path value of "<b>VisionPrescription:encounter</b>".
2606   */
2607  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("VisionPrescription:encounter").toLocked();
2608
2609 /**
2610   * Search parameter: <b>status</b>
2611   * <p>
2612   * Description: <b>The status of the vision prescription</b><br>
2613   * Type: <b>token</b><br>
2614   * Path: <b>VisionPrescription.status</b><br>
2615   * </p>
2616   */
2617  @SearchParamDefinition(name="status", path="VisionPrescription.status", description="The status of the vision prescription", type="token" )
2618  public static final String SP_STATUS = "status";
2619 /**
2620   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2621   * <p>
2622   * Description: <b>The status of the vision prescription</b><br>
2623   * Type: <b>token</b><br>
2624   * Path: <b>VisionPrescription.status</b><br>
2625   * </p>
2626   */
2627  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2628
2629
2630}
2631