001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046// added from java-adornments.txt:
047import org.hl7.fhir.dstu3.utils.StructureMapUtilities;
048
049// end addition
050/**
051 * A Map of relationships between 2 structures that can be used to transform data.
052 */
053@ResourceDef(name="StructureMap", profile="http://hl7.org/fhir/Profile/StructureMap")
054@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "copyright", "structure", "import", "group"})
055public class StructureMap extends MetadataResource {
056
057    public enum StructureMapModelMode {
058        /**
059         * This structure describes an instance passed to the mapping engine that is used a source of data
060         */
061        SOURCE, 
062        /**
063         * This structure describes an instance that the mapping engine may ask for that is used a source of data
064         */
065        QUERIED, 
066        /**
067         * This structure describes an instance passed to the mapping engine that is used a target of data
068         */
069        TARGET, 
070        /**
071         * This structure describes an instance that the mapping engine may ask to create that is used a target of data
072         */
073        PRODUCED, 
074        /**
075         * added to help the parsers with the generic types
076         */
077        NULL;
078        public static StructureMapModelMode fromCode(String codeString) throws FHIRException {
079            if (codeString == null || "".equals(codeString))
080                return null;
081        if ("source".equals(codeString))
082          return SOURCE;
083        if ("queried".equals(codeString))
084          return QUERIED;
085        if ("target".equals(codeString))
086          return TARGET;
087        if ("produced".equals(codeString))
088          return PRODUCED;
089        if (Configuration.isAcceptInvalidEnums())
090          return null;
091        else
092          throw new FHIRException("Unknown StructureMapModelMode code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case SOURCE: return "source";
097            case QUERIED: return "queried";
098            case TARGET: return "target";
099            case PRODUCED: return "produced";
100            default: return "?";
101          }
102        }
103        public String getSystem() {
104          switch (this) {
105            case SOURCE: return "http://hl7.org/fhir/map-model-mode";
106            case QUERIED: return "http://hl7.org/fhir/map-model-mode";
107            case TARGET: return "http://hl7.org/fhir/map-model-mode";
108            case PRODUCED: return "http://hl7.org/fhir/map-model-mode";
109            default: return "?";
110          }
111        }
112        public String getDefinition() {
113          switch (this) {
114            case SOURCE: return "This structure describes an instance passed to the mapping engine that is used a source of data";
115            case QUERIED: return "This structure describes an instance that the mapping engine may ask for that is used a source of data";
116            case TARGET: return "This structure describes an instance passed to the mapping engine that is used a target of data";
117            case PRODUCED: return "This structure describes an instance that the mapping engine may ask to create that is used a target of data";
118            default: return "?";
119          }
120        }
121        public String getDisplay() {
122          switch (this) {
123            case SOURCE: return "Source Structure Definition";
124            case QUERIED: return "Queried Structure Definition";
125            case TARGET: return "Target Structure Definition";
126            case PRODUCED: return "Produced Structure Definition";
127            default: return "?";
128          }
129        }
130    }
131
132  public static class StructureMapModelModeEnumFactory implements EnumFactory<StructureMapModelMode> {
133    public StructureMapModelMode fromCode(String codeString) throws IllegalArgumentException {
134      if (codeString == null || "".equals(codeString))
135            if (codeString == null || "".equals(codeString))
136                return null;
137        if ("source".equals(codeString))
138          return StructureMapModelMode.SOURCE;
139        if ("queried".equals(codeString))
140          return StructureMapModelMode.QUERIED;
141        if ("target".equals(codeString))
142          return StructureMapModelMode.TARGET;
143        if ("produced".equals(codeString))
144          return StructureMapModelMode.PRODUCED;
145        throw new IllegalArgumentException("Unknown StructureMapModelMode code '"+codeString+"'");
146        }
147        public Enumeration<StructureMapModelMode> fromType(Base code) throws FHIRException {
148          if (code == null)
149            return null;
150          if (code.isEmpty())
151            return new Enumeration<StructureMapModelMode>(this);
152          String codeString = ((PrimitiveType) code).asStringValue();
153          if (codeString == null || "".equals(codeString))
154            return null;
155        if ("source".equals(codeString))
156          return new Enumeration<StructureMapModelMode>(this, StructureMapModelMode.SOURCE);
157        if ("queried".equals(codeString))
158          return new Enumeration<StructureMapModelMode>(this, StructureMapModelMode.QUERIED);
159        if ("target".equals(codeString))
160          return new Enumeration<StructureMapModelMode>(this, StructureMapModelMode.TARGET);
161        if ("produced".equals(codeString))
162          return new Enumeration<StructureMapModelMode>(this, StructureMapModelMode.PRODUCED);
163        throw new FHIRException("Unknown StructureMapModelMode code '"+codeString+"'");
164        }
165    public String toCode(StructureMapModelMode code) {
166      if (code == StructureMapModelMode.SOURCE)
167        return "source";
168      if (code == StructureMapModelMode.QUERIED)
169        return "queried";
170      if (code == StructureMapModelMode.TARGET)
171        return "target";
172      if (code == StructureMapModelMode.PRODUCED)
173        return "produced";
174      return "?";
175      }
176    public String toSystem(StructureMapModelMode code) {
177      return code.getSystem();
178      }
179    }
180
181    public enum StructureMapGroupTypeMode {
182        /**
183         * This group is not a default group for the types
184         */
185        NONE, 
186        /**
187         * This group is a default mapping group for the specified types and for the primary source type
188         */
189        TYPES, 
190        /**
191         * This group is a default mapping group for the specified types
192         */
193        TYPEANDTYPES, 
194        /**
195         * added to help the parsers with the generic types
196         */
197        NULL;
198        public static StructureMapGroupTypeMode fromCode(String codeString) throws FHIRException {
199            if (codeString == null || "".equals(codeString))
200                return null;
201        if ("none".equals(codeString))
202          return NONE;
203        if ("types".equals(codeString))
204          return TYPES;
205        if ("type-and-types".equals(codeString))
206          return TYPEANDTYPES;
207        if (Configuration.isAcceptInvalidEnums())
208          return null;
209        else
210          throw new FHIRException("Unknown StructureMapGroupTypeMode code '"+codeString+"'");
211        }
212        public String toCode() {
213          switch (this) {
214            case NONE: return "none";
215            case TYPES: return "types";
216            case TYPEANDTYPES: return "type-and-types";
217            default: return "?";
218          }
219        }
220        public String getSystem() {
221          switch (this) {
222            case NONE: return "http://hl7.org/fhir/map-group-type-mode";
223            case TYPES: return "http://hl7.org/fhir/map-group-type-mode";
224            case TYPEANDTYPES: return "http://hl7.org/fhir/map-group-type-mode";
225            default: return "?";
226          }
227        }
228        public String getDefinition() {
229          switch (this) {
230            case NONE: return "This group is not a default group for the types";
231            case TYPES: return "This group is a default mapping group for the specified types and for the primary source type";
232            case TYPEANDTYPES: return "This group is a default mapping group for the specified types";
233            default: return "?";
234          }
235        }
236        public String getDisplay() {
237          switch (this) {
238            case NONE: return "Not a Default";
239            case TYPES: return "Default for Type Combination";
240            case TYPEANDTYPES: return "Default for type + combination";
241            default: return "?";
242          }
243        }
244    }
245
246  public static class StructureMapGroupTypeModeEnumFactory implements EnumFactory<StructureMapGroupTypeMode> {
247    public StructureMapGroupTypeMode fromCode(String codeString) throws IllegalArgumentException {
248      if (codeString == null || "".equals(codeString))
249            if (codeString == null || "".equals(codeString))
250                return null;
251        if ("none".equals(codeString))
252          return StructureMapGroupTypeMode.NONE;
253        if ("types".equals(codeString))
254          return StructureMapGroupTypeMode.TYPES;
255        if ("type-and-types".equals(codeString))
256          return StructureMapGroupTypeMode.TYPEANDTYPES;
257        throw new IllegalArgumentException("Unknown StructureMapGroupTypeMode code '"+codeString+"'");
258        }
259        public Enumeration<StructureMapGroupTypeMode> fromType(Base code) throws FHIRException {
260          if (code == null)
261            return null;
262          if (code.isEmpty())
263            return new Enumeration<StructureMapGroupTypeMode>(this);
264          String codeString = ((PrimitiveType) code).asStringValue();
265          if (codeString == null || "".equals(codeString))
266            return null;
267        if ("none".equals(codeString))
268          return new Enumeration<StructureMapGroupTypeMode>(this, StructureMapGroupTypeMode.NONE);
269        if ("types".equals(codeString))
270          return new Enumeration<StructureMapGroupTypeMode>(this, StructureMapGroupTypeMode.TYPES);
271        if ("type-and-types".equals(codeString))
272          return new Enumeration<StructureMapGroupTypeMode>(this, StructureMapGroupTypeMode.TYPEANDTYPES);
273        throw new FHIRException("Unknown StructureMapGroupTypeMode code '"+codeString+"'");
274        }
275    public String toCode(StructureMapGroupTypeMode code) {
276      if (code == StructureMapGroupTypeMode.NONE)
277        return "none";
278      if (code == StructureMapGroupTypeMode.TYPES)
279        return "types";
280      if (code == StructureMapGroupTypeMode.TYPEANDTYPES)
281        return "type-and-types";
282      return "?";
283      }
284    public String toSystem(StructureMapGroupTypeMode code) {
285      return code.getSystem();
286      }
287    }
288
289    public enum StructureMapInputMode {
290        /**
291         * Names an input instance used a source for mapping
292         */
293        SOURCE, 
294        /**
295         * Names an instance that is being populated
296         */
297        TARGET, 
298        /**
299         * added to help the parsers with the generic types
300         */
301        NULL;
302        public static StructureMapInputMode fromCode(String codeString) throws FHIRException {
303            if (codeString == null || "".equals(codeString))
304                return null;
305        if ("source".equals(codeString))
306          return SOURCE;
307        if ("target".equals(codeString))
308          return TARGET;
309        if (Configuration.isAcceptInvalidEnums())
310          return null;
311        else
312          throw new FHIRException("Unknown StructureMapInputMode code '"+codeString+"'");
313        }
314        public String toCode() {
315          switch (this) {
316            case SOURCE: return "source";
317            case TARGET: return "target";
318            default: return "?";
319          }
320        }
321        public String getSystem() {
322          switch (this) {
323            case SOURCE: return "http://hl7.org/fhir/map-input-mode";
324            case TARGET: return "http://hl7.org/fhir/map-input-mode";
325            default: return "?";
326          }
327        }
328        public String getDefinition() {
329          switch (this) {
330            case SOURCE: return "Names an input instance used a source for mapping";
331            case TARGET: return "Names an instance that is being populated";
332            default: return "?";
333          }
334        }
335        public String getDisplay() {
336          switch (this) {
337            case SOURCE: return "Source Instance";
338            case TARGET: return "Target Instance";
339            default: return "?";
340          }
341        }
342    }
343
344  public static class StructureMapInputModeEnumFactory implements EnumFactory<StructureMapInputMode> {
345    public StructureMapInputMode fromCode(String codeString) throws IllegalArgumentException {
346      if (codeString == null || "".equals(codeString))
347            if (codeString == null || "".equals(codeString))
348                return null;
349        if ("source".equals(codeString))
350          return StructureMapInputMode.SOURCE;
351        if ("target".equals(codeString))
352          return StructureMapInputMode.TARGET;
353        throw new IllegalArgumentException("Unknown StructureMapInputMode code '"+codeString+"'");
354        }
355        public Enumeration<StructureMapInputMode> fromType(Base code) throws FHIRException {
356          if (code == null)
357            return null;
358          if (code.isEmpty())
359            return new Enumeration<StructureMapInputMode>(this);
360          String codeString = ((PrimitiveType) code).asStringValue();
361          if (codeString == null || "".equals(codeString))
362            return null;
363        if ("source".equals(codeString))
364          return new Enumeration<StructureMapInputMode>(this, StructureMapInputMode.SOURCE);
365        if ("target".equals(codeString))
366          return new Enumeration<StructureMapInputMode>(this, StructureMapInputMode.TARGET);
367        throw new FHIRException("Unknown StructureMapInputMode code '"+codeString+"'");
368        }
369    public String toCode(StructureMapInputMode code) {
370      if (code == StructureMapInputMode.SOURCE)
371        return "source";
372      if (code == StructureMapInputMode.TARGET)
373        return "target";
374      return "?";
375      }
376    public String toSystem(StructureMapInputMode code) {
377      return code.getSystem();
378      }
379    }
380
381    public enum StructureMapSourceListMode {
382        /**
383         * Only process this rule for the first in the list
384         */
385        FIRST, 
386        /**
387         * Process this rule for all but the first
388         */
389        NOTFIRST, 
390        /**
391         * Only process this rule for the last in the list
392         */
393        LAST, 
394        /**
395         * Process this rule for all but the last
396         */
397        NOTLAST, 
398        /**
399         * Only process this rule is there is only item
400         */
401        ONLYONE, 
402        /**
403         * added to help the parsers with the generic types
404         */
405        NULL;
406        public static StructureMapSourceListMode fromCode(String codeString) throws FHIRException {
407            if (codeString == null || "".equals(codeString))
408                return null;
409        if ("first".equals(codeString))
410          return FIRST;
411        if ("not_first".equals(codeString))
412          return NOTFIRST;
413        if ("last".equals(codeString))
414          return LAST;
415        if ("not_last".equals(codeString))
416          return NOTLAST;
417        if ("only_one".equals(codeString))
418          return ONLYONE;
419        if (Configuration.isAcceptInvalidEnums())
420          return null;
421        else
422          throw new FHIRException("Unknown StructureMapSourceListMode code '"+codeString+"'");
423        }
424        public String toCode() {
425          switch (this) {
426            case FIRST: return "first";
427            case NOTFIRST: return "not_first";
428            case LAST: return "last";
429            case NOTLAST: return "not_last";
430            case ONLYONE: return "only_one";
431            default: return "?";
432          }
433        }
434        public String getSystem() {
435          switch (this) {
436            case FIRST: return "http://hl7.org/fhir/map-source-list-mode";
437            case NOTFIRST: return "http://hl7.org/fhir/map-source-list-mode";
438            case LAST: return "http://hl7.org/fhir/map-source-list-mode";
439            case NOTLAST: return "http://hl7.org/fhir/map-source-list-mode";
440            case ONLYONE: return "http://hl7.org/fhir/map-source-list-mode";
441            default: return "?";
442          }
443        }
444        public String getDefinition() {
445          switch (this) {
446            case FIRST: return "Only process this rule for the first in the list";
447            case NOTFIRST: return "Process this rule for all but the first";
448            case LAST: return "Only process this rule for the last in the list";
449            case NOTLAST: return "Process this rule for all but the last";
450            case ONLYONE: return "Only process this rule is there is only item";
451            default: return "?";
452          }
453        }
454        public String getDisplay() {
455          switch (this) {
456            case FIRST: return "First";
457            case NOTFIRST: return "All but the first";
458            case LAST: return "Last";
459            case NOTLAST: return "All but the last";
460            case ONLYONE: return "Enforce only one";
461            default: return "?";
462          }
463        }
464    }
465
466  public static class StructureMapSourceListModeEnumFactory implements EnumFactory<StructureMapSourceListMode> {
467    public StructureMapSourceListMode fromCode(String codeString) throws IllegalArgumentException {
468      if (codeString == null || "".equals(codeString))
469            if (codeString == null || "".equals(codeString))
470                return null;
471        if ("first".equals(codeString))
472          return StructureMapSourceListMode.FIRST;
473        if ("not_first".equals(codeString))
474          return StructureMapSourceListMode.NOTFIRST;
475        if ("last".equals(codeString))
476          return StructureMapSourceListMode.LAST;
477        if ("not_last".equals(codeString))
478          return StructureMapSourceListMode.NOTLAST;
479        if ("only_one".equals(codeString))
480          return StructureMapSourceListMode.ONLYONE;
481        throw new IllegalArgumentException("Unknown StructureMapSourceListMode code '"+codeString+"'");
482        }
483        public Enumeration<StructureMapSourceListMode> fromType(Base code) throws FHIRException {
484          if (code == null)
485            return null;
486          if (code.isEmpty())
487            return new Enumeration<StructureMapSourceListMode>(this);
488          String codeString = ((PrimitiveType) code).asStringValue();
489          if (codeString == null || "".equals(codeString))
490            return null;
491        if ("first".equals(codeString))
492          return new Enumeration<StructureMapSourceListMode>(this, StructureMapSourceListMode.FIRST);
493        if ("not_first".equals(codeString))
494          return new Enumeration<StructureMapSourceListMode>(this, StructureMapSourceListMode.NOTFIRST);
495        if ("last".equals(codeString))
496          return new Enumeration<StructureMapSourceListMode>(this, StructureMapSourceListMode.LAST);
497        if ("not_last".equals(codeString))
498          return new Enumeration<StructureMapSourceListMode>(this, StructureMapSourceListMode.NOTLAST);
499        if ("only_one".equals(codeString))
500          return new Enumeration<StructureMapSourceListMode>(this, StructureMapSourceListMode.ONLYONE);
501        throw new FHIRException("Unknown StructureMapSourceListMode code '"+codeString+"'");
502        }
503    public String toCode(StructureMapSourceListMode code) {
504      if (code == StructureMapSourceListMode.FIRST)
505        return "first";
506      if (code == StructureMapSourceListMode.NOTFIRST)
507        return "not_first";
508      if (code == StructureMapSourceListMode.LAST)
509        return "last";
510      if (code == StructureMapSourceListMode.NOTLAST)
511        return "not_last";
512      if (code == StructureMapSourceListMode.ONLYONE)
513        return "only_one";
514      return "?";
515      }
516    public String toSystem(StructureMapSourceListMode code) {
517      return code.getSystem();
518      }
519    }
520
521    public enum StructureMapContextType {
522        /**
523         * The context specifies a type
524         */
525        TYPE, 
526        /**
527         * The context specifies a variable
528         */
529        VARIABLE, 
530        /**
531         * added to help the parsers with the generic types
532         */
533        NULL;
534        public static StructureMapContextType fromCode(String codeString) throws FHIRException {
535            if (codeString == null || "".equals(codeString))
536                return null;
537        if ("type".equals(codeString))
538          return TYPE;
539        if ("variable".equals(codeString))
540          return VARIABLE;
541        if (Configuration.isAcceptInvalidEnums())
542          return null;
543        else
544          throw new FHIRException("Unknown StructureMapContextType code '"+codeString+"'");
545        }
546        public String toCode() {
547          switch (this) {
548            case TYPE: return "type";
549            case VARIABLE: return "variable";
550            default: return "?";
551          }
552        }
553        public String getSystem() {
554          switch (this) {
555            case TYPE: return "http://hl7.org/fhir/map-context-type";
556            case VARIABLE: return "http://hl7.org/fhir/map-context-type";
557            default: return "?";
558          }
559        }
560        public String getDefinition() {
561          switch (this) {
562            case TYPE: return "The context specifies a type";
563            case VARIABLE: return "The context specifies a variable";
564            default: return "?";
565          }
566        }
567        public String getDisplay() {
568          switch (this) {
569            case TYPE: return "Type";
570            case VARIABLE: return "Variable";
571            default: return "?";
572          }
573        }
574    }
575
576  public static class StructureMapContextTypeEnumFactory implements EnumFactory<StructureMapContextType> {
577    public StructureMapContextType fromCode(String codeString) throws IllegalArgumentException {
578      if (codeString == null || "".equals(codeString))
579            if (codeString == null || "".equals(codeString))
580                return null;
581        if ("type".equals(codeString))
582          return StructureMapContextType.TYPE;
583        if ("variable".equals(codeString))
584          return StructureMapContextType.VARIABLE;
585        throw new IllegalArgumentException("Unknown StructureMapContextType code '"+codeString+"'");
586        }
587        public Enumeration<StructureMapContextType> fromType(Base code) throws FHIRException {
588          if (code == null)
589            return null;
590          if (code.isEmpty())
591            return new Enumeration<StructureMapContextType>(this);
592          String codeString = ((PrimitiveType) code).asStringValue();
593          if (codeString == null || "".equals(codeString))
594            return null;
595        if ("type".equals(codeString))
596          return new Enumeration<StructureMapContextType>(this, StructureMapContextType.TYPE);
597        if ("variable".equals(codeString))
598          return new Enumeration<StructureMapContextType>(this, StructureMapContextType.VARIABLE);
599        throw new FHIRException("Unknown StructureMapContextType code '"+codeString+"'");
600        }
601    public String toCode(StructureMapContextType code) {
602      if (code == StructureMapContextType.TYPE)
603        return "type";
604      if (code == StructureMapContextType.VARIABLE)
605        return "variable";
606      return "?";
607      }
608    public String toSystem(StructureMapContextType code) {
609      return code.getSystem();
610      }
611    }
612
613    public enum StructureMapTargetListMode {
614        /**
615         * when the target list is being assembled, the items for this rule go first. If more that one rule defines a first item (for a given instance of mapping) then this is an error
616         */
617        FIRST, 
618        /**
619         * the target instance is shared with the target instances generated by another rule (up to the first common n items, then create new ones)
620         */
621        SHARE, 
622        /**
623         * when the target list is being assembled, the items for this rule go last. If more that one rule defines a last item (for a given instance of mapping) then this is an error
624         */
625        LAST, 
626        /**
627         * re-use the first item in the list, and keep adding content to it
628         */
629        COLLATE, 
630        /**
631         * added to help the parsers with the generic types
632         */
633        NULL;
634        public static StructureMapTargetListMode fromCode(String codeString) throws FHIRException {
635            if (codeString == null || "".equals(codeString))
636                return null;
637        if ("first".equals(codeString))
638          return FIRST;
639        if ("share".equals(codeString))
640          return SHARE;
641        if ("last".equals(codeString))
642          return LAST;
643        if ("collate".equals(codeString))
644          return COLLATE;
645        if (Configuration.isAcceptInvalidEnums())
646          return null;
647        else
648          throw new FHIRException("Unknown StructureMapTargetListMode code '"+codeString+"'");
649        }
650        public String toCode() {
651          switch (this) {
652            case FIRST: return "first";
653            case SHARE: return "share";
654            case LAST: return "last";
655            case COLLATE: return "collate";
656            default: return "?";
657          }
658        }
659        public String getSystem() {
660          switch (this) {
661            case FIRST: return "http://hl7.org/fhir/map-target-list-mode";
662            case SHARE: return "http://hl7.org/fhir/map-target-list-mode";
663            case LAST: return "http://hl7.org/fhir/map-target-list-mode";
664            case COLLATE: return "http://hl7.org/fhir/map-target-list-mode";
665            default: return "?";
666          }
667        }
668        public String getDefinition() {
669          switch (this) {
670            case FIRST: return "when the target list is being assembled, the items for this rule go first. If more that one rule defines a first item (for a given instance of mapping) then this is an error";
671            case SHARE: return "the target instance is shared with the target instances generated by another rule (up to the first common n items, then create new ones)";
672            case LAST: return "when the target list is being assembled, the items for this rule go last. If more that one rule defines a last item (for a given instance of mapping) then this is an error";
673            case COLLATE: return "re-use the first item in the list, and keep adding content to it";
674            default: return "?";
675          }
676        }
677        public String getDisplay() {
678          switch (this) {
679            case FIRST: return "First";
680            case SHARE: return "Share";
681            case LAST: return "Last";
682            case COLLATE: return "Collate";
683            default: return "?";
684          }
685        }
686    }
687
688  public static class StructureMapTargetListModeEnumFactory implements EnumFactory<StructureMapTargetListMode> {
689    public StructureMapTargetListMode fromCode(String codeString) throws IllegalArgumentException {
690      if (codeString == null || "".equals(codeString))
691            if (codeString == null || "".equals(codeString))
692                return null;
693        if ("first".equals(codeString))
694          return StructureMapTargetListMode.FIRST;
695        if ("share".equals(codeString))
696          return StructureMapTargetListMode.SHARE;
697        if ("last".equals(codeString))
698          return StructureMapTargetListMode.LAST;
699        if ("collate".equals(codeString))
700          return StructureMapTargetListMode.COLLATE;
701        throw new IllegalArgumentException("Unknown StructureMapTargetListMode code '"+codeString+"'");
702        }
703        public Enumeration<StructureMapTargetListMode> fromType(Base code) throws FHIRException {
704          if (code == null)
705            return null;
706          if (code.isEmpty())
707            return new Enumeration<StructureMapTargetListMode>(this);
708          String codeString = ((PrimitiveType) code).asStringValue();
709          if (codeString == null || "".equals(codeString))
710            return null;
711        if ("first".equals(codeString))
712          return new Enumeration<StructureMapTargetListMode>(this, StructureMapTargetListMode.FIRST);
713        if ("share".equals(codeString))
714          return new Enumeration<StructureMapTargetListMode>(this, StructureMapTargetListMode.SHARE);
715        if ("last".equals(codeString))
716          return new Enumeration<StructureMapTargetListMode>(this, StructureMapTargetListMode.LAST);
717        if ("collate".equals(codeString))
718          return new Enumeration<StructureMapTargetListMode>(this, StructureMapTargetListMode.COLLATE);
719        throw new FHIRException("Unknown StructureMapTargetListMode code '"+codeString+"'");
720        }
721    public String toCode(StructureMapTargetListMode code) {
722      if (code == StructureMapTargetListMode.FIRST)
723        return "first";
724      if (code == StructureMapTargetListMode.SHARE)
725        return "share";
726      if (code == StructureMapTargetListMode.LAST)
727        return "last";
728      if (code == StructureMapTargetListMode.COLLATE)
729        return "collate";
730      return "?";
731      }
732    public String toSystem(StructureMapTargetListMode code) {
733      return code.getSystem();
734      }
735    }
736
737    public enum StructureMapTransform {
738        /**
739         * create(type : string) - type is passed through to the application on the standard API, and must be known by it
740         */
741        CREATE, 
742        /**
743         * copy(source)
744         */
745        COPY, 
746        /**
747         * truncate(source, length) - source must be stringy type
748         */
749        TRUNCATE, 
750        /**
751         * escape(source, fmt1, fmt2) - change source from one kind of escaping to another (plain, java, xml, json). note that this is for when the string itself is escaped
752         */
753        ESCAPE, 
754        /**
755         * cast(source, type?) - case source from one type to another. target type can be left as implicit if there is one and only one target type known
756         */
757        CAST, 
758        /**
759         * append(source...) - source is element or string
760         */
761        APPEND, 
762        /**
763         * translate(source, uri_of_map) - use the translate operation
764         */
765        TRANSLATE, 
766        /**
767         * reference(source : object) - return a string that references the provided tree properly
768         */
769        REFERENCE, 
770        /**
771         * Perform a date operation. *Parameters to be documented*
772         */
773        DATEOP, 
774        /**
775         * Generate a random UUID (in lowercase). No Parameters
776         */
777        UUID, 
778        /**
779         * Return the appropriate string to put in a reference that refers to the resource provided as a parameter
780         */
781        POINTER, 
782        /**
783         * Execute the supplied fluentpath expression and use the value returned by that
784         */
785        EVALUATE, 
786        /**
787         * Create a CodeableConcept. Parameters = (text) or (system. Code[, display])
788         */
789        CC, 
790        /**
791         * Create a Coding. Parameters = (system. Code[, display])
792         */
793        C, 
794        /**
795         * Create a quantity. Parameters = (text) or (value, unit, [system, code]) where text is the natural representation e.g. [comparator]value[space]unit
796         */
797        QTY, 
798        /**
799         * Create an identifier. Parameters = (system, value[, type]) where type is a code from the identifier type value set
800         */
801        ID, 
802        /**
803         * Create a contact details. Parameters = (value) or (system, value). If no system is provided, the system should be inferred from the content of the value
804         */
805        CP, 
806        /**
807         * added to help the parsers with the generic types
808         */
809        NULL;
810        public static StructureMapTransform fromCode(String codeString) throws FHIRException {
811            if (codeString == null || "".equals(codeString))
812                return null;
813        if ("create".equals(codeString))
814          return CREATE;
815        if ("copy".equals(codeString))
816          return COPY;
817        if ("truncate".equals(codeString))
818          return TRUNCATE;
819        if ("escape".equals(codeString))
820          return ESCAPE;
821        if ("cast".equals(codeString))
822          return CAST;
823        if ("append".equals(codeString))
824          return APPEND;
825        if ("translate".equals(codeString))
826          return TRANSLATE;
827        if ("reference".equals(codeString))
828          return REFERENCE;
829        if ("dateOp".equals(codeString))
830          return DATEOP;
831        if ("uuid".equals(codeString))
832          return UUID;
833        if ("pointer".equals(codeString))
834          return POINTER;
835        if ("evaluate".equals(codeString))
836          return EVALUATE;
837        if ("cc".equals(codeString))
838          return CC;
839        if ("c".equals(codeString))
840          return C;
841        if ("qty".equals(codeString))
842          return QTY;
843        if ("id".equals(codeString))
844          return ID;
845        if ("cp".equals(codeString))
846          return CP;
847        if (Configuration.isAcceptInvalidEnums())
848          return null;
849        else
850          throw new FHIRException("Unknown StructureMapTransform code '"+codeString+"'");
851        }
852        public String toCode() {
853          switch (this) {
854            case CREATE: return "create";
855            case COPY: return "copy";
856            case TRUNCATE: return "truncate";
857            case ESCAPE: return "escape";
858            case CAST: return "cast";
859            case APPEND: return "append";
860            case TRANSLATE: return "translate";
861            case REFERENCE: return "reference";
862            case DATEOP: return "dateOp";
863            case UUID: return "uuid";
864            case POINTER: return "pointer";
865            case EVALUATE: return "evaluate";
866            case CC: return "cc";
867            case C: return "c";
868            case QTY: return "qty";
869            case ID: return "id";
870            case CP: return "cp";
871            default: return "?";
872          }
873        }
874        public String getSystem() {
875          switch (this) {
876            case CREATE: return "http://hl7.org/fhir/map-transform";
877            case COPY: return "http://hl7.org/fhir/map-transform";
878            case TRUNCATE: return "http://hl7.org/fhir/map-transform";
879            case ESCAPE: return "http://hl7.org/fhir/map-transform";
880            case CAST: return "http://hl7.org/fhir/map-transform";
881            case APPEND: return "http://hl7.org/fhir/map-transform";
882            case TRANSLATE: return "http://hl7.org/fhir/map-transform";
883            case REFERENCE: return "http://hl7.org/fhir/map-transform";
884            case DATEOP: return "http://hl7.org/fhir/map-transform";
885            case UUID: return "http://hl7.org/fhir/map-transform";
886            case POINTER: return "http://hl7.org/fhir/map-transform";
887            case EVALUATE: return "http://hl7.org/fhir/map-transform";
888            case CC: return "http://hl7.org/fhir/map-transform";
889            case C: return "http://hl7.org/fhir/map-transform";
890            case QTY: return "http://hl7.org/fhir/map-transform";
891            case ID: return "http://hl7.org/fhir/map-transform";
892            case CP: return "http://hl7.org/fhir/map-transform";
893            default: return "?";
894          }
895        }
896        public String getDefinition() {
897          switch (this) {
898            case CREATE: return "create(type : string) - type is passed through to the application on the standard API, and must be known by it";
899            case COPY: return "copy(source)";
900            case TRUNCATE: return "truncate(source, length) - source must be stringy type";
901            case ESCAPE: return "escape(source, fmt1, fmt2) - change source from one kind of escaping to another (plain, java, xml, json). note that this is for when the string itself is escaped";
902            case CAST: return "cast(source, type?) - case source from one type to another. target type can be left as implicit if there is one and only one target type known";
903            case APPEND: return "append(source...) - source is element or string";
904            case TRANSLATE: return "translate(source, uri_of_map) - use the translate operation";
905            case REFERENCE: return "reference(source : object) - return a string that references the provided tree properly";
906            case DATEOP: return "Perform a date operation. *Parameters to be documented*";
907            case UUID: return "Generate a random UUID (in lowercase). No Parameters";
908            case POINTER: return "Return the appropriate string to put in a reference that refers to the resource provided as a parameter";
909            case EVALUATE: return "Execute the supplied fluentpath expression and use the value returned by that";
910            case CC: return "Create a CodeableConcept. Parameters = (text) or (system. Code[, display])";
911            case C: return "Create a Coding. Parameters = (system. Code[, display])";
912            case QTY: return "Create a quantity. Parameters = (text) or (value, unit, [system, code]) where text is the natural representation e.g. [comparator]value[space]unit";
913            case ID: return "Create an identifier. Parameters = (system, value[, type]) where type is a code from the identifier type value set";
914            case CP: return "Create a contact details. Parameters = (value) or (system, value). If no system is provided, the system should be inferred from the content of the value";
915            default: return "?";
916          }
917        }
918        public String getDisplay() {
919          switch (this) {
920            case CREATE: return "create";
921            case COPY: return "copy";
922            case TRUNCATE: return "truncate";
923            case ESCAPE: return "escape";
924            case CAST: return "cast";
925            case APPEND: return "append";
926            case TRANSLATE: return "translate";
927            case REFERENCE: return "reference";
928            case DATEOP: return "dateOp";
929            case UUID: return "uuid";
930            case POINTER: return "pointer";
931            case EVALUATE: return "evaluate";
932            case CC: return "cc";
933            case C: return "c";
934            case QTY: return "qty";
935            case ID: return "id";
936            case CP: return "cp";
937            default: return "?";
938          }
939        }
940    }
941
942  public static class StructureMapTransformEnumFactory implements EnumFactory<StructureMapTransform> {
943    public StructureMapTransform fromCode(String codeString) throws IllegalArgumentException {
944      if (codeString == null || "".equals(codeString))
945            if (codeString == null || "".equals(codeString))
946                return null;
947        if ("create".equals(codeString))
948          return StructureMapTransform.CREATE;
949        if ("copy".equals(codeString))
950          return StructureMapTransform.COPY;
951        if ("truncate".equals(codeString))
952          return StructureMapTransform.TRUNCATE;
953        if ("escape".equals(codeString))
954          return StructureMapTransform.ESCAPE;
955        if ("cast".equals(codeString))
956          return StructureMapTransform.CAST;
957        if ("append".equals(codeString))
958          return StructureMapTransform.APPEND;
959        if ("translate".equals(codeString))
960          return StructureMapTransform.TRANSLATE;
961        if ("reference".equals(codeString))
962          return StructureMapTransform.REFERENCE;
963        if ("dateOp".equals(codeString))
964          return StructureMapTransform.DATEOP;
965        if ("uuid".equals(codeString))
966          return StructureMapTransform.UUID;
967        if ("pointer".equals(codeString))
968          return StructureMapTransform.POINTER;
969        if ("evaluate".equals(codeString))
970          return StructureMapTransform.EVALUATE;
971        if ("cc".equals(codeString))
972          return StructureMapTransform.CC;
973        if ("c".equals(codeString))
974          return StructureMapTransform.C;
975        if ("qty".equals(codeString))
976          return StructureMapTransform.QTY;
977        if ("id".equals(codeString))
978          return StructureMapTransform.ID;
979        if ("cp".equals(codeString))
980          return StructureMapTransform.CP;
981        throw new IllegalArgumentException("Unknown StructureMapTransform code '"+codeString+"'");
982        }
983        public Enumeration<StructureMapTransform> fromType(Base code) throws FHIRException {
984          if (code == null)
985            return null;
986          if (code.isEmpty())
987            return new Enumeration<StructureMapTransform>(this);
988          String codeString = ((PrimitiveType) code).asStringValue();
989          if (codeString == null || "".equals(codeString))
990            return null;
991        if ("create".equals(codeString))
992          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.CREATE);
993        if ("copy".equals(codeString))
994          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.COPY);
995        if ("truncate".equals(codeString))
996          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.TRUNCATE);
997        if ("escape".equals(codeString))
998          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.ESCAPE);
999        if ("cast".equals(codeString))
1000          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.CAST);
1001        if ("append".equals(codeString))
1002          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.APPEND);
1003        if ("translate".equals(codeString))
1004          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.TRANSLATE);
1005        if ("reference".equals(codeString))
1006          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.REFERENCE);
1007        if ("dateOp".equals(codeString))
1008          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.DATEOP);
1009        if ("uuid".equals(codeString))
1010          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.UUID);
1011        if ("pointer".equals(codeString))
1012          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.POINTER);
1013        if ("evaluate".equals(codeString))
1014          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.EVALUATE);
1015        if ("cc".equals(codeString))
1016          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.CC);
1017        if ("c".equals(codeString))
1018          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.C);
1019        if ("qty".equals(codeString))
1020          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.QTY);
1021        if ("id".equals(codeString))
1022          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.ID);
1023        if ("cp".equals(codeString))
1024          return new Enumeration<StructureMapTransform>(this, StructureMapTransform.CP);
1025        throw new FHIRException("Unknown StructureMapTransform code '"+codeString+"'");
1026        }
1027    public String toCode(StructureMapTransform code) {
1028      if (code == StructureMapTransform.CREATE)
1029        return "create";
1030      if (code == StructureMapTransform.COPY)
1031        return "copy";
1032      if (code == StructureMapTransform.TRUNCATE)
1033        return "truncate";
1034      if (code == StructureMapTransform.ESCAPE)
1035        return "escape";
1036      if (code == StructureMapTransform.CAST)
1037        return "cast";
1038      if (code == StructureMapTransform.APPEND)
1039        return "append";
1040      if (code == StructureMapTransform.TRANSLATE)
1041        return "translate";
1042      if (code == StructureMapTransform.REFERENCE)
1043        return "reference";
1044      if (code == StructureMapTransform.DATEOP)
1045        return "dateOp";
1046      if (code == StructureMapTransform.UUID)
1047        return "uuid";
1048      if (code == StructureMapTransform.POINTER)
1049        return "pointer";
1050      if (code == StructureMapTransform.EVALUATE)
1051        return "evaluate";
1052      if (code == StructureMapTransform.CC)
1053        return "cc";
1054      if (code == StructureMapTransform.C)
1055        return "c";
1056      if (code == StructureMapTransform.QTY)
1057        return "qty";
1058      if (code == StructureMapTransform.ID)
1059        return "id";
1060      if (code == StructureMapTransform.CP)
1061        return "cp";
1062      return "?";
1063      }
1064    public String toSystem(StructureMapTransform code) {
1065      return code.getSystem();
1066      }
1067    }
1068
1069    @Block()
1070    public static class StructureMapStructureComponent extends BackboneElement implements IBaseBackboneElement {
1071        /**
1072         * The canonical URL that identifies the structure.
1073         */
1074        @Child(name = "url", type = {UriType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1075        @Description(shortDefinition="Canonical URL for structure definition", formalDefinition="The canonical URL that identifies the structure." )
1076        protected UriType url;
1077
1078        /**
1079         * How the referenced structure is used in this mapping.
1080         */
1081        @Child(name = "mode", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1082        @Description(shortDefinition="source | queried | target | produced", formalDefinition="How the referenced structure is used in this mapping." )
1083        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-model-mode")
1084        protected Enumeration<StructureMapModelMode> mode;
1085
1086        /**
1087         * The name used for this type in the map.
1088         */
1089        @Child(name = "alias", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1090        @Description(shortDefinition="Name for type in this map", formalDefinition="The name used for this type in the map." )
1091        protected StringType alias;
1092
1093        /**
1094         * Documentation that describes how the structure is used in the mapping.
1095         */
1096        @Child(name = "documentation", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1097        @Description(shortDefinition="Documentation on use of structure", formalDefinition="Documentation that describes how the structure is used in the mapping." )
1098        protected StringType documentation;
1099
1100        private static final long serialVersionUID = -277986558L;
1101
1102    /**
1103     * Constructor
1104     */
1105      public StructureMapStructureComponent() {
1106        super();
1107      }
1108
1109    /**
1110     * Constructor
1111     */
1112      public StructureMapStructureComponent(UriType url, Enumeration<StructureMapModelMode> mode) {
1113        super();
1114        this.url = url;
1115        this.mode = mode;
1116      }
1117
1118        /**
1119         * @return {@link #url} (The canonical URL that identifies the structure.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1120         */
1121        public UriType getUrlElement() { 
1122          if (this.url == null)
1123            if (Configuration.errorOnAutoCreate())
1124              throw new Error("Attempt to auto-create StructureMapStructureComponent.url");
1125            else if (Configuration.doAutoCreate())
1126              this.url = new UriType(); // bb
1127          return this.url;
1128        }
1129
1130        public boolean hasUrlElement() { 
1131          return this.url != null && !this.url.isEmpty();
1132        }
1133
1134        public boolean hasUrl() { 
1135          return this.url != null && !this.url.isEmpty();
1136        }
1137
1138        /**
1139         * @param value {@link #url} (The canonical URL that identifies the structure.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1140         */
1141        public StructureMapStructureComponent setUrlElement(UriType value) { 
1142          this.url = value;
1143          return this;
1144        }
1145
1146        /**
1147         * @return The canonical URL that identifies the structure.
1148         */
1149        public String getUrl() { 
1150          return this.url == null ? null : this.url.getValue();
1151        }
1152
1153        /**
1154         * @param value The canonical URL that identifies the structure.
1155         */
1156        public StructureMapStructureComponent setUrl(String value) { 
1157            if (this.url == null)
1158              this.url = new UriType();
1159            this.url.setValue(value);
1160          return this;
1161        }
1162
1163        /**
1164         * @return {@link #mode} (How the referenced structure is used in this mapping.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
1165         */
1166        public Enumeration<StructureMapModelMode> getModeElement() { 
1167          if (this.mode == null)
1168            if (Configuration.errorOnAutoCreate())
1169              throw new Error("Attempt to auto-create StructureMapStructureComponent.mode");
1170            else if (Configuration.doAutoCreate())
1171              this.mode = new Enumeration<StructureMapModelMode>(new StructureMapModelModeEnumFactory()); // bb
1172          return this.mode;
1173        }
1174
1175        public boolean hasModeElement() { 
1176          return this.mode != null && !this.mode.isEmpty();
1177        }
1178
1179        public boolean hasMode() { 
1180          return this.mode != null && !this.mode.isEmpty();
1181        }
1182
1183        /**
1184         * @param value {@link #mode} (How the referenced structure is used in this mapping.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
1185         */
1186        public StructureMapStructureComponent setModeElement(Enumeration<StructureMapModelMode> value) { 
1187          this.mode = value;
1188          return this;
1189        }
1190
1191        /**
1192         * @return How the referenced structure is used in this mapping.
1193         */
1194        public StructureMapModelMode getMode() { 
1195          return this.mode == null ? null : this.mode.getValue();
1196        }
1197
1198        /**
1199         * @param value How the referenced structure is used in this mapping.
1200         */
1201        public StructureMapStructureComponent setMode(StructureMapModelMode value) { 
1202            if (this.mode == null)
1203              this.mode = new Enumeration<StructureMapModelMode>(new StructureMapModelModeEnumFactory());
1204            this.mode.setValue(value);
1205          return this;
1206        }
1207
1208        /**
1209         * @return {@link #alias} (The name used for this type in the map.). This is the underlying object with id, value and extensions. The accessor "getAlias" gives direct access to the value
1210         */
1211        public StringType getAliasElement() { 
1212          if (this.alias == null)
1213            if (Configuration.errorOnAutoCreate())
1214              throw new Error("Attempt to auto-create StructureMapStructureComponent.alias");
1215            else if (Configuration.doAutoCreate())
1216              this.alias = new StringType(); // bb
1217          return this.alias;
1218        }
1219
1220        public boolean hasAliasElement() { 
1221          return this.alias != null && !this.alias.isEmpty();
1222        }
1223
1224        public boolean hasAlias() { 
1225          return this.alias != null && !this.alias.isEmpty();
1226        }
1227
1228        /**
1229         * @param value {@link #alias} (The name used for this type in the map.). This is the underlying object with id, value and extensions. The accessor "getAlias" gives direct access to the value
1230         */
1231        public StructureMapStructureComponent setAliasElement(StringType value) { 
1232          this.alias = value;
1233          return this;
1234        }
1235
1236        /**
1237         * @return The name used for this type in the map.
1238         */
1239        public String getAlias() { 
1240          return this.alias == null ? null : this.alias.getValue();
1241        }
1242
1243        /**
1244         * @param value The name used for this type in the map.
1245         */
1246        public StructureMapStructureComponent setAlias(String value) { 
1247          if (Utilities.noString(value))
1248            this.alias = null;
1249          else {
1250            if (this.alias == null)
1251              this.alias = new StringType();
1252            this.alias.setValue(value);
1253          }
1254          return this;
1255        }
1256
1257        /**
1258         * @return {@link #documentation} (Documentation that describes how the structure is used in the mapping.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
1259         */
1260        public StringType getDocumentationElement() { 
1261          if (this.documentation == null)
1262            if (Configuration.errorOnAutoCreate())
1263              throw new Error("Attempt to auto-create StructureMapStructureComponent.documentation");
1264            else if (Configuration.doAutoCreate())
1265              this.documentation = new StringType(); // bb
1266          return this.documentation;
1267        }
1268
1269        public boolean hasDocumentationElement() { 
1270          return this.documentation != null && !this.documentation.isEmpty();
1271        }
1272
1273        public boolean hasDocumentation() { 
1274          return this.documentation != null && !this.documentation.isEmpty();
1275        }
1276
1277        /**
1278         * @param value {@link #documentation} (Documentation that describes how the structure is used in the mapping.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
1279         */
1280        public StructureMapStructureComponent setDocumentationElement(StringType value) { 
1281          this.documentation = value;
1282          return this;
1283        }
1284
1285        /**
1286         * @return Documentation that describes how the structure is used in the mapping.
1287         */
1288        public String getDocumentation() { 
1289          return this.documentation == null ? null : this.documentation.getValue();
1290        }
1291
1292        /**
1293         * @param value Documentation that describes how the structure is used in the mapping.
1294         */
1295        public StructureMapStructureComponent setDocumentation(String value) { 
1296          if (Utilities.noString(value))
1297            this.documentation = null;
1298          else {
1299            if (this.documentation == null)
1300              this.documentation = new StringType();
1301            this.documentation.setValue(value);
1302          }
1303          return this;
1304        }
1305
1306        protected void listChildren(List<Property> childrenList) {
1307          super.listChildren(childrenList);
1308          childrenList.add(new Property("url", "uri", "The canonical URL that identifies the structure.", 0, java.lang.Integer.MAX_VALUE, url));
1309          childrenList.add(new Property("mode", "code", "How the referenced structure is used in this mapping.", 0, java.lang.Integer.MAX_VALUE, mode));
1310          childrenList.add(new Property("alias", "string", "The name used for this type in the map.", 0, java.lang.Integer.MAX_VALUE, alias));
1311          childrenList.add(new Property("documentation", "string", "Documentation that describes how the structure is used in the mapping.", 0, java.lang.Integer.MAX_VALUE, documentation));
1312        }
1313
1314      @Override
1315      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1316        switch (hash) {
1317        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
1318        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<StructureMapModelMode>
1319        case 92902992: /*alias*/ return this.alias == null ? new Base[0] : new Base[] {this.alias}; // StringType
1320        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
1321        default: return super.getProperty(hash, name, checkValid);
1322        }
1323
1324      }
1325
1326      @Override
1327      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1328        switch (hash) {
1329        case 116079: // url
1330          this.url = castToUri(value); // UriType
1331          return value;
1332        case 3357091: // mode
1333          value = new StructureMapModelModeEnumFactory().fromType(castToCode(value));
1334          this.mode = (Enumeration) value; // Enumeration<StructureMapModelMode>
1335          return value;
1336        case 92902992: // alias
1337          this.alias = castToString(value); // StringType
1338          return value;
1339        case 1587405498: // documentation
1340          this.documentation = castToString(value); // StringType
1341          return value;
1342        default: return super.setProperty(hash, name, value);
1343        }
1344
1345      }
1346
1347      @Override
1348      public Base setProperty(String name, Base value) throws FHIRException {
1349        if (name.equals("url")) {
1350          this.url = castToUri(value); // UriType
1351        } else if (name.equals("mode")) {
1352          value = new StructureMapModelModeEnumFactory().fromType(castToCode(value));
1353          this.mode = (Enumeration) value; // Enumeration<StructureMapModelMode>
1354        } else if (name.equals("alias")) {
1355          this.alias = castToString(value); // StringType
1356        } else if (name.equals("documentation")) {
1357          this.documentation = castToString(value); // StringType
1358        } else
1359          return super.setProperty(name, value);
1360        return value;
1361      }
1362
1363      @Override
1364      public Base makeProperty(int hash, String name) throws FHIRException {
1365        switch (hash) {
1366        case 116079:  return getUrlElement();
1367        case 3357091:  return getModeElement();
1368        case 92902992:  return getAliasElement();
1369        case 1587405498:  return getDocumentationElement();
1370        default: return super.makeProperty(hash, name);
1371        }
1372
1373      }
1374
1375      @Override
1376      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1377        switch (hash) {
1378        case 116079: /*url*/ return new String[] {"uri"};
1379        case 3357091: /*mode*/ return new String[] {"code"};
1380        case 92902992: /*alias*/ return new String[] {"string"};
1381        case 1587405498: /*documentation*/ return new String[] {"string"};
1382        default: return super.getTypesForProperty(hash, name);
1383        }
1384
1385      }
1386
1387      @Override
1388      public Base addChild(String name) throws FHIRException {
1389        if (name.equals("url")) {
1390          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.url");
1391        }
1392        else if (name.equals("mode")) {
1393          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.mode");
1394        }
1395        else if (name.equals("alias")) {
1396          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.alias");
1397        }
1398        else if (name.equals("documentation")) {
1399          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
1400        }
1401        else
1402          return super.addChild(name);
1403      }
1404
1405      public StructureMapStructureComponent copy() {
1406        StructureMapStructureComponent dst = new StructureMapStructureComponent();
1407        copyValues(dst);
1408        dst.url = url == null ? null : url.copy();
1409        dst.mode = mode == null ? null : mode.copy();
1410        dst.alias = alias == null ? null : alias.copy();
1411        dst.documentation = documentation == null ? null : documentation.copy();
1412        return dst;
1413      }
1414
1415      @Override
1416      public boolean equalsDeep(Base other) {
1417        if (!super.equalsDeep(other))
1418          return false;
1419        if (!(other instanceof StructureMapStructureComponent))
1420          return false;
1421        StructureMapStructureComponent o = (StructureMapStructureComponent) other;
1422        return compareDeep(url, o.url, true) && compareDeep(mode, o.mode, true) && compareDeep(alias, o.alias, true)
1423           && compareDeep(documentation, o.documentation, true);
1424      }
1425
1426      @Override
1427      public boolean equalsShallow(Base other) {
1428        if (!super.equalsShallow(other))
1429          return false;
1430        if (!(other instanceof StructureMapStructureComponent))
1431          return false;
1432        StructureMapStructureComponent o = (StructureMapStructureComponent) other;
1433        return compareValues(url, o.url, true) && compareValues(mode, o.mode, true) && compareValues(alias, o.alias, true)
1434           && compareValues(documentation, o.documentation, true);
1435      }
1436
1437      public boolean isEmpty() {
1438        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, mode, alias, documentation
1439          );
1440      }
1441
1442  public String fhirType() {
1443    return "StructureMap.structure";
1444
1445  }
1446
1447  }
1448
1449    @Block()
1450    public static class StructureMapGroupComponent extends BackboneElement implements IBaseBackboneElement {
1451        /**
1452         * A unique name for the group for the convenience of human readers.
1453         */
1454        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1455        @Description(shortDefinition="Human-readable label", formalDefinition="A unique name for the group for the convenience of human readers." )
1456        protected IdType name;
1457
1458        /**
1459         * Another group that this group adds rules to.
1460         */
1461        @Child(name = "extends", type = {IdType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1462        @Description(shortDefinition="Another group that this group adds rules to", formalDefinition="Another group that this group adds rules to." )
1463        protected IdType extends_;
1464
1465        /**
1466         * If this is the default rule set to apply for thie source type, or this combination of types.
1467         */
1468        @Child(name = "typeMode", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1469        @Description(shortDefinition="none | types | type-and-types", formalDefinition="If this is the default rule set to apply for thie source type, or this combination of types." )
1470        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-group-type-mode")
1471        protected Enumeration<StructureMapGroupTypeMode> typeMode;
1472
1473        /**
1474         * Additional supporting documentation that explains the purpose of the group and the types of mappings within it.
1475         */
1476        @Child(name = "documentation", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1477        @Description(shortDefinition="Additional description/explaination for group", formalDefinition="Additional supporting documentation that explains the purpose of the group and the types of mappings within it." )
1478        protected StringType documentation;
1479
1480        /**
1481         * A name assigned to an instance of data. The instance must be provided when the mapping is invoked.
1482         */
1483        @Child(name = "input", type = {}, order=5, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1484        @Description(shortDefinition="Named instance provided when invoking the map", formalDefinition="A name assigned to an instance of data. The instance must be provided when the mapping is invoked." )
1485        protected List<StructureMapGroupInputComponent> input;
1486
1487        /**
1488         * Transform Rule from source to target.
1489         */
1490        @Child(name = "rule", type = {}, order=6, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1491        @Description(shortDefinition="Transform Rule from source to target", formalDefinition="Transform Rule from source to target." )
1492        protected List<StructureMapGroupRuleComponent> rule;
1493
1494        private static final long serialVersionUID = -1474595081L;
1495
1496    /**
1497     * Constructor
1498     */
1499      public StructureMapGroupComponent() {
1500        super();
1501      }
1502
1503    /**
1504     * Constructor
1505     */
1506      public StructureMapGroupComponent(IdType name, Enumeration<StructureMapGroupTypeMode> typeMode) {
1507        super();
1508        this.name = name;
1509        this.typeMode = typeMode;
1510      }
1511
1512        /**
1513         * @return {@link #name} (A unique name for the group for the convenience of human readers.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1514         */
1515        public IdType getNameElement() { 
1516          if (this.name == null)
1517            if (Configuration.errorOnAutoCreate())
1518              throw new Error("Attempt to auto-create StructureMapGroupComponent.name");
1519            else if (Configuration.doAutoCreate())
1520              this.name = new IdType(); // bb
1521          return this.name;
1522        }
1523
1524        public boolean hasNameElement() { 
1525          return this.name != null && !this.name.isEmpty();
1526        }
1527
1528        public boolean hasName() { 
1529          return this.name != null && !this.name.isEmpty();
1530        }
1531
1532        /**
1533         * @param value {@link #name} (A unique name for the group for the convenience of human readers.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1534         */
1535        public StructureMapGroupComponent setNameElement(IdType value) { 
1536          this.name = value;
1537          return this;
1538        }
1539
1540        /**
1541         * @return A unique name for the group for the convenience of human readers.
1542         */
1543        public String getName() { 
1544          return this.name == null ? null : this.name.getValue();
1545        }
1546
1547        /**
1548         * @param value A unique name for the group for the convenience of human readers.
1549         */
1550        public StructureMapGroupComponent setName(String value) { 
1551            if (this.name == null)
1552              this.name = new IdType();
1553            this.name.setValue(value);
1554          return this;
1555        }
1556
1557        /**
1558         * @return {@link #extends_} (Another group that this group adds rules to.). This is the underlying object with id, value and extensions. The accessor "getExtends" gives direct access to the value
1559         */
1560        public IdType getExtendsElement() { 
1561          if (this.extends_ == null)
1562            if (Configuration.errorOnAutoCreate())
1563              throw new Error("Attempt to auto-create StructureMapGroupComponent.extends_");
1564            else if (Configuration.doAutoCreate())
1565              this.extends_ = new IdType(); // bb
1566          return this.extends_;
1567        }
1568
1569        public boolean hasExtendsElement() { 
1570          return this.extends_ != null && !this.extends_.isEmpty();
1571        }
1572
1573        public boolean hasExtends() { 
1574          return this.extends_ != null && !this.extends_.isEmpty();
1575        }
1576
1577        /**
1578         * @param value {@link #extends_} (Another group that this group adds rules to.). This is the underlying object with id, value and extensions. The accessor "getExtends" gives direct access to the value
1579         */
1580        public StructureMapGroupComponent setExtendsElement(IdType value) { 
1581          this.extends_ = value;
1582          return this;
1583        }
1584
1585        /**
1586         * @return Another group that this group adds rules to.
1587         */
1588        public String getExtends() { 
1589          return this.extends_ == null ? null : this.extends_.getValue();
1590        }
1591
1592        /**
1593         * @param value Another group that this group adds rules to.
1594         */
1595        public StructureMapGroupComponent setExtends(String value) { 
1596          if (Utilities.noString(value))
1597            this.extends_ = null;
1598          else {
1599            if (this.extends_ == null)
1600              this.extends_ = new IdType();
1601            this.extends_.setValue(value);
1602          }
1603          return this;
1604        }
1605
1606        /**
1607         * @return {@link #typeMode} (If this is the default rule set to apply for thie source type, or this combination of types.). This is the underlying object with id, value and extensions. The accessor "getTypeMode" gives direct access to the value
1608         */
1609        public Enumeration<StructureMapGroupTypeMode> getTypeModeElement() { 
1610          if (this.typeMode == null)
1611            if (Configuration.errorOnAutoCreate())
1612              throw new Error("Attempt to auto-create StructureMapGroupComponent.typeMode");
1613            else if (Configuration.doAutoCreate())
1614              this.typeMode = new Enumeration<StructureMapGroupTypeMode>(new StructureMapGroupTypeModeEnumFactory()); // bb
1615          return this.typeMode;
1616        }
1617
1618        public boolean hasTypeModeElement() { 
1619          return this.typeMode != null && !this.typeMode.isEmpty();
1620        }
1621
1622        public boolean hasTypeMode() { 
1623          return this.typeMode != null && !this.typeMode.isEmpty();
1624        }
1625
1626        /**
1627         * @param value {@link #typeMode} (If this is the default rule set to apply for thie source type, or this combination of types.). This is the underlying object with id, value and extensions. The accessor "getTypeMode" gives direct access to the value
1628         */
1629        public StructureMapGroupComponent setTypeModeElement(Enumeration<StructureMapGroupTypeMode> value) { 
1630          this.typeMode = value;
1631          return this;
1632        }
1633
1634        /**
1635         * @return If this is the default rule set to apply for thie source type, or this combination of types.
1636         */
1637        public StructureMapGroupTypeMode getTypeMode() { 
1638          return this.typeMode == null ? null : this.typeMode.getValue();
1639        }
1640
1641        /**
1642         * @param value If this is the default rule set to apply for thie source type, or this combination of types.
1643         */
1644        public StructureMapGroupComponent setTypeMode(StructureMapGroupTypeMode value) { 
1645            if (this.typeMode == null)
1646              this.typeMode = new Enumeration<StructureMapGroupTypeMode>(new StructureMapGroupTypeModeEnumFactory());
1647            this.typeMode.setValue(value);
1648          return this;
1649        }
1650
1651        /**
1652         * @return {@link #documentation} (Additional supporting documentation that explains the purpose of the group and the types of mappings within it.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
1653         */
1654        public StringType getDocumentationElement() { 
1655          if (this.documentation == null)
1656            if (Configuration.errorOnAutoCreate())
1657              throw new Error("Attempt to auto-create StructureMapGroupComponent.documentation");
1658            else if (Configuration.doAutoCreate())
1659              this.documentation = new StringType(); // bb
1660          return this.documentation;
1661        }
1662
1663        public boolean hasDocumentationElement() { 
1664          return this.documentation != null && !this.documentation.isEmpty();
1665        }
1666
1667        public boolean hasDocumentation() { 
1668          return this.documentation != null && !this.documentation.isEmpty();
1669        }
1670
1671        /**
1672         * @param value {@link #documentation} (Additional supporting documentation that explains the purpose of the group and the types of mappings within it.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
1673         */
1674        public StructureMapGroupComponent setDocumentationElement(StringType value) { 
1675          this.documentation = value;
1676          return this;
1677        }
1678
1679        /**
1680         * @return Additional supporting documentation that explains the purpose of the group and the types of mappings within it.
1681         */
1682        public String getDocumentation() { 
1683          return this.documentation == null ? null : this.documentation.getValue();
1684        }
1685
1686        /**
1687         * @param value Additional supporting documentation that explains the purpose of the group and the types of mappings within it.
1688         */
1689        public StructureMapGroupComponent setDocumentation(String value) { 
1690          if (Utilities.noString(value))
1691            this.documentation = null;
1692          else {
1693            if (this.documentation == null)
1694              this.documentation = new StringType();
1695            this.documentation.setValue(value);
1696          }
1697          return this;
1698        }
1699
1700        /**
1701         * @return {@link #input} (A name assigned to an instance of data. The instance must be provided when the mapping is invoked.)
1702         */
1703        public List<StructureMapGroupInputComponent> getInput() { 
1704          if (this.input == null)
1705            this.input = new ArrayList<StructureMapGroupInputComponent>();
1706          return this.input;
1707        }
1708
1709        /**
1710         * @return Returns a reference to <code>this</code> for easy method chaining
1711         */
1712        public StructureMapGroupComponent setInput(List<StructureMapGroupInputComponent> theInput) { 
1713          this.input = theInput;
1714          return this;
1715        }
1716
1717        public boolean hasInput() { 
1718          if (this.input == null)
1719            return false;
1720          for (StructureMapGroupInputComponent item : this.input)
1721            if (!item.isEmpty())
1722              return true;
1723          return false;
1724        }
1725
1726        public StructureMapGroupInputComponent addInput() { //3
1727          StructureMapGroupInputComponent t = new StructureMapGroupInputComponent();
1728          if (this.input == null)
1729            this.input = new ArrayList<StructureMapGroupInputComponent>();
1730          this.input.add(t);
1731          return t;
1732        }
1733
1734        public StructureMapGroupComponent addInput(StructureMapGroupInputComponent t) { //3
1735          if (t == null)
1736            return this;
1737          if (this.input == null)
1738            this.input = new ArrayList<StructureMapGroupInputComponent>();
1739          this.input.add(t);
1740          return this;
1741        }
1742
1743        /**
1744         * @return The first repetition of repeating field {@link #input}, creating it if it does not already exist
1745         */
1746        public StructureMapGroupInputComponent getInputFirstRep() { 
1747          if (getInput().isEmpty()) {
1748            addInput();
1749          }
1750          return getInput().get(0);
1751        }
1752
1753        /**
1754         * @return {@link #rule} (Transform Rule from source to target.)
1755         */
1756        public List<StructureMapGroupRuleComponent> getRule() { 
1757          if (this.rule == null)
1758            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
1759          return this.rule;
1760        }
1761
1762        /**
1763         * @return Returns a reference to <code>this</code> for easy method chaining
1764         */
1765        public StructureMapGroupComponent setRule(List<StructureMapGroupRuleComponent> theRule) { 
1766          this.rule = theRule;
1767          return this;
1768        }
1769
1770        public boolean hasRule() { 
1771          if (this.rule == null)
1772            return false;
1773          for (StructureMapGroupRuleComponent item : this.rule)
1774            if (!item.isEmpty())
1775              return true;
1776          return false;
1777        }
1778
1779        public StructureMapGroupRuleComponent addRule() { //3
1780          StructureMapGroupRuleComponent t = new StructureMapGroupRuleComponent();
1781          if (this.rule == null)
1782            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
1783          this.rule.add(t);
1784          return t;
1785        }
1786
1787        public StructureMapGroupComponent addRule(StructureMapGroupRuleComponent t) { //3
1788          if (t == null)
1789            return this;
1790          if (this.rule == null)
1791            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
1792          this.rule.add(t);
1793          return this;
1794        }
1795
1796        /**
1797         * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist
1798         */
1799        public StructureMapGroupRuleComponent getRuleFirstRep() { 
1800          if (getRule().isEmpty()) {
1801            addRule();
1802          }
1803          return getRule().get(0);
1804        }
1805
1806        protected void listChildren(List<Property> childrenList) {
1807          super.listChildren(childrenList);
1808          childrenList.add(new Property("name", "id", "A unique name for the group for the convenience of human readers.", 0, java.lang.Integer.MAX_VALUE, name));
1809          childrenList.add(new Property("extends", "id", "Another group that this group adds rules to.", 0, java.lang.Integer.MAX_VALUE, extends_));
1810          childrenList.add(new Property("typeMode", "code", "If this is the default rule set to apply for thie source type, or this combination of types.", 0, java.lang.Integer.MAX_VALUE, typeMode));
1811          childrenList.add(new Property("documentation", "string", "Additional supporting documentation that explains the purpose of the group and the types of mappings within it.", 0, java.lang.Integer.MAX_VALUE, documentation));
1812          childrenList.add(new Property("input", "", "A name assigned to an instance of data. The instance must be provided when the mapping is invoked.", 0, java.lang.Integer.MAX_VALUE, input));
1813          childrenList.add(new Property("rule", "", "Transform Rule from source to target.", 0, java.lang.Integer.MAX_VALUE, rule));
1814        }
1815
1816      @Override
1817      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1818        switch (hash) {
1819        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
1820        case -1305664359: /*extends*/ return this.extends_ == null ? new Base[0] : new Base[] {this.extends_}; // IdType
1821        case -676524035: /*typeMode*/ return this.typeMode == null ? new Base[0] : new Base[] {this.typeMode}; // Enumeration<StructureMapGroupTypeMode>
1822        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
1823        case 100358090: /*input*/ return this.input == null ? new Base[0] : this.input.toArray(new Base[this.input.size()]); // StructureMapGroupInputComponent
1824        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // StructureMapGroupRuleComponent
1825        default: return super.getProperty(hash, name, checkValid);
1826        }
1827
1828      }
1829
1830      @Override
1831      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1832        switch (hash) {
1833        case 3373707: // name
1834          this.name = castToId(value); // IdType
1835          return value;
1836        case -1305664359: // extends
1837          this.extends_ = castToId(value); // IdType
1838          return value;
1839        case -676524035: // typeMode
1840          value = new StructureMapGroupTypeModeEnumFactory().fromType(castToCode(value));
1841          this.typeMode = (Enumeration) value; // Enumeration<StructureMapGroupTypeMode>
1842          return value;
1843        case 1587405498: // documentation
1844          this.documentation = castToString(value); // StringType
1845          return value;
1846        case 100358090: // input
1847          this.getInput().add((StructureMapGroupInputComponent) value); // StructureMapGroupInputComponent
1848          return value;
1849        case 3512060: // rule
1850          this.getRule().add((StructureMapGroupRuleComponent) value); // StructureMapGroupRuleComponent
1851          return value;
1852        default: return super.setProperty(hash, name, value);
1853        }
1854
1855      }
1856
1857      @Override
1858      public Base setProperty(String name, Base value) throws FHIRException {
1859        if (name.equals("name")) {
1860          this.name = castToId(value); // IdType
1861        } else if (name.equals("extends")) {
1862          this.extends_ = castToId(value); // IdType
1863        } else if (name.equals("typeMode")) {
1864          value = new StructureMapGroupTypeModeEnumFactory().fromType(castToCode(value));
1865          this.typeMode = (Enumeration) value; // Enumeration<StructureMapGroupTypeMode>
1866        } else if (name.equals("documentation")) {
1867          this.documentation = castToString(value); // StringType
1868        } else if (name.equals("input")) {
1869          this.getInput().add((StructureMapGroupInputComponent) value);
1870        } else if (name.equals("rule")) {
1871          this.getRule().add((StructureMapGroupRuleComponent) value);
1872        } else
1873          return super.setProperty(name, value);
1874        return value;
1875      }
1876
1877      @Override
1878      public Base makeProperty(int hash, String name) throws FHIRException {
1879        switch (hash) {
1880        case 3373707:  return getNameElement();
1881        case -1305664359:  return getExtendsElement();
1882        case -676524035:  return getTypeModeElement();
1883        case 1587405498:  return getDocumentationElement();
1884        case 100358090:  return addInput(); 
1885        case 3512060:  return addRule(); 
1886        default: return super.makeProperty(hash, name);
1887        }
1888
1889      }
1890
1891      @Override
1892      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1893        switch (hash) {
1894        case 3373707: /*name*/ return new String[] {"id"};
1895        case -1305664359: /*extends*/ return new String[] {"id"};
1896        case -676524035: /*typeMode*/ return new String[] {"code"};
1897        case 1587405498: /*documentation*/ return new String[] {"string"};
1898        case 100358090: /*input*/ return new String[] {};
1899        case 3512060: /*rule*/ return new String[] {};
1900        default: return super.getTypesForProperty(hash, name);
1901        }
1902
1903      }
1904
1905      @Override
1906      public Base addChild(String name) throws FHIRException {
1907        if (name.equals("name")) {
1908          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
1909        }
1910        else if (name.equals("extends")) {
1911          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.extends");
1912        }
1913        else if (name.equals("typeMode")) {
1914          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.typeMode");
1915        }
1916        else if (name.equals("documentation")) {
1917          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
1918        }
1919        else if (name.equals("input")) {
1920          return addInput();
1921        }
1922        else if (name.equals("rule")) {
1923          return addRule();
1924        }
1925        else
1926          return super.addChild(name);
1927      }
1928
1929      public StructureMapGroupComponent copy() {
1930        StructureMapGroupComponent dst = new StructureMapGroupComponent();
1931        copyValues(dst);
1932        dst.name = name == null ? null : name.copy();
1933        dst.extends_ = extends_ == null ? null : extends_.copy();
1934        dst.typeMode = typeMode == null ? null : typeMode.copy();
1935        dst.documentation = documentation == null ? null : documentation.copy();
1936        if (input != null) {
1937          dst.input = new ArrayList<StructureMapGroupInputComponent>();
1938          for (StructureMapGroupInputComponent i : input)
1939            dst.input.add(i.copy());
1940        };
1941        if (rule != null) {
1942          dst.rule = new ArrayList<StructureMapGroupRuleComponent>();
1943          for (StructureMapGroupRuleComponent i : rule)
1944            dst.rule.add(i.copy());
1945        };
1946        return dst;
1947      }
1948
1949      @Override
1950      public boolean equalsDeep(Base other) {
1951        if (!super.equalsDeep(other))
1952          return false;
1953        if (!(other instanceof StructureMapGroupComponent))
1954          return false;
1955        StructureMapGroupComponent o = (StructureMapGroupComponent) other;
1956        return compareDeep(name, o.name, true) && compareDeep(extends_, o.extends_, true) && compareDeep(typeMode, o.typeMode, true)
1957           && compareDeep(documentation, o.documentation, true) && compareDeep(input, o.input, true) && compareDeep(rule, o.rule, true)
1958          ;
1959      }
1960
1961      @Override
1962      public boolean equalsShallow(Base other) {
1963        if (!super.equalsShallow(other))
1964          return false;
1965        if (!(other instanceof StructureMapGroupComponent))
1966          return false;
1967        StructureMapGroupComponent o = (StructureMapGroupComponent) other;
1968        return compareValues(name, o.name, true) && compareValues(extends_, o.extends_, true) && compareValues(typeMode, o.typeMode, true)
1969           && compareValues(documentation, o.documentation, true);
1970      }
1971
1972      public boolean isEmpty() {
1973        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, extends_, typeMode
1974          , documentation, input, rule);
1975      }
1976
1977  public String fhirType() {
1978    return "StructureMap.group";
1979
1980  }
1981
1982// added from java-adornments.txt:
1983
1984  public String toString() {
1985    return StructureMapUtilities.groupToString(this);
1986  }
1987
1988
1989// end addition
1990  }
1991
1992    @Block()
1993    public static class StructureMapGroupInputComponent extends BackboneElement implements IBaseBackboneElement {
1994        /**
1995         * Name for this instance of data.
1996         */
1997        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1998        @Description(shortDefinition="Name for this instance of data", formalDefinition="Name for this instance of data." )
1999        protected IdType name;
2000
2001        /**
2002         * Type for this instance of data.
2003         */
2004        @Child(name = "type", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2005        @Description(shortDefinition="Type for this instance of data", formalDefinition="Type for this instance of data." )
2006        protected StringType type;
2007
2008        /**
2009         * Mode for this instance of data.
2010         */
2011        @Child(name = "mode", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
2012        @Description(shortDefinition="source | target", formalDefinition="Mode for this instance of data." )
2013        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-input-mode")
2014        protected Enumeration<StructureMapInputMode> mode;
2015
2016        /**
2017         * Documentation for this instance of data.
2018         */
2019        @Child(name = "documentation", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
2020        @Description(shortDefinition="Documentation for this instance of data", formalDefinition="Documentation for this instance of data." )
2021        protected StringType documentation;
2022
2023        private static final long serialVersionUID = -25050724L;
2024
2025    /**
2026     * Constructor
2027     */
2028      public StructureMapGroupInputComponent() {
2029        super();
2030      }
2031
2032    /**
2033     * Constructor
2034     */
2035      public StructureMapGroupInputComponent(IdType name, Enumeration<StructureMapInputMode> mode) {
2036        super();
2037        this.name = name;
2038        this.mode = mode;
2039      }
2040
2041        /**
2042         * @return {@link #name} (Name for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2043         */
2044        public IdType getNameElement() { 
2045          if (this.name == null)
2046            if (Configuration.errorOnAutoCreate())
2047              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.name");
2048            else if (Configuration.doAutoCreate())
2049              this.name = new IdType(); // bb
2050          return this.name;
2051        }
2052
2053        public boolean hasNameElement() { 
2054          return this.name != null && !this.name.isEmpty();
2055        }
2056
2057        public boolean hasName() { 
2058          return this.name != null && !this.name.isEmpty();
2059        }
2060
2061        /**
2062         * @param value {@link #name} (Name for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2063         */
2064        public StructureMapGroupInputComponent setNameElement(IdType value) { 
2065          this.name = value;
2066          return this;
2067        }
2068
2069        /**
2070         * @return Name for this instance of data.
2071         */
2072        public String getName() { 
2073          return this.name == null ? null : this.name.getValue();
2074        }
2075
2076        /**
2077         * @param value Name for this instance of data.
2078         */
2079        public StructureMapGroupInputComponent setName(String value) { 
2080            if (this.name == null)
2081              this.name = new IdType();
2082            this.name.setValue(value);
2083          return this;
2084        }
2085
2086        /**
2087         * @return {@link #type} (Type for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
2088         */
2089        public StringType getTypeElement() { 
2090          if (this.type == null)
2091            if (Configuration.errorOnAutoCreate())
2092              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.type");
2093            else if (Configuration.doAutoCreate())
2094              this.type = new StringType(); // bb
2095          return this.type;
2096        }
2097
2098        public boolean hasTypeElement() { 
2099          return this.type != null && !this.type.isEmpty();
2100        }
2101
2102        public boolean hasType() { 
2103          return this.type != null && !this.type.isEmpty();
2104        }
2105
2106        /**
2107         * @param value {@link #type} (Type for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
2108         */
2109        public StructureMapGroupInputComponent setTypeElement(StringType value) { 
2110          this.type = value;
2111          return this;
2112        }
2113
2114        /**
2115         * @return Type for this instance of data.
2116         */
2117        public String getType() { 
2118          return this.type == null ? null : this.type.getValue();
2119        }
2120
2121        /**
2122         * @param value Type for this instance of data.
2123         */
2124        public StructureMapGroupInputComponent setType(String value) { 
2125          if (Utilities.noString(value))
2126            this.type = null;
2127          else {
2128            if (this.type == null)
2129              this.type = new StringType();
2130            this.type.setValue(value);
2131          }
2132          return this;
2133        }
2134
2135        /**
2136         * @return {@link #mode} (Mode for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
2137         */
2138        public Enumeration<StructureMapInputMode> getModeElement() { 
2139          if (this.mode == null)
2140            if (Configuration.errorOnAutoCreate())
2141              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.mode");
2142            else if (Configuration.doAutoCreate())
2143              this.mode = new Enumeration<StructureMapInputMode>(new StructureMapInputModeEnumFactory()); // bb
2144          return this.mode;
2145        }
2146
2147        public boolean hasModeElement() { 
2148          return this.mode != null && !this.mode.isEmpty();
2149        }
2150
2151        public boolean hasMode() { 
2152          return this.mode != null && !this.mode.isEmpty();
2153        }
2154
2155        /**
2156         * @param value {@link #mode} (Mode for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
2157         */
2158        public StructureMapGroupInputComponent setModeElement(Enumeration<StructureMapInputMode> value) { 
2159          this.mode = value;
2160          return this;
2161        }
2162
2163        /**
2164         * @return Mode for this instance of data.
2165         */
2166        public StructureMapInputMode getMode() { 
2167          return this.mode == null ? null : this.mode.getValue();
2168        }
2169
2170        /**
2171         * @param value Mode for this instance of data.
2172         */
2173        public StructureMapGroupInputComponent setMode(StructureMapInputMode value) { 
2174            if (this.mode == null)
2175              this.mode = new Enumeration<StructureMapInputMode>(new StructureMapInputModeEnumFactory());
2176            this.mode.setValue(value);
2177          return this;
2178        }
2179
2180        /**
2181         * @return {@link #documentation} (Documentation for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
2182         */
2183        public StringType getDocumentationElement() { 
2184          if (this.documentation == null)
2185            if (Configuration.errorOnAutoCreate())
2186              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.documentation");
2187            else if (Configuration.doAutoCreate())
2188              this.documentation = new StringType(); // bb
2189          return this.documentation;
2190        }
2191
2192        public boolean hasDocumentationElement() { 
2193          return this.documentation != null && !this.documentation.isEmpty();
2194        }
2195
2196        public boolean hasDocumentation() { 
2197          return this.documentation != null && !this.documentation.isEmpty();
2198        }
2199
2200        /**
2201         * @param value {@link #documentation} (Documentation for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
2202         */
2203        public StructureMapGroupInputComponent setDocumentationElement(StringType value) { 
2204          this.documentation = value;
2205          return this;
2206        }
2207
2208        /**
2209         * @return Documentation for this instance of data.
2210         */
2211        public String getDocumentation() { 
2212          return this.documentation == null ? null : this.documentation.getValue();
2213        }
2214
2215        /**
2216         * @param value Documentation for this instance of data.
2217         */
2218        public StructureMapGroupInputComponent setDocumentation(String value) { 
2219          if (Utilities.noString(value))
2220            this.documentation = null;
2221          else {
2222            if (this.documentation == null)
2223              this.documentation = new StringType();
2224            this.documentation.setValue(value);
2225          }
2226          return this;
2227        }
2228
2229        protected void listChildren(List<Property> childrenList) {
2230          super.listChildren(childrenList);
2231          childrenList.add(new Property("name", "id", "Name for this instance of data.", 0, java.lang.Integer.MAX_VALUE, name));
2232          childrenList.add(new Property("type", "string", "Type for this instance of data.", 0, java.lang.Integer.MAX_VALUE, type));
2233          childrenList.add(new Property("mode", "code", "Mode for this instance of data.", 0, java.lang.Integer.MAX_VALUE, mode));
2234          childrenList.add(new Property("documentation", "string", "Documentation for this instance of data.", 0, java.lang.Integer.MAX_VALUE, documentation));
2235        }
2236
2237      @Override
2238      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2239        switch (hash) {
2240        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
2241        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // StringType
2242        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<StructureMapInputMode>
2243        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
2244        default: return super.getProperty(hash, name, checkValid);
2245        }
2246
2247      }
2248
2249      @Override
2250      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2251        switch (hash) {
2252        case 3373707: // name
2253          this.name = castToId(value); // IdType
2254          return value;
2255        case 3575610: // type
2256          this.type = castToString(value); // StringType
2257          return value;
2258        case 3357091: // mode
2259          value = new StructureMapInputModeEnumFactory().fromType(castToCode(value));
2260          this.mode = (Enumeration) value; // Enumeration<StructureMapInputMode>
2261          return value;
2262        case 1587405498: // documentation
2263          this.documentation = castToString(value); // StringType
2264          return value;
2265        default: return super.setProperty(hash, name, value);
2266        }
2267
2268      }
2269
2270      @Override
2271      public Base setProperty(String name, Base value) throws FHIRException {
2272        if (name.equals("name")) {
2273          this.name = castToId(value); // IdType
2274        } else if (name.equals("type")) {
2275          this.type = castToString(value); // StringType
2276        } else if (name.equals("mode")) {
2277          value = new StructureMapInputModeEnumFactory().fromType(castToCode(value));
2278          this.mode = (Enumeration) value; // Enumeration<StructureMapInputMode>
2279        } else if (name.equals("documentation")) {
2280          this.documentation = castToString(value); // StringType
2281        } else
2282          return super.setProperty(name, value);
2283        return value;
2284      }
2285
2286      @Override
2287      public Base makeProperty(int hash, String name) throws FHIRException {
2288        switch (hash) {
2289        case 3373707:  return getNameElement();
2290        case 3575610:  return getTypeElement();
2291        case 3357091:  return getModeElement();
2292        case 1587405498:  return getDocumentationElement();
2293        default: return super.makeProperty(hash, name);
2294        }
2295
2296      }
2297
2298      @Override
2299      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2300        switch (hash) {
2301        case 3373707: /*name*/ return new String[] {"id"};
2302        case 3575610: /*type*/ return new String[] {"string"};
2303        case 3357091: /*mode*/ return new String[] {"code"};
2304        case 1587405498: /*documentation*/ return new String[] {"string"};
2305        default: return super.getTypesForProperty(hash, name);
2306        }
2307
2308      }
2309
2310      @Override
2311      public Base addChild(String name) throws FHIRException {
2312        if (name.equals("name")) {
2313          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
2314        }
2315        else if (name.equals("type")) {
2316          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.type");
2317        }
2318        else if (name.equals("mode")) {
2319          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.mode");
2320        }
2321        else if (name.equals("documentation")) {
2322          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
2323        }
2324        else
2325          return super.addChild(name);
2326      }
2327
2328      public StructureMapGroupInputComponent copy() {
2329        StructureMapGroupInputComponent dst = new StructureMapGroupInputComponent();
2330        copyValues(dst);
2331        dst.name = name == null ? null : name.copy();
2332        dst.type = type == null ? null : type.copy();
2333        dst.mode = mode == null ? null : mode.copy();
2334        dst.documentation = documentation == null ? null : documentation.copy();
2335        return dst;
2336      }
2337
2338      @Override
2339      public boolean equalsDeep(Base other) {
2340        if (!super.equalsDeep(other))
2341          return false;
2342        if (!(other instanceof StructureMapGroupInputComponent))
2343          return false;
2344        StructureMapGroupInputComponent o = (StructureMapGroupInputComponent) other;
2345        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true) && compareDeep(mode, o.mode, true)
2346           && compareDeep(documentation, o.documentation, true);
2347      }
2348
2349      @Override
2350      public boolean equalsShallow(Base other) {
2351        if (!super.equalsShallow(other))
2352          return false;
2353        if (!(other instanceof StructureMapGroupInputComponent))
2354          return false;
2355        StructureMapGroupInputComponent o = (StructureMapGroupInputComponent) other;
2356        return compareValues(name, o.name, true) && compareValues(type, o.type, true) && compareValues(mode, o.mode, true)
2357           && compareValues(documentation, o.documentation, true);
2358      }
2359
2360      public boolean isEmpty() {
2361        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type, mode, documentation
2362          );
2363      }
2364
2365  public String fhirType() {
2366    return "StructureMap.group.input";
2367
2368  }
2369
2370  }
2371
2372    @Block()
2373    public static class StructureMapGroupRuleComponent extends BackboneElement implements IBaseBackboneElement {
2374        /**
2375         * Name of the rule for internal references.
2376         */
2377        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2378        @Description(shortDefinition="Name of the rule for internal references", formalDefinition="Name of the rule for internal references." )
2379        protected IdType name;
2380
2381        /**
2382         * Source inputs to the mapping.
2383         */
2384        @Child(name = "source", type = {}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2385        @Description(shortDefinition="Source inputs to the mapping", formalDefinition="Source inputs to the mapping." )
2386        protected List<StructureMapGroupRuleSourceComponent> source;
2387
2388        /**
2389         * Content to create because of this mapping rule.
2390         */
2391        @Child(name = "target", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2392        @Description(shortDefinition="Content to create because of this mapping rule", formalDefinition="Content to create because of this mapping rule." )
2393        protected List<StructureMapGroupRuleTargetComponent> target;
2394
2395        /**
2396         * Rules contained in this rule.
2397         */
2398        @Child(name = "rule", type = {StructureMapGroupRuleComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2399        @Description(shortDefinition="Rules contained in this rule", formalDefinition="Rules contained in this rule." )
2400        protected List<StructureMapGroupRuleComponent> rule;
2401
2402        /**
2403         * Which other rules to apply in the context of this rule.
2404         */
2405        @Child(name = "dependent", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2406        @Description(shortDefinition="Which other rules to apply in the context of this rule", formalDefinition="Which other rules to apply in the context of this rule." )
2407        protected List<StructureMapGroupRuleDependentComponent> dependent;
2408
2409        /**
2410         * Documentation for this instance of data.
2411         */
2412        @Child(name = "documentation", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
2413        @Description(shortDefinition="Documentation for this instance of data", formalDefinition="Documentation for this instance of data." )
2414        protected StringType documentation;
2415
2416        private static final long serialVersionUID = 773925517L;
2417
2418    /**
2419     * Constructor
2420     */
2421      public StructureMapGroupRuleComponent() {
2422        super();
2423      }
2424
2425    /**
2426     * Constructor
2427     */
2428      public StructureMapGroupRuleComponent(IdType name) {
2429        super();
2430        this.name = name;
2431      }
2432
2433        /**
2434         * @return {@link #name} (Name of the rule for internal references.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2435         */
2436        public IdType getNameElement() { 
2437          if (this.name == null)
2438            if (Configuration.errorOnAutoCreate())
2439              throw new Error("Attempt to auto-create StructureMapGroupRuleComponent.name");
2440            else if (Configuration.doAutoCreate())
2441              this.name = new IdType(); // bb
2442          return this.name;
2443        }
2444
2445        public boolean hasNameElement() { 
2446          return this.name != null && !this.name.isEmpty();
2447        }
2448
2449        public boolean hasName() { 
2450          return this.name != null && !this.name.isEmpty();
2451        }
2452
2453        /**
2454         * @param value {@link #name} (Name of the rule for internal references.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2455         */
2456        public StructureMapGroupRuleComponent setNameElement(IdType value) { 
2457          this.name = value;
2458          return this;
2459        }
2460
2461        /**
2462         * @return Name of the rule for internal references.
2463         */
2464        public String getName() { 
2465          return this.name == null ? null : this.name.getValue();
2466        }
2467
2468        /**
2469         * @param value Name of the rule for internal references.
2470         */
2471        public StructureMapGroupRuleComponent setName(String value) { 
2472            if (this.name == null)
2473              this.name = new IdType();
2474            this.name.setValue(value);
2475          return this;
2476        }
2477
2478        /**
2479         * @return {@link #source} (Source inputs to the mapping.)
2480         */
2481        public List<StructureMapGroupRuleSourceComponent> getSource() { 
2482          if (this.source == null)
2483            this.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2484          return this.source;
2485        }
2486
2487        /**
2488         * @return Returns a reference to <code>this</code> for easy method chaining
2489         */
2490        public StructureMapGroupRuleComponent setSource(List<StructureMapGroupRuleSourceComponent> theSource) { 
2491          this.source = theSource;
2492          return this;
2493        }
2494
2495        public boolean hasSource() { 
2496          if (this.source == null)
2497            return false;
2498          for (StructureMapGroupRuleSourceComponent item : this.source)
2499            if (!item.isEmpty())
2500              return true;
2501          return false;
2502        }
2503
2504        public StructureMapGroupRuleSourceComponent addSource() { //3
2505          StructureMapGroupRuleSourceComponent t = new StructureMapGroupRuleSourceComponent();
2506          if (this.source == null)
2507            this.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2508          this.source.add(t);
2509          return t;
2510        }
2511
2512        public StructureMapGroupRuleComponent addSource(StructureMapGroupRuleSourceComponent t) { //3
2513          if (t == null)
2514            return this;
2515          if (this.source == null)
2516            this.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2517          this.source.add(t);
2518          return this;
2519        }
2520
2521        /**
2522         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
2523         */
2524        public StructureMapGroupRuleSourceComponent getSourceFirstRep() { 
2525          if (getSource().isEmpty()) {
2526            addSource();
2527          }
2528          return getSource().get(0);
2529        }
2530
2531        /**
2532         * @return {@link #target} (Content to create because of this mapping rule.)
2533         */
2534        public List<StructureMapGroupRuleTargetComponent> getTarget() { 
2535          if (this.target == null)
2536            this.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2537          return this.target;
2538        }
2539
2540        /**
2541         * @return Returns a reference to <code>this</code> for easy method chaining
2542         */
2543        public StructureMapGroupRuleComponent setTarget(List<StructureMapGroupRuleTargetComponent> theTarget) { 
2544          this.target = theTarget;
2545          return this;
2546        }
2547
2548        public boolean hasTarget() { 
2549          if (this.target == null)
2550            return false;
2551          for (StructureMapGroupRuleTargetComponent item : this.target)
2552            if (!item.isEmpty())
2553              return true;
2554          return false;
2555        }
2556
2557        public StructureMapGroupRuleTargetComponent addTarget() { //3
2558          StructureMapGroupRuleTargetComponent t = new StructureMapGroupRuleTargetComponent();
2559          if (this.target == null)
2560            this.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2561          this.target.add(t);
2562          return t;
2563        }
2564
2565        public StructureMapGroupRuleComponent addTarget(StructureMapGroupRuleTargetComponent t) { //3
2566          if (t == null)
2567            return this;
2568          if (this.target == null)
2569            this.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2570          this.target.add(t);
2571          return this;
2572        }
2573
2574        /**
2575         * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist
2576         */
2577        public StructureMapGroupRuleTargetComponent getTargetFirstRep() { 
2578          if (getTarget().isEmpty()) {
2579            addTarget();
2580          }
2581          return getTarget().get(0);
2582        }
2583
2584        /**
2585         * @return {@link #rule} (Rules contained in this rule.)
2586         */
2587        public List<StructureMapGroupRuleComponent> getRule() { 
2588          if (this.rule == null)
2589            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
2590          return this.rule;
2591        }
2592
2593        /**
2594         * @return Returns a reference to <code>this</code> for easy method chaining
2595         */
2596        public StructureMapGroupRuleComponent setRule(List<StructureMapGroupRuleComponent> theRule) { 
2597          this.rule = theRule;
2598          return this;
2599        }
2600
2601        public boolean hasRule() { 
2602          if (this.rule == null)
2603            return false;
2604          for (StructureMapGroupRuleComponent item : this.rule)
2605            if (!item.isEmpty())
2606              return true;
2607          return false;
2608        }
2609
2610        public StructureMapGroupRuleComponent addRule() { //3
2611          StructureMapGroupRuleComponent t = new StructureMapGroupRuleComponent();
2612          if (this.rule == null)
2613            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
2614          this.rule.add(t);
2615          return t;
2616        }
2617
2618        public StructureMapGroupRuleComponent addRule(StructureMapGroupRuleComponent t) { //3
2619          if (t == null)
2620            return this;
2621          if (this.rule == null)
2622            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
2623          this.rule.add(t);
2624          return this;
2625        }
2626
2627        /**
2628         * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist
2629         */
2630        public StructureMapGroupRuleComponent getRuleFirstRep() { 
2631          if (getRule().isEmpty()) {
2632            addRule();
2633          }
2634          return getRule().get(0);
2635        }
2636
2637        /**
2638         * @return {@link #dependent} (Which other rules to apply in the context of this rule.)
2639         */
2640        public List<StructureMapGroupRuleDependentComponent> getDependent() { 
2641          if (this.dependent == null)
2642            this.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2643          return this.dependent;
2644        }
2645
2646        /**
2647         * @return Returns a reference to <code>this</code> for easy method chaining
2648         */
2649        public StructureMapGroupRuleComponent setDependent(List<StructureMapGroupRuleDependentComponent> theDependent) { 
2650          this.dependent = theDependent;
2651          return this;
2652        }
2653
2654        public boolean hasDependent() { 
2655          if (this.dependent == null)
2656            return false;
2657          for (StructureMapGroupRuleDependentComponent item : this.dependent)
2658            if (!item.isEmpty())
2659              return true;
2660          return false;
2661        }
2662
2663        public StructureMapGroupRuleDependentComponent addDependent() { //3
2664          StructureMapGroupRuleDependentComponent t = new StructureMapGroupRuleDependentComponent();
2665          if (this.dependent == null)
2666            this.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2667          this.dependent.add(t);
2668          return t;
2669        }
2670
2671        public StructureMapGroupRuleComponent addDependent(StructureMapGroupRuleDependentComponent t) { //3
2672          if (t == null)
2673            return this;
2674          if (this.dependent == null)
2675            this.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2676          this.dependent.add(t);
2677          return this;
2678        }
2679
2680        /**
2681         * @return The first repetition of repeating field {@link #dependent}, creating it if it does not already exist
2682         */
2683        public StructureMapGroupRuleDependentComponent getDependentFirstRep() { 
2684          if (getDependent().isEmpty()) {
2685            addDependent();
2686          }
2687          return getDependent().get(0);
2688        }
2689
2690        /**
2691         * @return {@link #documentation} (Documentation for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
2692         */
2693        public StringType getDocumentationElement() { 
2694          if (this.documentation == null)
2695            if (Configuration.errorOnAutoCreate())
2696              throw new Error("Attempt to auto-create StructureMapGroupRuleComponent.documentation");
2697            else if (Configuration.doAutoCreate())
2698              this.documentation = new StringType(); // bb
2699          return this.documentation;
2700        }
2701
2702        public boolean hasDocumentationElement() { 
2703          return this.documentation != null && !this.documentation.isEmpty();
2704        }
2705
2706        public boolean hasDocumentation() { 
2707          return this.documentation != null && !this.documentation.isEmpty();
2708        }
2709
2710        /**
2711         * @param value {@link #documentation} (Documentation for this instance of data.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
2712         */
2713        public StructureMapGroupRuleComponent setDocumentationElement(StringType value) { 
2714          this.documentation = value;
2715          return this;
2716        }
2717
2718        /**
2719         * @return Documentation for this instance of data.
2720         */
2721        public String getDocumentation() { 
2722          return this.documentation == null ? null : this.documentation.getValue();
2723        }
2724
2725        /**
2726         * @param value Documentation for this instance of data.
2727         */
2728        public StructureMapGroupRuleComponent setDocumentation(String value) { 
2729          if (Utilities.noString(value))
2730            this.documentation = null;
2731          else {
2732            if (this.documentation == null)
2733              this.documentation = new StringType();
2734            this.documentation.setValue(value);
2735          }
2736          return this;
2737        }
2738
2739        protected void listChildren(List<Property> childrenList) {
2740          super.listChildren(childrenList);
2741          childrenList.add(new Property("name", "id", "Name of the rule for internal references.", 0, java.lang.Integer.MAX_VALUE, name));
2742          childrenList.add(new Property("source", "", "Source inputs to the mapping.", 0, java.lang.Integer.MAX_VALUE, source));
2743          childrenList.add(new Property("target", "", "Content to create because of this mapping rule.", 0, java.lang.Integer.MAX_VALUE, target));
2744          childrenList.add(new Property("rule", "@StructureMap.group.rule", "Rules contained in this rule.", 0, java.lang.Integer.MAX_VALUE, rule));
2745          childrenList.add(new Property("dependent", "", "Which other rules to apply in the context of this rule.", 0, java.lang.Integer.MAX_VALUE, dependent));
2746          childrenList.add(new Property("documentation", "string", "Documentation for this instance of data.", 0, java.lang.Integer.MAX_VALUE, documentation));
2747        }
2748
2749      @Override
2750      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2751        switch (hash) {
2752        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
2753        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // StructureMapGroupRuleSourceComponent
2754        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // StructureMapGroupRuleTargetComponent
2755        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // StructureMapGroupRuleComponent
2756        case -1109226753: /*dependent*/ return this.dependent == null ? new Base[0] : this.dependent.toArray(new Base[this.dependent.size()]); // StructureMapGroupRuleDependentComponent
2757        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
2758        default: return super.getProperty(hash, name, checkValid);
2759        }
2760
2761      }
2762
2763      @Override
2764      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2765        switch (hash) {
2766        case 3373707: // name
2767          this.name = castToId(value); // IdType
2768          return value;
2769        case -896505829: // source
2770          this.getSource().add((StructureMapGroupRuleSourceComponent) value); // StructureMapGroupRuleSourceComponent
2771          return value;
2772        case -880905839: // target
2773          this.getTarget().add((StructureMapGroupRuleTargetComponent) value); // StructureMapGroupRuleTargetComponent
2774          return value;
2775        case 3512060: // rule
2776          this.getRule().add((StructureMapGroupRuleComponent) value); // StructureMapGroupRuleComponent
2777          return value;
2778        case -1109226753: // dependent
2779          this.getDependent().add((StructureMapGroupRuleDependentComponent) value); // StructureMapGroupRuleDependentComponent
2780          return value;
2781        case 1587405498: // documentation
2782          this.documentation = castToString(value); // StringType
2783          return value;
2784        default: return super.setProperty(hash, name, value);
2785        }
2786
2787      }
2788
2789      @Override
2790      public Base setProperty(String name, Base value) throws FHIRException {
2791        if (name.equals("name")) {
2792          this.name = castToId(value); // IdType
2793        } else if (name.equals("source")) {
2794          this.getSource().add((StructureMapGroupRuleSourceComponent) value);
2795        } else if (name.equals("target")) {
2796          this.getTarget().add((StructureMapGroupRuleTargetComponent) value);
2797        } else if (name.equals("rule")) {
2798          this.getRule().add((StructureMapGroupRuleComponent) value);
2799        } else if (name.equals("dependent")) {
2800          this.getDependent().add((StructureMapGroupRuleDependentComponent) value);
2801        } else if (name.equals("documentation")) {
2802          this.documentation = castToString(value); // StringType
2803        } else
2804          return super.setProperty(name, value);
2805        return value;
2806      }
2807
2808      @Override
2809      public Base makeProperty(int hash, String name) throws FHIRException {
2810        switch (hash) {
2811        case 3373707:  return getNameElement();
2812        case -896505829:  return addSource(); 
2813        case -880905839:  return addTarget(); 
2814        case 3512060:  return addRule(); 
2815        case -1109226753:  return addDependent(); 
2816        case 1587405498:  return getDocumentationElement();
2817        default: return super.makeProperty(hash, name);
2818        }
2819
2820      }
2821
2822      @Override
2823      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2824        switch (hash) {
2825        case 3373707: /*name*/ return new String[] {"id"};
2826        case -896505829: /*source*/ return new String[] {};
2827        case -880905839: /*target*/ return new String[] {};
2828        case 3512060: /*rule*/ return new String[] {"@StructureMap.group.rule"};
2829        case -1109226753: /*dependent*/ return new String[] {};
2830        case 1587405498: /*documentation*/ return new String[] {"string"};
2831        default: return super.getTypesForProperty(hash, name);
2832        }
2833
2834      }
2835
2836      @Override
2837      public Base addChild(String name) throws FHIRException {
2838        if (name.equals("name")) {
2839          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
2840        }
2841        else if (name.equals("source")) {
2842          return addSource();
2843        }
2844        else if (name.equals("target")) {
2845          return addTarget();
2846        }
2847        else if (name.equals("rule")) {
2848          return addRule();
2849        }
2850        else if (name.equals("dependent")) {
2851          return addDependent();
2852        }
2853        else if (name.equals("documentation")) {
2854          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
2855        }
2856        else
2857          return super.addChild(name);
2858      }
2859
2860      public StructureMapGroupRuleComponent copy() {
2861        StructureMapGroupRuleComponent dst = new StructureMapGroupRuleComponent();
2862        copyValues(dst);
2863        dst.name = name == null ? null : name.copy();
2864        if (source != null) {
2865          dst.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2866          for (StructureMapGroupRuleSourceComponent i : source)
2867            dst.source.add(i.copy());
2868        };
2869        if (target != null) {
2870          dst.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2871          for (StructureMapGroupRuleTargetComponent i : target)
2872            dst.target.add(i.copy());
2873        };
2874        if (rule != null) {
2875          dst.rule = new ArrayList<StructureMapGroupRuleComponent>();
2876          for (StructureMapGroupRuleComponent i : rule)
2877            dst.rule.add(i.copy());
2878        };
2879        if (dependent != null) {
2880          dst.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2881          for (StructureMapGroupRuleDependentComponent i : dependent)
2882            dst.dependent.add(i.copy());
2883        };
2884        dst.documentation = documentation == null ? null : documentation.copy();
2885        return dst;
2886      }
2887
2888      @Override
2889      public boolean equalsDeep(Base other) {
2890        if (!super.equalsDeep(other))
2891          return false;
2892        if (!(other instanceof StructureMapGroupRuleComponent))
2893          return false;
2894        StructureMapGroupRuleComponent o = (StructureMapGroupRuleComponent) other;
2895        return compareDeep(name, o.name, true) && compareDeep(source, o.source, true) && compareDeep(target, o.target, true)
2896           && compareDeep(rule, o.rule, true) && compareDeep(dependent, o.dependent, true) && compareDeep(documentation, o.documentation, true)
2897          ;
2898      }
2899
2900      @Override
2901      public boolean equalsShallow(Base other) {
2902        if (!super.equalsShallow(other))
2903          return false;
2904        if (!(other instanceof StructureMapGroupRuleComponent))
2905          return false;
2906        StructureMapGroupRuleComponent o = (StructureMapGroupRuleComponent) other;
2907        return compareValues(name, o.name, true) && compareValues(documentation, o.documentation, true);
2908      }
2909
2910      public boolean isEmpty() {
2911        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, source, target, rule
2912          , dependent, documentation);
2913      }
2914
2915  public String fhirType() {
2916    return "StructureMap.group.rule";
2917
2918  }
2919
2920// added from java-adornments.txt:
2921
2922  public String toString() {
2923    return StructureMapUtilities.ruleToString(this);
2924  }
2925
2926
2927// end addition
2928  }
2929
2930    @Block()
2931    public static class StructureMapGroupRuleSourceComponent extends BackboneElement implements IBaseBackboneElement {
2932        /**
2933         * Type or variable this rule applies to.
2934         */
2935        @Child(name = "context", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2936        @Description(shortDefinition="Type or variable this rule applies to", formalDefinition="Type or variable this rule applies to." )
2937        protected IdType context;
2938
2939        /**
2940         * Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.
2941         */
2942        @Child(name = "min", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2943        @Description(shortDefinition="Specified minimum cardinality", formalDefinition="Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content." )
2944        protected IntegerType min;
2945
2946        /**
2947         * Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).
2948         */
2949        @Child(name = "max", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2950        @Description(shortDefinition="Specified maximum cardinality (number or *)", formalDefinition="Specified maximum cardinality for the element - a number or a \"*\". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value)." )
2951        protected StringType max;
2952
2953        /**
2954         * Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.
2955         */
2956        @Child(name = "type", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
2957        @Description(shortDefinition="Rule only applies if source has this type", formalDefinition="Specified type for the element. This works as a condition on the mapping - use for polymorphic elements." )
2958        protected StringType type;
2959
2960        /**
2961         * A value to use if there is no existing value in the source object.
2962         */
2963        @Child(name = "defaultValue", type = {}, order=5, min=0, max=1, modifier=false, summary=true)
2964        @Description(shortDefinition="Default value if no value exists", formalDefinition="A value to use if there is no existing value in the source object." )
2965        protected org.hl7.fhir.dstu3.model.Type defaultValue;
2966
2967        /**
2968         * Optional field for this source.
2969         */
2970        @Child(name = "element", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
2971        @Description(shortDefinition="Optional field for this source", formalDefinition="Optional field for this source." )
2972        protected StringType element;
2973
2974        /**
2975         * How to handle the list mode for this element.
2976         */
2977        @Child(name = "listMode", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
2978        @Description(shortDefinition="first | not_first | last | not_last | only_one", formalDefinition="How to handle the list mode for this element." )
2979        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-source-list-mode")
2980        protected Enumeration<StructureMapSourceListMode> listMode;
2981
2982        /**
2983         * Named context for field, if a field is specified.
2984         */
2985        @Child(name = "variable", type = {IdType.class}, order=8, min=0, max=1, modifier=false, summary=true)
2986        @Description(shortDefinition="Named context for field, if a field is specified", formalDefinition="Named context for field, if a field is specified." )
2987        protected IdType variable;
2988
2989        /**
2990         * FHIRPath expression  - must be true or the rule does not apply.
2991         */
2992        @Child(name = "condition", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
2993        @Description(shortDefinition="FHIRPath expression  - must be true or the rule does not apply", formalDefinition="FHIRPath expression  - must be true or the rule does not apply." )
2994        protected StringType condition;
2995
2996        /**
2997         * FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.
2998         */
2999        @Child(name = "check", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
3000        @Description(shortDefinition="FHIRPath expression  - must be true or the mapping engine throws an error instead of completing", formalDefinition="FHIRPath expression  - must be true or the mapping engine throws an error instead of completing." )
3001        protected StringType check;
3002
3003        private static final long serialVersionUID = 1893118862L;
3004
3005    /**
3006     * Constructor
3007     */
3008      public StructureMapGroupRuleSourceComponent() {
3009        super();
3010      }
3011
3012    /**
3013     * Constructor
3014     */
3015      public StructureMapGroupRuleSourceComponent(IdType context) {
3016        super();
3017        this.context = context;
3018      }
3019
3020        /**
3021         * @return {@link #context} (Type or variable this rule applies to.). This is the underlying object with id, value and extensions. The accessor "getContext" gives direct access to the value
3022         */
3023        public IdType getContextElement() { 
3024          if (this.context == null)
3025            if (Configuration.errorOnAutoCreate())
3026              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.context");
3027            else if (Configuration.doAutoCreate())
3028              this.context = new IdType(); // bb
3029          return this.context;
3030        }
3031
3032        public boolean hasContextElement() { 
3033          return this.context != null && !this.context.isEmpty();
3034        }
3035
3036        public boolean hasContext() { 
3037          return this.context != null && !this.context.isEmpty();
3038        }
3039
3040        /**
3041         * @param value {@link #context} (Type or variable this rule applies to.). This is the underlying object with id, value and extensions. The accessor "getContext" gives direct access to the value
3042         */
3043        public StructureMapGroupRuleSourceComponent setContextElement(IdType value) { 
3044          this.context = value;
3045          return this;
3046        }
3047
3048        /**
3049         * @return Type or variable this rule applies to.
3050         */
3051        public String getContext() { 
3052          return this.context == null ? null : this.context.getValue();
3053        }
3054
3055        /**
3056         * @param value Type or variable this rule applies to.
3057         */
3058        public StructureMapGroupRuleSourceComponent setContext(String value) { 
3059            if (this.context == null)
3060              this.context = new IdType();
3061            this.context.setValue(value);
3062          return this;
3063        }
3064
3065        /**
3066         * @return {@link #min} (Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
3067         */
3068        public IntegerType getMinElement() { 
3069          if (this.min == null)
3070            if (Configuration.errorOnAutoCreate())
3071              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.min");
3072            else if (Configuration.doAutoCreate())
3073              this.min = new IntegerType(); // bb
3074          return this.min;
3075        }
3076
3077        public boolean hasMinElement() { 
3078          return this.min != null && !this.min.isEmpty();
3079        }
3080
3081        public boolean hasMin() { 
3082          return this.min != null && !this.min.isEmpty();
3083        }
3084
3085        /**
3086         * @param value {@link #min} (Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
3087         */
3088        public StructureMapGroupRuleSourceComponent setMinElement(IntegerType value) { 
3089          this.min = value;
3090          return this;
3091        }
3092
3093        /**
3094         * @return Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.
3095         */
3096        public int getMin() { 
3097          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
3098        }
3099
3100        /**
3101         * @param value Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.
3102         */
3103        public StructureMapGroupRuleSourceComponent setMin(int value) { 
3104            if (this.min == null)
3105              this.min = new IntegerType();
3106            this.min.setValue(value);
3107          return this;
3108        }
3109
3110        /**
3111         * @return {@link #max} (Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
3112         */
3113        public StringType getMaxElement() { 
3114          if (this.max == null)
3115            if (Configuration.errorOnAutoCreate())
3116              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.max");
3117            else if (Configuration.doAutoCreate())
3118              this.max = new StringType(); // bb
3119          return this.max;
3120        }
3121
3122        public boolean hasMaxElement() { 
3123          return this.max != null && !this.max.isEmpty();
3124        }
3125
3126        public boolean hasMax() { 
3127          return this.max != null && !this.max.isEmpty();
3128        }
3129
3130        /**
3131         * @param value {@link #max} (Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
3132         */
3133        public StructureMapGroupRuleSourceComponent setMaxElement(StringType value) { 
3134          this.max = value;
3135          return this;
3136        }
3137
3138        /**
3139         * @return Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).
3140         */
3141        public String getMax() { 
3142          return this.max == null ? null : this.max.getValue();
3143        }
3144
3145        /**
3146         * @param value Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).
3147         */
3148        public StructureMapGroupRuleSourceComponent setMax(String value) { 
3149          if (Utilities.noString(value))
3150            this.max = null;
3151          else {
3152            if (this.max == null)
3153              this.max = new StringType();
3154            this.max.setValue(value);
3155          }
3156          return this;
3157        }
3158
3159        /**
3160         * @return {@link #type} (Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
3161         */
3162        public StringType getTypeElement() { 
3163          if (this.type == null)
3164            if (Configuration.errorOnAutoCreate())
3165              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.type");
3166            else if (Configuration.doAutoCreate())
3167              this.type = new StringType(); // bb
3168          return this.type;
3169        }
3170
3171        public boolean hasTypeElement() { 
3172          return this.type != null && !this.type.isEmpty();
3173        }
3174
3175        public boolean hasType() { 
3176          return this.type != null && !this.type.isEmpty();
3177        }
3178
3179        /**
3180         * @param value {@link #type} (Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
3181         */
3182        public StructureMapGroupRuleSourceComponent setTypeElement(StringType value) { 
3183          this.type = value;
3184          return this;
3185        }
3186
3187        /**
3188         * @return Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.
3189         */
3190        public String getType() { 
3191          return this.type == null ? null : this.type.getValue();
3192        }
3193
3194        /**
3195         * @param value Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.
3196         */
3197        public StructureMapGroupRuleSourceComponent setType(String value) { 
3198          if (Utilities.noString(value))
3199            this.type = null;
3200          else {
3201            if (this.type == null)
3202              this.type = new StringType();
3203            this.type.setValue(value);
3204          }
3205          return this;
3206        }
3207
3208        /**
3209         * @return {@link #defaultValue} (A value to use if there is no existing value in the source object.)
3210         */
3211        public org.hl7.fhir.dstu3.model.Type getDefaultValue() { 
3212          return this.defaultValue;
3213        }
3214
3215        public boolean hasDefaultValue() { 
3216          return this.defaultValue != null && !this.defaultValue.isEmpty();
3217        }
3218
3219        /**
3220         * @param value {@link #defaultValue} (A value to use if there is no existing value in the source object.)
3221         */
3222        public StructureMapGroupRuleSourceComponent setDefaultValue(org.hl7.fhir.dstu3.model.Type value) { 
3223          this.defaultValue = value;
3224          return this;
3225        }
3226
3227        /**
3228         * @return {@link #element} (Optional field for this source.). This is the underlying object with id, value and extensions. The accessor "getElement" gives direct access to the value
3229         */
3230        public StringType getElementElement() { 
3231          if (this.element == null)
3232            if (Configuration.errorOnAutoCreate())
3233              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.element");
3234            else if (Configuration.doAutoCreate())
3235              this.element = new StringType(); // bb
3236          return this.element;
3237        }
3238
3239        public boolean hasElementElement() { 
3240          return this.element != null && !this.element.isEmpty();
3241        }
3242
3243        public boolean hasElement() { 
3244          return this.element != null && !this.element.isEmpty();
3245        }
3246
3247        /**
3248         * @param value {@link #element} (Optional field for this source.). This is the underlying object with id, value and extensions. The accessor "getElement" gives direct access to the value
3249         */
3250        public StructureMapGroupRuleSourceComponent setElementElement(StringType value) { 
3251          this.element = value;
3252          return this;
3253        }
3254
3255        /**
3256         * @return Optional field for this source.
3257         */
3258        public String getElement() { 
3259          return this.element == null ? null : this.element.getValue();
3260        }
3261
3262        /**
3263         * @param value Optional field for this source.
3264         */
3265        public StructureMapGroupRuleSourceComponent setElement(String value) { 
3266          if (Utilities.noString(value))
3267            this.element = null;
3268          else {
3269            if (this.element == null)
3270              this.element = new StringType();
3271            this.element.setValue(value);
3272          }
3273          return this;
3274        }
3275
3276        /**
3277         * @return {@link #listMode} (How to handle the list mode for this element.). This is the underlying object with id, value and extensions. The accessor "getListMode" gives direct access to the value
3278         */
3279        public Enumeration<StructureMapSourceListMode> getListModeElement() { 
3280          if (this.listMode == null)
3281            if (Configuration.errorOnAutoCreate())
3282              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.listMode");
3283            else if (Configuration.doAutoCreate())
3284              this.listMode = new Enumeration<StructureMapSourceListMode>(new StructureMapSourceListModeEnumFactory()); // bb
3285          return this.listMode;
3286        }
3287
3288        public boolean hasListModeElement() { 
3289          return this.listMode != null && !this.listMode.isEmpty();
3290        }
3291
3292        public boolean hasListMode() { 
3293          return this.listMode != null && !this.listMode.isEmpty();
3294        }
3295
3296        /**
3297         * @param value {@link #listMode} (How to handle the list mode for this element.). This is the underlying object with id, value and extensions. The accessor "getListMode" gives direct access to the value
3298         */
3299        public StructureMapGroupRuleSourceComponent setListModeElement(Enumeration<StructureMapSourceListMode> value) { 
3300          this.listMode = value;
3301          return this;
3302        }
3303
3304        /**
3305         * @return How to handle the list mode for this element.
3306         */
3307        public StructureMapSourceListMode getListMode() { 
3308          return this.listMode == null ? null : this.listMode.getValue();
3309        }
3310
3311        /**
3312         * @param value How to handle the list mode for this element.
3313         */
3314        public StructureMapGroupRuleSourceComponent setListMode(StructureMapSourceListMode value) { 
3315          if (value == null)
3316            this.listMode = null;
3317          else {
3318            if (this.listMode == null)
3319              this.listMode = new Enumeration<StructureMapSourceListMode>(new StructureMapSourceListModeEnumFactory());
3320            this.listMode.setValue(value);
3321          }
3322          return this;
3323        }
3324
3325        /**
3326         * @return {@link #variable} (Named context for field, if a field is specified.). This is the underlying object with id, value and extensions. The accessor "getVariable" gives direct access to the value
3327         */
3328        public IdType getVariableElement() { 
3329          if (this.variable == null)
3330            if (Configuration.errorOnAutoCreate())
3331              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.variable");
3332            else if (Configuration.doAutoCreate())
3333              this.variable = new IdType(); // bb
3334          return this.variable;
3335        }
3336
3337        public boolean hasVariableElement() { 
3338          return this.variable != null && !this.variable.isEmpty();
3339        }
3340
3341        public boolean hasVariable() { 
3342          return this.variable != null && !this.variable.isEmpty();
3343        }
3344
3345        /**
3346         * @param value {@link #variable} (Named context for field, if a field is specified.). This is the underlying object with id, value and extensions. The accessor "getVariable" gives direct access to the value
3347         */
3348        public StructureMapGroupRuleSourceComponent setVariableElement(IdType value) { 
3349          this.variable = value;
3350          return this;
3351        }
3352
3353        /**
3354         * @return Named context for field, if a field is specified.
3355         */
3356        public String getVariable() { 
3357          return this.variable == null ? null : this.variable.getValue();
3358        }
3359
3360        /**
3361         * @param value Named context for field, if a field is specified.
3362         */
3363        public StructureMapGroupRuleSourceComponent setVariable(String value) { 
3364          if (Utilities.noString(value))
3365            this.variable = null;
3366          else {
3367            if (this.variable == null)
3368              this.variable = new IdType();
3369            this.variable.setValue(value);
3370          }
3371          return this;
3372        }
3373
3374        /**
3375         * @return {@link #condition} (FHIRPath expression  - must be true or the rule does not apply.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
3376         */
3377        public StringType getConditionElement() { 
3378          if (this.condition == null)
3379            if (Configuration.errorOnAutoCreate())
3380              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.condition");
3381            else if (Configuration.doAutoCreate())
3382              this.condition = new StringType(); // bb
3383          return this.condition;
3384        }
3385
3386        public boolean hasConditionElement() { 
3387          return this.condition != null && !this.condition.isEmpty();
3388        }
3389
3390        public boolean hasCondition() { 
3391          return this.condition != null && !this.condition.isEmpty();
3392        }
3393
3394        /**
3395         * @param value {@link #condition} (FHIRPath expression  - must be true or the rule does not apply.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
3396         */
3397        public StructureMapGroupRuleSourceComponent setConditionElement(StringType value) { 
3398          this.condition = value;
3399          return this;
3400        }
3401
3402        /**
3403         * @return FHIRPath expression  - must be true or the rule does not apply.
3404         */
3405        public String getCondition() { 
3406          return this.condition == null ? null : this.condition.getValue();
3407        }
3408
3409        /**
3410         * @param value FHIRPath expression  - must be true or the rule does not apply.
3411         */
3412        public StructureMapGroupRuleSourceComponent setCondition(String value) { 
3413          if (Utilities.noString(value))
3414            this.condition = null;
3415          else {
3416            if (this.condition == null)
3417              this.condition = new StringType();
3418            this.condition.setValue(value);
3419          }
3420          return this;
3421        }
3422
3423        /**
3424         * @return {@link #check} (FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.). This is the underlying object with id, value and extensions. The accessor "getCheck" gives direct access to the value
3425         */
3426        public StringType getCheckElement() { 
3427          if (this.check == null)
3428            if (Configuration.errorOnAutoCreate())
3429              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.check");
3430            else if (Configuration.doAutoCreate())
3431              this.check = new StringType(); // bb
3432          return this.check;
3433        }
3434
3435        public boolean hasCheckElement() { 
3436          return this.check != null && !this.check.isEmpty();
3437        }
3438
3439        public boolean hasCheck() { 
3440          return this.check != null && !this.check.isEmpty();
3441        }
3442
3443        /**
3444         * @param value {@link #check} (FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.). This is the underlying object with id, value and extensions. The accessor "getCheck" gives direct access to the value
3445         */
3446        public StructureMapGroupRuleSourceComponent setCheckElement(StringType value) { 
3447          this.check = value;
3448          return this;
3449        }
3450
3451        /**
3452         * @return FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.
3453         */
3454        public String getCheck() { 
3455          return this.check == null ? null : this.check.getValue();
3456        }
3457
3458        /**
3459         * @param value FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.
3460         */
3461        public StructureMapGroupRuleSourceComponent setCheck(String value) { 
3462          if (Utilities.noString(value))
3463            this.check = null;
3464          else {
3465            if (this.check == null)
3466              this.check = new StringType();
3467            this.check.setValue(value);
3468          }
3469          return this;
3470        }
3471
3472        protected void listChildren(List<Property> childrenList) {
3473          super.listChildren(childrenList);
3474          childrenList.add(new Property("context", "id", "Type or variable this rule applies to.", 0, java.lang.Integer.MAX_VALUE, context));
3475          childrenList.add(new Property("min", "integer", "Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.", 0, java.lang.Integer.MAX_VALUE, min));
3476          childrenList.add(new Property("max", "string", "Specified maximum cardinality for the element - a number or a \"*\". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).", 0, java.lang.Integer.MAX_VALUE, max));
3477          childrenList.add(new Property("type", "string", "Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.", 0, java.lang.Integer.MAX_VALUE, type));
3478          childrenList.add(new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, java.lang.Integer.MAX_VALUE, defaultValue));
3479          childrenList.add(new Property("element", "string", "Optional field for this source.", 0, java.lang.Integer.MAX_VALUE, element));
3480          childrenList.add(new Property("listMode", "code", "How to handle the list mode for this element.", 0, java.lang.Integer.MAX_VALUE, listMode));
3481          childrenList.add(new Property("variable", "id", "Named context for field, if a field is specified.", 0, java.lang.Integer.MAX_VALUE, variable));
3482          childrenList.add(new Property("condition", "string", "FHIRPath expression  - must be true or the rule does not apply.", 0, java.lang.Integer.MAX_VALUE, condition));
3483          childrenList.add(new Property("check", "string", "FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.", 0, java.lang.Integer.MAX_VALUE, check));
3484        }
3485
3486      @Override
3487      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3488        switch (hash) {
3489        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // IdType
3490        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // IntegerType
3491        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
3492        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // StringType
3493        case -659125328: /*defaultValue*/ return this.defaultValue == null ? new Base[0] : new Base[] {this.defaultValue}; // org.hl7.fhir.dstu3.model.Type
3494        case -1662836996: /*element*/ return this.element == null ? new Base[0] : new Base[] {this.element}; // StringType
3495        case 1345445729: /*listMode*/ return this.listMode == null ? new Base[0] : new Base[] {this.listMode}; // Enumeration<StructureMapSourceListMode>
3496        case -1249586564: /*variable*/ return this.variable == null ? new Base[0] : new Base[] {this.variable}; // IdType
3497        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // StringType
3498        case 94627080: /*check*/ return this.check == null ? new Base[0] : new Base[] {this.check}; // StringType
3499        default: return super.getProperty(hash, name, checkValid);
3500        }
3501
3502      }
3503
3504      @Override
3505      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3506        switch (hash) {
3507        case 951530927: // context
3508          this.context = castToId(value); // IdType
3509          return value;
3510        case 108114: // min
3511          this.min = castToInteger(value); // IntegerType
3512          return value;
3513        case 107876: // max
3514          this.max = castToString(value); // StringType
3515          return value;
3516        case 3575610: // type
3517          this.type = castToString(value); // StringType
3518          return value;
3519        case -659125328: // defaultValue
3520          this.defaultValue = castToType(value); // org.hl7.fhir.dstu3.model.Type
3521          return value;
3522        case -1662836996: // element
3523          this.element = castToString(value); // StringType
3524          return value;
3525        case 1345445729: // listMode
3526          value = new StructureMapSourceListModeEnumFactory().fromType(castToCode(value));
3527          this.listMode = (Enumeration) value; // Enumeration<StructureMapSourceListMode>
3528          return value;
3529        case -1249586564: // variable
3530          this.variable = castToId(value); // IdType
3531          return value;
3532        case -861311717: // condition
3533          this.condition = castToString(value); // StringType
3534          return value;
3535        case 94627080: // check
3536          this.check = castToString(value); // StringType
3537          return value;
3538        default: return super.setProperty(hash, name, value);
3539        }
3540
3541      }
3542
3543      @Override
3544      public Base setProperty(String name, Base value) throws FHIRException {
3545        if (name.equals("context")) {
3546          this.context = castToId(value); // IdType
3547        } else if (name.equals("min")) {
3548          this.min = castToInteger(value); // IntegerType
3549        } else if (name.equals("max")) {
3550          this.max = castToString(value); // StringType
3551        } else if (name.equals("type")) {
3552          this.type = castToString(value); // StringType
3553        } else if (name.equals("defaultValue[x]")) {
3554          this.defaultValue = castToType(value); // org.hl7.fhir.dstu3.model.Type
3555        } else if (name.equals("element")) {
3556          this.element = castToString(value); // StringType
3557        } else if (name.equals("listMode")) {
3558          value = new StructureMapSourceListModeEnumFactory().fromType(castToCode(value));
3559          this.listMode = (Enumeration) value; // Enumeration<StructureMapSourceListMode>
3560        } else if (name.equals("variable")) {
3561          this.variable = castToId(value); // IdType
3562        } else if (name.equals("condition")) {
3563          this.condition = castToString(value); // StringType
3564        } else if (name.equals("check")) {
3565          this.check = castToString(value); // StringType
3566        } else
3567          return super.setProperty(name, value);
3568        return value;
3569      }
3570
3571      @Override
3572      public Base makeProperty(int hash, String name) throws FHIRException {
3573        switch (hash) {
3574        case 951530927:  return getContextElement();
3575        case 108114:  return getMinElement();
3576        case 107876:  return getMaxElement();
3577        case 3575610:  return getTypeElement();
3578        case 587922128:  return getDefaultValue(); 
3579        case -659125328:  return getDefaultValue(); 
3580        case -1662836996:  return getElementElement();
3581        case 1345445729:  return getListModeElement();
3582        case -1249586564:  return getVariableElement();
3583        case -861311717:  return getConditionElement();
3584        case 94627080:  return getCheckElement();
3585        default: return super.makeProperty(hash, name);
3586        }
3587
3588      }
3589
3590      @Override
3591      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3592        switch (hash) {
3593        case 951530927: /*context*/ return new String[] {"id"};
3594        case 108114: /*min*/ return new String[] {"integer"};
3595        case 107876: /*max*/ return new String[] {"string"};
3596        case 3575610: /*type*/ return new String[] {"string"};
3597        case -659125328: /*defaultValue*/ return new String[] {"*"};
3598        case -1662836996: /*element*/ return new String[] {"string"};
3599        case 1345445729: /*listMode*/ return new String[] {"code"};
3600        case -1249586564: /*variable*/ return new String[] {"id"};
3601        case -861311717: /*condition*/ return new String[] {"string"};
3602        case 94627080: /*check*/ return new String[] {"string"};
3603        default: return super.getTypesForProperty(hash, name);
3604        }
3605
3606      }
3607
3608      @Override
3609      public Base addChild(String name) throws FHIRException {
3610        if (name.equals("context")) {
3611          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.context");
3612        }
3613        else if (name.equals("min")) {
3614          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.min");
3615        }
3616        else if (name.equals("max")) {
3617          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.max");
3618        }
3619        else if (name.equals("type")) {
3620          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.type");
3621        }
3622        else if (name.equals("defaultValueBoolean")) {
3623          this.defaultValue = new BooleanType();
3624          return this.defaultValue;
3625        }
3626        else if (name.equals("defaultValueInteger")) {
3627          this.defaultValue = new IntegerType();
3628          return this.defaultValue;
3629        }
3630        else if (name.equals("defaultValueDecimal")) {
3631          this.defaultValue = new DecimalType();
3632          return this.defaultValue;
3633        }
3634        else if (name.equals("defaultValueBase64Binary")) {
3635          this.defaultValue = new Base64BinaryType();
3636          return this.defaultValue;
3637        }
3638        else if (name.equals("defaultValueInstant")) {
3639          this.defaultValue = new InstantType();
3640          return this.defaultValue;
3641        }
3642        else if (name.equals("defaultValueString")) {
3643          this.defaultValue = new StringType();
3644          return this.defaultValue;
3645        }
3646        else if (name.equals("defaultValueUri")) {
3647          this.defaultValue = new UriType();
3648          return this.defaultValue;
3649        }
3650        else if (name.equals("defaultValueDate")) {
3651          this.defaultValue = new DateType();
3652          return this.defaultValue;
3653        }
3654        else if (name.equals("defaultValueDateTime")) {
3655          this.defaultValue = new DateTimeType();
3656          return this.defaultValue;
3657        }
3658        else if (name.equals("defaultValueTime")) {
3659          this.defaultValue = new TimeType();
3660          return this.defaultValue;
3661        }
3662        else if (name.equals("defaultValueCode")) {
3663          this.defaultValue = new CodeType();
3664          return this.defaultValue;
3665        }
3666        else if (name.equals("defaultValueOid")) {
3667          this.defaultValue = new OidType();
3668          return this.defaultValue;
3669        }
3670        else if (name.equals("defaultValueId")) {
3671          this.defaultValue = new IdType();
3672          return this.defaultValue;
3673        }
3674        else if (name.equals("defaultValueUnsignedInt")) {
3675          this.defaultValue = new UnsignedIntType();
3676          return this.defaultValue;
3677        }
3678        else if (name.equals("defaultValuePositiveInt")) {
3679          this.defaultValue = new PositiveIntType();
3680          return this.defaultValue;
3681        }
3682        else if (name.equals("defaultValueMarkdown")) {
3683          this.defaultValue = new MarkdownType();
3684          return this.defaultValue;
3685        }
3686        else if (name.equals("defaultValueAnnotation")) {
3687          this.defaultValue = new Annotation();
3688          return this.defaultValue;
3689        }
3690        else if (name.equals("defaultValueAttachment")) {
3691          this.defaultValue = new Attachment();
3692          return this.defaultValue;
3693        }
3694        else if (name.equals("defaultValueIdentifier")) {
3695          this.defaultValue = new Identifier();
3696          return this.defaultValue;
3697        }
3698        else if (name.equals("defaultValueCodeableConcept")) {
3699          this.defaultValue = new CodeableConcept();
3700          return this.defaultValue;
3701        }
3702        else if (name.equals("defaultValueCoding")) {
3703          this.defaultValue = new Coding();
3704          return this.defaultValue;
3705        }
3706        else if (name.equals("defaultValueQuantity")) {
3707          this.defaultValue = new Quantity();
3708          return this.defaultValue;
3709        }
3710        else if (name.equals("defaultValueRange")) {
3711          this.defaultValue = new Range();
3712          return this.defaultValue;
3713        }
3714        else if (name.equals("defaultValuePeriod")) {
3715          this.defaultValue = new Period();
3716          return this.defaultValue;
3717        }
3718        else if (name.equals("defaultValueRatio")) {
3719          this.defaultValue = new Ratio();
3720          return this.defaultValue;
3721        }
3722        else if (name.equals("defaultValueSampledData")) {
3723          this.defaultValue = new SampledData();
3724          return this.defaultValue;
3725        }
3726        else if (name.equals("defaultValueSignature")) {
3727          this.defaultValue = new Signature();
3728          return this.defaultValue;
3729        }
3730        else if (name.equals("defaultValueHumanName")) {
3731          this.defaultValue = new HumanName();
3732          return this.defaultValue;
3733        }
3734        else if (name.equals("defaultValueAddress")) {
3735          this.defaultValue = new Address();
3736          return this.defaultValue;
3737        }
3738        else if (name.equals("defaultValueContactPoint")) {
3739          this.defaultValue = new ContactPoint();
3740          return this.defaultValue;
3741        }
3742        else if (name.equals("defaultValueTiming")) {
3743          this.defaultValue = new Timing();
3744          return this.defaultValue;
3745        }
3746        else if (name.equals("defaultValueReference")) {
3747          this.defaultValue = new Reference();
3748          return this.defaultValue;
3749        }
3750        else if (name.equals("defaultValueMeta")) {
3751          this.defaultValue = new Meta();
3752          return this.defaultValue;
3753        }
3754        else if (name.equals("element")) {
3755          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.element");
3756        }
3757        else if (name.equals("listMode")) {
3758          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.listMode");
3759        }
3760        else if (name.equals("variable")) {
3761          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.variable");
3762        }
3763        else if (name.equals("condition")) {
3764          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.condition");
3765        }
3766        else if (name.equals("check")) {
3767          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.check");
3768        }
3769        else
3770          return super.addChild(name);
3771      }
3772
3773      public StructureMapGroupRuleSourceComponent copy() {
3774        StructureMapGroupRuleSourceComponent dst = new StructureMapGroupRuleSourceComponent();
3775        copyValues(dst);
3776        dst.context = context == null ? null : context.copy();
3777        dst.min = min == null ? null : min.copy();
3778        dst.max = max == null ? null : max.copy();
3779        dst.type = type == null ? null : type.copy();
3780        dst.defaultValue = defaultValue == null ? null : defaultValue.copy();
3781        dst.element = element == null ? null : element.copy();
3782        dst.listMode = listMode == null ? null : listMode.copy();
3783        dst.variable = variable == null ? null : variable.copy();
3784        dst.condition = condition == null ? null : condition.copy();
3785        dst.check = check == null ? null : check.copy();
3786        return dst;
3787      }
3788
3789      @Override
3790      public boolean equalsDeep(Base other) {
3791        if (!super.equalsDeep(other))
3792          return false;
3793        if (!(other instanceof StructureMapGroupRuleSourceComponent))
3794          return false;
3795        StructureMapGroupRuleSourceComponent o = (StructureMapGroupRuleSourceComponent) other;
3796        return compareDeep(context, o.context, true) && compareDeep(min, o.min, true) && compareDeep(max, o.max, true)
3797           && compareDeep(type, o.type, true) && compareDeep(defaultValue, o.defaultValue, true) && compareDeep(element, o.element, true)
3798           && compareDeep(listMode, o.listMode, true) && compareDeep(variable, o.variable, true) && compareDeep(condition, o.condition, true)
3799           && compareDeep(check, o.check, true);
3800      }
3801
3802      @Override
3803      public boolean equalsShallow(Base other) {
3804        if (!super.equalsShallow(other))
3805          return false;
3806        if (!(other instanceof StructureMapGroupRuleSourceComponent))
3807          return false;
3808        StructureMapGroupRuleSourceComponent o = (StructureMapGroupRuleSourceComponent) other;
3809        return compareValues(context, o.context, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
3810           && compareValues(type, o.type, true) && compareValues(element, o.element, true) && compareValues(listMode, o.listMode, true)
3811           && compareValues(variable, o.variable, true) && compareValues(condition, o.condition, true) && compareValues(check, o.check, true)
3812          ;
3813      }
3814
3815      public boolean isEmpty() {
3816        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(context, min, max, type
3817          , defaultValue, element, listMode, variable, condition, check);
3818      }
3819
3820  public String fhirType() {
3821    return "StructureMap.group.rule.source";
3822
3823  }
3824
3825// added from java-adornments.txt:
3826
3827  public String toString() {
3828    return StructureMapUtilities.sourceToString(this);
3829  }
3830
3831
3832// end addition
3833  }
3834
3835    @Block()
3836    public static class StructureMapGroupRuleTargetComponent extends BackboneElement implements IBaseBackboneElement {
3837        /**
3838         * Type or variable this rule applies to.
3839         */
3840        @Child(name = "context", type = {IdType.class}, order=1, min=0, max=1, modifier=false, summary=true)
3841        @Description(shortDefinition="Type or variable this rule applies to", formalDefinition="Type or variable this rule applies to." )
3842        protected IdType context;
3843
3844        /**
3845         * How to interpret the context.
3846         */
3847        @Child(name = "contextType", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
3848        @Description(shortDefinition="type | variable", formalDefinition="How to interpret the context." )
3849        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-context-type")
3850        protected Enumeration<StructureMapContextType> contextType;
3851
3852        /**
3853         * Field to create in the context.
3854         */
3855        @Child(name = "element", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
3856        @Description(shortDefinition="Field to create in the context", formalDefinition="Field to create in the context." )
3857        protected StringType element;
3858
3859        /**
3860         * Named context for field, if desired, and a field is specified.
3861         */
3862        @Child(name = "variable", type = {IdType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3863        @Description(shortDefinition="Named context for field, if desired, and a field is specified", formalDefinition="Named context for field, if desired, and a field is specified." )
3864        protected IdType variable;
3865
3866        /**
3867         * If field is a list, how to manage the list.
3868         */
3869        @Child(name = "listMode", type = {CodeType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3870        @Description(shortDefinition="first | share | last | collate", formalDefinition="If field is a list, how to manage the list." )
3871        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-target-list-mode")
3872        protected List<Enumeration<StructureMapTargetListMode>> listMode;
3873
3874        /**
3875         * Internal rule reference for shared list items.
3876         */
3877        @Child(name = "listRuleId", type = {IdType.class}, order=6, min=0, max=1, modifier=false, summary=true)
3878        @Description(shortDefinition="Internal rule reference for shared list items", formalDefinition="Internal rule reference for shared list items." )
3879        protected IdType listRuleId;
3880
3881        /**
3882         * How the data is copied / created.
3883         */
3884        @Child(name = "transform", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
3885        @Description(shortDefinition="create | copy +", formalDefinition="How the data is copied / created." )
3886        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-transform")
3887        protected Enumeration<StructureMapTransform> transform;
3888
3889        /**
3890         * Parameters to the transform.
3891         */
3892        @Child(name = "parameter", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3893        @Description(shortDefinition="Parameters to the transform", formalDefinition="Parameters to the transform." )
3894        protected List<StructureMapGroupRuleTargetParameterComponent> parameter;
3895
3896        private static final long serialVersionUID = -1441766429L;
3897
3898    /**
3899     * Constructor
3900     */
3901      public StructureMapGroupRuleTargetComponent() {
3902        super();
3903      }
3904
3905        /**
3906         * @return {@link #context} (Type or variable this rule applies to.). This is the underlying object with id, value and extensions. The accessor "getContext" gives direct access to the value
3907         */
3908        public IdType getContextElement() { 
3909          if (this.context == null)
3910            if (Configuration.errorOnAutoCreate())
3911              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.context");
3912            else if (Configuration.doAutoCreate())
3913              this.context = new IdType(); // bb
3914          return this.context;
3915        }
3916
3917        public boolean hasContextElement() { 
3918          return this.context != null && !this.context.isEmpty();
3919        }
3920
3921        public boolean hasContext() { 
3922          return this.context != null && !this.context.isEmpty();
3923        }
3924
3925        /**
3926         * @param value {@link #context} (Type or variable this rule applies to.). This is the underlying object with id, value and extensions. The accessor "getContext" gives direct access to the value
3927         */
3928        public StructureMapGroupRuleTargetComponent setContextElement(IdType value) { 
3929          this.context = value;
3930          return this;
3931        }
3932
3933        /**
3934         * @return Type or variable this rule applies to.
3935         */
3936        public String getContext() { 
3937          return this.context == null ? null : this.context.getValue();
3938        }
3939
3940        /**
3941         * @param value Type or variable this rule applies to.
3942         */
3943        public StructureMapGroupRuleTargetComponent setContext(String value) { 
3944          if (Utilities.noString(value))
3945            this.context = null;
3946          else {
3947            if (this.context == null)
3948              this.context = new IdType();
3949            this.context.setValue(value);
3950          }
3951          return this;
3952        }
3953
3954        /**
3955         * @return {@link #contextType} (How to interpret the context.). This is the underlying object with id, value and extensions. The accessor "getContextType" gives direct access to the value
3956         */
3957        public Enumeration<StructureMapContextType> getContextTypeElement() { 
3958          if (this.contextType == null)
3959            if (Configuration.errorOnAutoCreate())
3960              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.contextType");
3961            else if (Configuration.doAutoCreate())
3962              this.contextType = new Enumeration<StructureMapContextType>(new StructureMapContextTypeEnumFactory()); // bb
3963          return this.contextType;
3964        }
3965
3966        public boolean hasContextTypeElement() { 
3967          return this.contextType != null && !this.contextType.isEmpty();
3968        }
3969
3970        public boolean hasContextType() { 
3971          return this.contextType != null && !this.contextType.isEmpty();
3972        }
3973
3974        /**
3975         * @param value {@link #contextType} (How to interpret the context.). This is the underlying object with id, value and extensions. The accessor "getContextType" gives direct access to the value
3976         */
3977        public StructureMapGroupRuleTargetComponent setContextTypeElement(Enumeration<StructureMapContextType> value) { 
3978          this.contextType = value;
3979          return this;
3980        }
3981
3982        /**
3983         * @return How to interpret the context.
3984         */
3985        public StructureMapContextType getContextType() { 
3986          return this.contextType == null ? null : this.contextType.getValue();
3987        }
3988
3989        /**
3990         * @param value How to interpret the context.
3991         */
3992        public StructureMapGroupRuleTargetComponent setContextType(StructureMapContextType value) { 
3993          if (value == null)
3994            this.contextType = null;
3995          else {
3996            if (this.contextType == null)
3997              this.contextType = new Enumeration<StructureMapContextType>(new StructureMapContextTypeEnumFactory());
3998            this.contextType.setValue(value);
3999          }
4000          return this;
4001        }
4002
4003        /**
4004         * @return {@link #element} (Field to create in the context.). This is the underlying object with id, value and extensions. The accessor "getElement" gives direct access to the value
4005         */
4006        public StringType getElementElement() { 
4007          if (this.element == null)
4008            if (Configuration.errorOnAutoCreate())
4009              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.element");
4010            else if (Configuration.doAutoCreate())
4011              this.element = new StringType(); // bb
4012          return this.element;
4013        }
4014
4015        public boolean hasElementElement() { 
4016          return this.element != null && !this.element.isEmpty();
4017        }
4018
4019        public boolean hasElement() { 
4020          return this.element != null && !this.element.isEmpty();
4021        }
4022
4023        /**
4024         * @param value {@link #element} (Field to create in the context.). This is the underlying object with id, value and extensions. The accessor "getElement" gives direct access to the value
4025         */
4026        public StructureMapGroupRuleTargetComponent setElementElement(StringType value) { 
4027          this.element = value;
4028          return this;
4029        }
4030
4031        /**
4032         * @return Field to create in the context.
4033         */
4034        public String getElement() { 
4035          return this.element == null ? null : this.element.getValue();
4036        }
4037
4038        /**
4039         * @param value Field to create in the context.
4040         */
4041        public StructureMapGroupRuleTargetComponent setElement(String value) { 
4042          if (Utilities.noString(value))
4043            this.element = null;
4044          else {
4045            if (this.element == null)
4046              this.element = new StringType();
4047            this.element.setValue(value);
4048          }
4049          return this;
4050        }
4051
4052        /**
4053         * @return {@link #variable} (Named context for field, if desired, and a field is specified.). This is the underlying object with id, value and extensions. The accessor "getVariable" gives direct access to the value
4054         */
4055        public IdType getVariableElement() { 
4056          if (this.variable == null)
4057            if (Configuration.errorOnAutoCreate())
4058              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.variable");
4059            else if (Configuration.doAutoCreate())
4060              this.variable = new IdType(); // bb
4061          return this.variable;
4062        }
4063
4064        public boolean hasVariableElement() { 
4065          return this.variable != null && !this.variable.isEmpty();
4066        }
4067
4068        public boolean hasVariable() { 
4069          return this.variable != null && !this.variable.isEmpty();
4070        }
4071
4072        /**
4073         * @param value {@link #variable} (Named context for field, if desired, and a field is specified.). This is the underlying object with id, value and extensions. The accessor "getVariable" gives direct access to the value
4074         */
4075        public StructureMapGroupRuleTargetComponent setVariableElement(IdType value) { 
4076          this.variable = value;
4077          return this;
4078        }
4079
4080        /**
4081         * @return Named context for field, if desired, and a field is specified.
4082         */
4083        public String getVariable() { 
4084          return this.variable == null ? null : this.variable.getValue();
4085        }
4086
4087        /**
4088         * @param value Named context for field, if desired, and a field is specified.
4089         */
4090        public StructureMapGroupRuleTargetComponent setVariable(String value) { 
4091          if (Utilities.noString(value))
4092            this.variable = null;
4093          else {
4094            if (this.variable == null)
4095              this.variable = new IdType();
4096            this.variable.setValue(value);
4097          }
4098          return this;
4099        }
4100
4101        /**
4102         * @return {@link #listMode} (If field is a list, how to manage the list.)
4103         */
4104        public List<Enumeration<StructureMapTargetListMode>> getListMode() { 
4105          if (this.listMode == null)
4106            this.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4107          return this.listMode;
4108        }
4109
4110        /**
4111         * @return Returns a reference to <code>this</code> for easy method chaining
4112         */
4113        public StructureMapGroupRuleTargetComponent setListMode(List<Enumeration<StructureMapTargetListMode>> theListMode) { 
4114          this.listMode = theListMode;
4115          return this;
4116        }
4117
4118        public boolean hasListMode() { 
4119          if (this.listMode == null)
4120            return false;
4121          for (Enumeration<StructureMapTargetListMode> item : this.listMode)
4122            if (!item.isEmpty())
4123              return true;
4124          return false;
4125        }
4126
4127        /**
4128         * @return {@link #listMode} (If field is a list, how to manage the list.)
4129         */
4130        public Enumeration<StructureMapTargetListMode> addListModeElement() {//2 
4131          Enumeration<StructureMapTargetListMode> t = new Enumeration<StructureMapTargetListMode>(new StructureMapTargetListModeEnumFactory());
4132          if (this.listMode == null)
4133            this.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4134          this.listMode.add(t);
4135          return t;
4136        }
4137
4138        /**
4139         * @param value {@link #listMode} (If field is a list, how to manage the list.)
4140         */
4141        public StructureMapGroupRuleTargetComponent addListMode(StructureMapTargetListMode value) { //1
4142          Enumeration<StructureMapTargetListMode> t = new Enumeration<StructureMapTargetListMode>(new StructureMapTargetListModeEnumFactory());
4143          t.setValue(value);
4144          if (this.listMode == null)
4145            this.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4146          this.listMode.add(t);
4147          return this;
4148        }
4149
4150        /**
4151         * @param value {@link #listMode} (If field is a list, how to manage the list.)
4152         */
4153        public boolean hasListMode(StructureMapTargetListMode value) { 
4154          if (this.listMode == null)
4155            return false;
4156          for (Enumeration<StructureMapTargetListMode> v : this.listMode)
4157            if (v.getValue().equals(value)) // code
4158              return true;
4159          return false;
4160        }
4161
4162        /**
4163         * @return {@link #listRuleId} (Internal rule reference for shared list items.). This is the underlying object with id, value and extensions. The accessor "getListRuleId" gives direct access to the value
4164         */
4165        public IdType getListRuleIdElement() { 
4166          if (this.listRuleId == null)
4167            if (Configuration.errorOnAutoCreate())
4168              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.listRuleId");
4169            else if (Configuration.doAutoCreate())
4170              this.listRuleId = new IdType(); // bb
4171          return this.listRuleId;
4172        }
4173
4174        public boolean hasListRuleIdElement() { 
4175          return this.listRuleId != null && !this.listRuleId.isEmpty();
4176        }
4177
4178        public boolean hasListRuleId() { 
4179          return this.listRuleId != null && !this.listRuleId.isEmpty();
4180        }
4181
4182        /**
4183         * @param value {@link #listRuleId} (Internal rule reference for shared list items.). This is the underlying object with id, value and extensions. The accessor "getListRuleId" gives direct access to the value
4184         */
4185        public StructureMapGroupRuleTargetComponent setListRuleIdElement(IdType value) { 
4186          this.listRuleId = value;
4187          return this;
4188        }
4189
4190        /**
4191         * @return Internal rule reference for shared list items.
4192         */
4193        public String getListRuleId() { 
4194          return this.listRuleId == null ? null : this.listRuleId.getValue();
4195        }
4196
4197        /**
4198         * @param value Internal rule reference for shared list items.
4199         */
4200        public StructureMapGroupRuleTargetComponent setListRuleId(String value) { 
4201          if (Utilities.noString(value))
4202            this.listRuleId = null;
4203          else {
4204            if (this.listRuleId == null)
4205              this.listRuleId = new IdType();
4206            this.listRuleId.setValue(value);
4207          }
4208          return this;
4209        }
4210
4211        /**
4212         * @return {@link #transform} (How the data is copied / created.). This is the underlying object with id, value and extensions. The accessor "getTransform" gives direct access to the value
4213         */
4214        public Enumeration<StructureMapTransform> getTransformElement() { 
4215          if (this.transform == null)
4216            if (Configuration.errorOnAutoCreate())
4217              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.transform");
4218            else if (Configuration.doAutoCreate())
4219              this.transform = new Enumeration<StructureMapTransform>(new StructureMapTransformEnumFactory()); // bb
4220          return this.transform;
4221        }
4222
4223        public boolean hasTransformElement() { 
4224          return this.transform != null && !this.transform.isEmpty();
4225        }
4226
4227        public boolean hasTransform() { 
4228          return this.transform != null && !this.transform.isEmpty();
4229        }
4230
4231        /**
4232         * @param value {@link #transform} (How the data is copied / created.). This is the underlying object with id, value and extensions. The accessor "getTransform" gives direct access to the value
4233         */
4234        public StructureMapGroupRuleTargetComponent setTransformElement(Enumeration<StructureMapTransform> value) { 
4235          this.transform = value;
4236          return this;
4237        }
4238
4239        /**
4240         * @return How the data is copied / created.
4241         */
4242        public StructureMapTransform getTransform() { 
4243          return this.transform == null ? null : this.transform.getValue();
4244        }
4245
4246        /**
4247         * @param value How the data is copied / created.
4248         */
4249        public StructureMapGroupRuleTargetComponent setTransform(StructureMapTransform value) { 
4250          if (value == null)
4251            this.transform = null;
4252          else {
4253            if (this.transform == null)
4254              this.transform = new Enumeration<StructureMapTransform>(new StructureMapTransformEnumFactory());
4255            this.transform.setValue(value);
4256          }
4257          return this;
4258        }
4259
4260        /**
4261         * @return {@link #parameter} (Parameters to the transform.)
4262         */
4263        public List<StructureMapGroupRuleTargetParameterComponent> getParameter() { 
4264          if (this.parameter == null)
4265            this.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4266          return this.parameter;
4267        }
4268
4269        /**
4270         * @return Returns a reference to <code>this</code> for easy method chaining
4271         */
4272        public StructureMapGroupRuleTargetComponent setParameter(List<StructureMapGroupRuleTargetParameterComponent> theParameter) { 
4273          this.parameter = theParameter;
4274          return this;
4275        }
4276
4277        public boolean hasParameter() { 
4278          if (this.parameter == null)
4279            return false;
4280          for (StructureMapGroupRuleTargetParameterComponent item : this.parameter)
4281            if (!item.isEmpty())
4282              return true;
4283          return false;
4284        }
4285
4286        public StructureMapGroupRuleTargetParameterComponent addParameter() { //3
4287          StructureMapGroupRuleTargetParameterComponent t = new StructureMapGroupRuleTargetParameterComponent();
4288          if (this.parameter == null)
4289            this.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4290          this.parameter.add(t);
4291          return t;
4292        }
4293
4294        public StructureMapGroupRuleTargetComponent addParameter(StructureMapGroupRuleTargetParameterComponent t) { //3
4295          if (t == null)
4296            return this;
4297          if (this.parameter == null)
4298            this.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4299          this.parameter.add(t);
4300          return this;
4301        }
4302
4303        /**
4304         * @return The first repetition of repeating field {@link #parameter}, creating it if it does not already exist
4305         */
4306        public StructureMapGroupRuleTargetParameterComponent getParameterFirstRep() { 
4307          if (getParameter().isEmpty()) {
4308            addParameter();
4309          }
4310          return getParameter().get(0);
4311        }
4312
4313        protected void listChildren(List<Property> childrenList) {
4314          super.listChildren(childrenList);
4315          childrenList.add(new Property("context", "id", "Type or variable this rule applies to.", 0, java.lang.Integer.MAX_VALUE, context));
4316          childrenList.add(new Property("contextType", "code", "How to interpret the context.", 0, java.lang.Integer.MAX_VALUE, contextType));
4317          childrenList.add(new Property("element", "string", "Field to create in the context.", 0, java.lang.Integer.MAX_VALUE, element));
4318          childrenList.add(new Property("variable", "id", "Named context for field, if desired, and a field is specified.", 0, java.lang.Integer.MAX_VALUE, variable));
4319          childrenList.add(new Property("listMode", "code", "If field is a list, how to manage the list.", 0, java.lang.Integer.MAX_VALUE, listMode));
4320          childrenList.add(new Property("listRuleId", "id", "Internal rule reference for shared list items.", 0, java.lang.Integer.MAX_VALUE, listRuleId));
4321          childrenList.add(new Property("transform", "code", "How the data is copied / created.", 0, java.lang.Integer.MAX_VALUE, transform));
4322          childrenList.add(new Property("parameter", "", "Parameters to the transform.", 0, java.lang.Integer.MAX_VALUE, parameter));
4323        }
4324
4325      @Override
4326      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4327        switch (hash) {
4328        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // IdType
4329        case -102839927: /*contextType*/ return this.contextType == null ? new Base[0] : new Base[] {this.contextType}; // Enumeration<StructureMapContextType>
4330        case -1662836996: /*element*/ return this.element == null ? new Base[0] : new Base[] {this.element}; // StringType
4331        case -1249586564: /*variable*/ return this.variable == null ? new Base[0] : new Base[] {this.variable}; // IdType
4332        case 1345445729: /*listMode*/ return this.listMode == null ? new Base[0] : this.listMode.toArray(new Base[this.listMode.size()]); // Enumeration<StructureMapTargetListMode>
4333        case 337117045: /*listRuleId*/ return this.listRuleId == null ? new Base[0] : new Base[] {this.listRuleId}; // IdType
4334        case 1052666732: /*transform*/ return this.transform == null ? new Base[0] : new Base[] {this.transform}; // Enumeration<StructureMapTransform>
4335        case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // StructureMapGroupRuleTargetParameterComponent
4336        default: return super.getProperty(hash, name, checkValid);
4337        }
4338
4339      }
4340
4341      @Override
4342      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4343        switch (hash) {
4344        case 951530927: // context
4345          this.context = castToId(value); // IdType
4346          return value;
4347        case -102839927: // contextType
4348          value = new StructureMapContextTypeEnumFactory().fromType(castToCode(value));
4349          this.contextType = (Enumeration) value; // Enumeration<StructureMapContextType>
4350          return value;
4351        case -1662836996: // element
4352          this.element = castToString(value); // StringType
4353          return value;
4354        case -1249586564: // variable
4355          this.variable = castToId(value); // IdType
4356          return value;
4357        case 1345445729: // listMode
4358          value = new StructureMapTargetListModeEnumFactory().fromType(castToCode(value));
4359          this.getListMode().add((Enumeration) value); // Enumeration<StructureMapTargetListMode>
4360          return value;
4361        case 337117045: // listRuleId
4362          this.listRuleId = castToId(value); // IdType
4363          return value;
4364        case 1052666732: // transform
4365          value = new StructureMapTransformEnumFactory().fromType(castToCode(value));
4366          this.transform = (Enumeration) value; // Enumeration<StructureMapTransform>
4367          return value;
4368        case 1954460585: // parameter
4369          this.getParameter().add((StructureMapGroupRuleTargetParameterComponent) value); // StructureMapGroupRuleTargetParameterComponent
4370          return value;
4371        default: return super.setProperty(hash, name, value);
4372        }
4373
4374      }
4375
4376      @Override
4377      public Base setProperty(String name, Base value) throws FHIRException {
4378        if (name.equals("context")) {
4379          this.context = castToId(value); // IdType
4380        } else if (name.equals("contextType")) {
4381          value = new StructureMapContextTypeEnumFactory().fromType(castToCode(value));
4382          this.contextType = (Enumeration) value; // Enumeration<StructureMapContextType>
4383        } else if (name.equals("element")) {
4384          this.element = castToString(value); // StringType
4385        } else if (name.equals("variable")) {
4386          this.variable = castToId(value); // IdType
4387        } else if (name.equals("listMode")) {
4388          value = new StructureMapTargetListModeEnumFactory().fromType(castToCode(value));
4389          this.getListMode().add((Enumeration) value);
4390        } else if (name.equals("listRuleId")) {
4391          this.listRuleId = castToId(value); // IdType
4392        } else if (name.equals("transform")) {
4393          value = new StructureMapTransformEnumFactory().fromType(castToCode(value));
4394          this.transform = (Enumeration) value; // Enumeration<StructureMapTransform>
4395        } else if (name.equals("parameter")) {
4396          this.getParameter().add((StructureMapGroupRuleTargetParameterComponent) value);
4397        } else
4398          return super.setProperty(name, value);
4399        return value;
4400      }
4401
4402      @Override
4403      public Base makeProperty(int hash, String name) throws FHIRException {
4404        switch (hash) {
4405        case 951530927:  return getContextElement();
4406        case -102839927:  return getContextTypeElement();
4407        case -1662836996:  return getElementElement();
4408        case -1249586564:  return getVariableElement();
4409        case 1345445729:  return addListModeElement();
4410        case 337117045:  return getListRuleIdElement();
4411        case 1052666732:  return getTransformElement();
4412        case 1954460585:  return addParameter(); 
4413        default: return super.makeProperty(hash, name);
4414        }
4415
4416      }
4417
4418      @Override
4419      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4420        switch (hash) {
4421        case 951530927: /*context*/ return new String[] {"id"};
4422        case -102839927: /*contextType*/ return new String[] {"code"};
4423        case -1662836996: /*element*/ return new String[] {"string"};
4424        case -1249586564: /*variable*/ return new String[] {"id"};
4425        case 1345445729: /*listMode*/ return new String[] {"code"};
4426        case 337117045: /*listRuleId*/ return new String[] {"id"};
4427        case 1052666732: /*transform*/ return new String[] {"code"};
4428        case 1954460585: /*parameter*/ return new String[] {};
4429        default: return super.getTypesForProperty(hash, name);
4430        }
4431
4432      }
4433
4434      @Override
4435      public Base addChild(String name) throws FHIRException {
4436        if (name.equals("context")) {
4437          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.context");
4438        }
4439        else if (name.equals("contextType")) {
4440          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.contextType");
4441        }
4442        else if (name.equals("element")) {
4443          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.element");
4444        }
4445        else if (name.equals("variable")) {
4446          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.variable");
4447        }
4448        else if (name.equals("listMode")) {
4449          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.listMode");
4450        }
4451        else if (name.equals("listRuleId")) {
4452          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.listRuleId");
4453        }
4454        else if (name.equals("transform")) {
4455          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.transform");
4456        }
4457        else if (name.equals("parameter")) {
4458          return addParameter();
4459        }
4460        else
4461          return super.addChild(name);
4462      }
4463
4464      public StructureMapGroupRuleTargetComponent copy() {
4465        StructureMapGroupRuleTargetComponent dst = new StructureMapGroupRuleTargetComponent();
4466        copyValues(dst);
4467        dst.context = context == null ? null : context.copy();
4468        dst.contextType = contextType == null ? null : contextType.copy();
4469        dst.element = element == null ? null : element.copy();
4470        dst.variable = variable == null ? null : variable.copy();
4471        if (listMode != null) {
4472          dst.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4473          for (Enumeration<StructureMapTargetListMode> i : listMode)
4474            dst.listMode.add(i.copy());
4475        };
4476        dst.listRuleId = listRuleId == null ? null : listRuleId.copy();
4477        dst.transform = transform == null ? null : transform.copy();
4478        if (parameter != null) {
4479          dst.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4480          for (StructureMapGroupRuleTargetParameterComponent i : parameter)
4481            dst.parameter.add(i.copy());
4482        };
4483        return dst;
4484      }
4485
4486      @Override
4487      public boolean equalsDeep(Base other) {
4488        if (!super.equalsDeep(other))
4489          return false;
4490        if (!(other instanceof StructureMapGroupRuleTargetComponent))
4491          return false;
4492        StructureMapGroupRuleTargetComponent o = (StructureMapGroupRuleTargetComponent) other;
4493        return compareDeep(context, o.context, true) && compareDeep(contextType, o.contextType, true) && compareDeep(element, o.element, true)
4494           && compareDeep(variable, o.variable, true) && compareDeep(listMode, o.listMode, true) && compareDeep(listRuleId, o.listRuleId, true)
4495           && compareDeep(transform, o.transform, true) && compareDeep(parameter, o.parameter, true);
4496      }
4497
4498      @Override
4499      public boolean equalsShallow(Base other) {
4500        if (!super.equalsShallow(other))
4501          return false;
4502        if (!(other instanceof StructureMapGroupRuleTargetComponent))
4503          return false;
4504        StructureMapGroupRuleTargetComponent o = (StructureMapGroupRuleTargetComponent) other;
4505        return compareValues(context, o.context, true) && compareValues(contextType, o.contextType, true) && compareValues(element, o.element, true)
4506           && compareValues(variable, o.variable, true) && compareValues(listMode, o.listMode, true) && compareValues(listRuleId, o.listRuleId, true)
4507           && compareValues(transform, o.transform, true);
4508      }
4509
4510      public boolean isEmpty() {
4511        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(context, contextType, element
4512          , variable, listMode, listRuleId, transform, parameter);
4513      }
4514
4515  public String fhirType() {
4516    return "StructureMap.group.rule.target";
4517
4518  }
4519
4520// added from java-adornments.txt:
4521
4522  public String toString() {
4523    return StructureMapUtilities.targetToString(this);
4524  }
4525
4526
4527// end addition
4528  }
4529
4530    @Block()
4531    public static class StructureMapGroupRuleTargetParameterComponent extends BackboneElement implements IBaseBackboneElement {
4532        /**
4533         * Parameter value - variable or literal.
4534         */
4535        @Child(name = "value", type = {IdType.class, StringType.class, BooleanType.class, IntegerType.class, DecimalType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4536        @Description(shortDefinition="Parameter value - variable or literal", formalDefinition="Parameter value - variable or literal." )
4537        protected Type value;
4538
4539        private static final long serialVersionUID = -732981989L;
4540
4541    /**
4542     * Constructor
4543     */
4544      public StructureMapGroupRuleTargetParameterComponent() {
4545        super();
4546      }
4547
4548    /**
4549     * Constructor
4550     */
4551      public StructureMapGroupRuleTargetParameterComponent(Type value) {
4552        super();
4553        this.value = value;
4554      }
4555
4556        /**
4557         * @return {@link #value} (Parameter value - variable or literal.)
4558         */
4559        public Type getValue() { 
4560          return this.value;
4561        }
4562
4563        /**
4564         * @return {@link #value} (Parameter value - variable or literal.)
4565         */
4566        public IdType getValueIdType() throws FHIRException { 
4567          if (!(this.value instanceof IdType))
4568            throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.value.getClass().getName()+" was encountered");
4569          return (IdType) this.value;
4570        }
4571
4572        public boolean hasValueIdType() { 
4573          return this.value instanceof IdType;
4574        }
4575
4576        /**
4577         * @return {@link #value} (Parameter value - variable or literal.)
4578         */
4579        public StringType getValueStringType() throws FHIRException { 
4580          if (!(this.value instanceof StringType))
4581            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
4582          return (StringType) this.value;
4583        }
4584
4585        public boolean hasValueStringType() { 
4586          return this.value instanceof StringType;
4587        }
4588
4589        /**
4590         * @return {@link #value} (Parameter value - variable or literal.)
4591         */
4592        public BooleanType getValueBooleanType() throws FHIRException { 
4593          if (!(this.value instanceof BooleanType))
4594            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
4595          return (BooleanType) this.value;
4596        }
4597
4598        public boolean hasValueBooleanType() { 
4599          return this.value instanceof BooleanType;
4600        }
4601
4602        /**
4603         * @return {@link #value} (Parameter value - variable or literal.)
4604         */
4605        public IntegerType getValueIntegerType() throws FHIRException { 
4606          if (!(this.value instanceof IntegerType))
4607            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
4608          return (IntegerType) this.value;
4609        }
4610
4611        public boolean hasValueIntegerType() { 
4612          return this.value instanceof IntegerType;
4613        }
4614
4615        /**
4616         * @return {@link #value} (Parameter value - variable or literal.)
4617         */
4618        public DecimalType getValueDecimalType() throws FHIRException { 
4619          if (!(this.value instanceof DecimalType))
4620            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
4621          return (DecimalType) this.value;
4622        }
4623
4624        public boolean hasValueDecimalType() { 
4625          return this.value instanceof DecimalType;
4626        }
4627
4628        public boolean hasValue() { 
4629          return this.value != null && !this.value.isEmpty();
4630        }
4631
4632        /**
4633         * @param value {@link #value} (Parameter value - variable or literal.)
4634         */
4635        public StructureMapGroupRuleTargetParameterComponent setValue(Type value) { 
4636          this.value = value;
4637          return this;
4638        }
4639
4640        protected void listChildren(List<Property> childrenList) {
4641          super.listChildren(childrenList);
4642          childrenList.add(new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, java.lang.Integer.MAX_VALUE, value));
4643        }
4644
4645      @Override
4646      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4647        switch (hash) {
4648        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
4649        default: return super.getProperty(hash, name, checkValid);
4650        }
4651
4652      }
4653
4654      @Override
4655      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4656        switch (hash) {
4657        case 111972721: // value
4658          this.value = castToType(value); // Type
4659          return value;
4660        default: return super.setProperty(hash, name, value);
4661        }
4662
4663      }
4664
4665      @Override
4666      public Base setProperty(String name, Base value) throws FHIRException {
4667        if (name.equals("value[x]")) {
4668          this.value = castToType(value); // Type
4669        } else
4670          return super.setProperty(name, value);
4671        return value;
4672      }
4673
4674      @Override
4675      public Base makeProperty(int hash, String name) throws FHIRException {
4676        switch (hash) {
4677        case -1410166417:  return getValue(); 
4678        case 111972721:  return getValue(); 
4679        default: return super.makeProperty(hash, name);
4680        }
4681
4682      }
4683
4684      @Override
4685      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4686        switch (hash) {
4687        case 111972721: /*value*/ return new String[] {"id", "string", "boolean", "integer", "decimal"};
4688        default: return super.getTypesForProperty(hash, name);
4689        }
4690
4691      }
4692
4693      @Override
4694      public Base addChild(String name) throws FHIRException {
4695        if (name.equals("valueId")) {
4696          this.value = new IdType();
4697          return this.value;
4698        }
4699        else if (name.equals("valueString")) {
4700          this.value = new StringType();
4701          return this.value;
4702        }
4703        else if (name.equals("valueBoolean")) {
4704          this.value = new BooleanType();
4705          return this.value;
4706        }
4707        else if (name.equals("valueInteger")) {
4708          this.value = new IntegerType();
4709          return this.value;
4710        }
4711        else if (name.equals("valueDecimal")) {
4712          this.value = new DecimalType();
4713          return this.value;
4714        }
4715        else
4716          return super.addChild(name);
4717      }
4718
4719      public StructureMapGroupRuleTargetParameterComponent copy() {
4720        StructureMapGroupRuleTargetParameterComponent dst = new StructureMapGroupRuleTargetParameterComponent();
4721        copyValues(dst);
4722        dst.value = value == null ? null : value.copy();
4723        return dst;
4724      }
4725
4726      @Override
4727      public boolean equalsDeep(Base other) {
4728        if (!super.equalsDeep(other))
4729          return false;
4730        if (!(other instanceof StructureMapGroupRuleTargetParameterComponent))
4731          return false;
4732        StructureMapGroupRuleTargetParameterComponent o = (StructureMapGroupRuleTargetParameterComponent) other;
4733        return compareDeep(value, o.value, true);
4734      }
4735
4736      @Override
4737      public boolean equalsShallow(Base other) {
4738        if (!super.equalsShallow(other))
4739          return false;
4740        if (!(other instanceof StructureMapGroupRuleTargetParameterComponent))
4741          return false;
4742        StructureMapGroupRuleTargetParameterComponent o = (StructureMapGroupRuleTargetParameterComponent) other;
4743        return true;
4744      }
4745
4746      public boolean isEmpty() {
4747        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
4748      }
4749
4750  public String fhirType() {
4751    return "StructureMap.group.rule.target.parameter";
4752
4753  }
4754
4755// added from java-adornments.txt:
4756
4757      public String toString() {
4758        return value == null ? "null!" : value.toString();
4759      }
4760
4761
4762
4763// end addition
4764  }
4765
4766    @Block()
4767    public static class StructureMapGroupRuleDependentComponent extends BackboneElement implements IBaseBackboneElement {
4768        /**
4769         * Name of a rule or group to apply.
4770         */
4771        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4772        @Description(shortDefinition="Name of a rule or group to apply", formalDefinition="Name of a rule or group to apply." )
4773        protected IdType name;
4774
4775        /**
4776         * Variable to pass to the rule or group.
4777         */
4778        @Child(name = "variable", type = {StringType.class}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4779        @Description(shortDefinition="Variable to pass to the rule or group", formalDefinition="Variable to pass to the rule or group." )
4780        protected List<StringType> variable;
4781
4782        private static final long serialVersionUID = 1021661591L;
4783
4784    /**
4785     * Constructor
4786     */
4787      public StructureMapGroupRuleDependentComponent() {
4788        super();
4789      }
4790
4791    /**
4792     * Constructor
4793     */
4794      public StructureMapGroupRuleDependentComponent(IdType name) {
4795        super();
4796        this.name = name;
4797      }
4798
4799        /**
4800         * @return {@link #name} (Name of a rule or group to apply.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
4801         */
4802        public IdType getNameElement() { 
4803          if (this.name == null)
4804            if (Configuration.errorOnAutoCreate())
4805              throw new Error("Attempt to auto-create StructureMapGroupRuleDependentComponent.name");
4806            else if (Configuration.doAutoCreate())
4807              this.name = new IdType(); // bb
4808          return this.name;
4809        }
4810
4811        public boolean hasNameElement() { 
4812          return this.name != null && !this.name.isEmpty();
4813        }
4814
4815        public boolean hasName() { 
4816          return this.name != null && !this.name.isEmpty();
4817        }
4818
4819        /**
4820         * @param value {@link #name} (Name of a rule or group to apply.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
4821         */
4822        public StructureMapGroupRuleDependentComponent setNameElement(IdType value) { 
4823          this.name = value;
4824          return this;
4825        }
4826
4827        /**
4828         * @return Name of a rule or group to apply.
4829         */
4830        public String getName() { 
4831          return this.name == null ? null : this.name.getValue();
4832        }
4833
4834        /**
4835         * @param value Name of a rule or group to apply.
4836         */
4837        public StructureMapGroupRuleDependentComponent setName(String value) { 
4838            if (this.name == null)
4839              this.name = new IdType();
4840            this.name.setValue(value);
4841          return this;
4842        }
4843
4844        /**
4845         * @return {@link #variable} (Variable to pass to the rule or group.)
4846         */
4847        public List<StringType> getVariable() { 
4848          if (this.variable == null)
4849            this.variable = new ArrayList<StringType>();
4850          return this.variable;
4851        }
4852
4853        /**
4854         * @return Returns a reference to <code>this</code> for easy method chaining
4855         */
4856        public StructureMapGroupRuleDependentComponent setVariable(List<StringType> theVariable) { 
4857          this.variable = theVariable;
4858          return this;
4859        }
4860
4861        public boolean hasVariable() { 
4862          if (this.variable == null)
4863            return false;
4864          for (StringType item : this.variable)
4865            if (!item.isEmpty())
4866              return true;
4867          return false;
4868        }
4869
4870        /**
4871         * @return {@link #variable} (Variable to pass to the rule or group.)
4872         */
4873        public StringType addVariableElement() {//2 
4874          StringType t = new StringType();
4875          if (this.variable == null)
4876            this.variable = new ArrayList<StringType>();
4877          this.variable.add(t);
4878          return t;
4879        }
4880
4881        /**
4882         * @param value {@link #variable} (Variable to pass to the rule or group.)
4883         */
4884        public StructureMapGroupRuleDependentComponent addVariable(String value) { //1
4885          StringType t = new StringType();
4886          t.setValue(value);
4887          if (this.variable == null)
4888            this.variable = new ArrayList<StringType>();
4889          this.variable.add(t);
4890          return this;
4891        }
4892
4893        /**
4894         * @param value {@link #variable} (Variable to pass to the rule or group.)
4895         */
4896        public boolean hasVariable(String value) { 
4897          if (this.variable == null)
4898            return false;
4899          for (StringType v : this.variable)
4900            if (v.equals(value)) // string
4901              return true;
4902          return false;
4903        }
4904
4905        protected void listChildren(List<Property> childrenList) {
4906          super.listChildren(childrenList);
4907          childrenList.add(new Property("name", "id", "Name of a rule or group to apply.", 0, java.lang.Integer.MAX_VALUE, name));
4908          childrenList.add(new Property("variable", "string", "Variable to pass to the rule or group.", 0, java.lang.Integer.MAX_VALUE, variable));
4909        }
4910
4911      @Override
4912      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4913        switch (hash) {
4914        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
4915        case -1249586564: /*variable*/ return this.variable == null ? new Base[0] : this.variable.toArray(new Base[this.variable.size()]); // StringType
4916        default: return super.getProperty(hash, name, checkValid);
4917        }
4918
4919      }
4920
4921      @Override
4922      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4923        switch (hash) {
4924        case 3373707: // name
4925          this.name = castToId(value); // IdType
4926          return value;
4927        case -1249586564: // variable
4928          this.getVariable().add(castToString(value)); // StringType
4929          return value;
4930        default: return super.setProperty(hash, name, value);
4931        }
4932
4933      }
4934
4935      @Override
4936      public Base setProperty(String name, Base value) throws FHIRException {
4937        if (name.equals("name")) {
4938          this.name = castToId(value); // IdType
4939        } else if (name.equals("variable")) {
4940          this.getVariable().add(castToString(value));
4941        } else
4942          return super.setProperty(name, value);
4943        return value;
4944      }
4945
4946      @Override
4947      public Base makeProperty(int hash, String name) throws FHIRException {
4948        switch (hash) {
4949        case 3373707:  return getNameElement();
4950        case -1249586564:  return addVariableElement();
4951        default: return super.makeProperty(hash, name);
4952        }
4953
4954      }
4955
4956      @Override
4957      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4958        switch (hash) {
4959        case 3373707: /*name*/ return new String[] {"id"};
4960        case -1249586564: /*variable*/ return new String[] {"string"};
4961        default: return super.getTypesForProperty(hash, name);
4962        }
4963
4964      }
4965
4966      @Override
4967      public Base addChild(String name) throws FHIRException {
4968        if (name.equals("name")) {
4969          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
4970        }
4971        else if (name.equals("variable")) {
4972          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.variable");
4973        }
4974        else
4975          return super.addChild(name);
4976      }
4977
4978      public StructureMapGroupRuleDependentComponent copy() {
4979        StructureMapGroupRuleDependentComponent dst = new StructureMapGroupRuleDependentComponent();
4980        copyValues(dst);
4981        dst.name = name == null ? null : name.copy();
4982        if (variable != null) {
4983          dst.variable = new ArrayList<StringType>();
4984          for (StringType i : variable)
4985            dst.variable.add(i.copy());
4986        };
4987        return dst;
4988      }
4989
4990      @Override
4991      public boolean equalsDeep(Base other) {
4992        if (!super.equalsDeep(other))
4993          return false;
4994        if (!(other instanceof StructureMapGroupRuleDependentComponent))
4995          return false;
4996        StructureMapGroupRuleDependentComponent o = (StructureMapGroupRuleDependentComponent) other;
4997        return compareDeep(name, o.name, true) && compareDeep(variable, o.variable, true);
4998      }
4999
5000      @Override
5001      public boolean equalsShallow(Base other) {
5002        if (!super.equalsShallow(other))
5003          return false;
5004        if (!(other instanceof StructureMapGroupRuleDependentComponent))
5005          return false;
5006        StructureMapGroupRuleDependentComponent o = (StructureMapGroupRuleDependentComponent) other;
5007        return compareValues(name, o.name, true) && compareValues(variable, o.variable, true);
5008      }
5009
5010      public boolean isEmpty() {
5011        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, variable);
5012      }
5013
5014  public String fhirType() {
5015    return "StructureMap.group.rule.dependent";
5016
5017  }
5018
5019  }
5020
5021    /**
5022     * A formal identifier that is used to identify this structure map when it is represented in other formats, or referenced in a specification, model, design or an instance.
5023     */
5024    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5025    @Description(shortDefinition="Additional identifier for the structure map", formalDefinition="A formal identifier that is used to identify this structure map when it is represented in other formats, or referenced in a specification, model, design or an instance." )
5026    protected List<Identifier> identifier;
5027
5028    /**
5029     * Explaination of why this structure map is needed and why it has been designed as it has.
5030     */
5031    @Child(name = "purpose", type = {MarkdownType.class}, order=1, min=0, max=1, modifier=false, summary=false)
5032    @Description(shortDefinition="Why this structure map is defined", formalDefinition="Explaination of why this structure map is needed and why it has been designed as it has." )
5033    protected MarkdownType purpose;
5034
5035    /**
5036     * A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.
5037     */
5038    @Child(name = "copyright", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
5039    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map." )
5040    protected MarkdownType copyright;
5041
5042    /**
5043     * A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced.
5044     */
5045    @Child(name = "structure", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5046    @Description(shortDefinition="Structure Definition used by this map", formalDefinition="A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced." )
5047    protected List<StructureMapStructureComponent> structure;
5048
5049    /**
5050     * Other maps used by this map (canonical URLs).
5051     */
5052    @Child(name = "import", type = {UriType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5053    @Description(shortDefinition="Other maps used by this map (canonical URLs)", formalDefinition="Other maps used by this map (canonical URLs)." )
5054    protected List<UriType> import_;
5055
5056    /**
5057     * Organizes the mapping into managable chunks for human review/ease of maintenance.
5058     */
5059    @Child(name = "group", type = {}, order=5, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5060    @Description(shortDefinition="Named sections for reader convenience", formalDefinition="Organizes the mapping into managable chunks for human review/ease of maintenance." )
5061    protected List<StructureMapGroupComponent> group;
5062
5063    private static final long serialVersionUID = 952506557L;
5064
5065  /**
5066   * Constructor
5067   */
5068    public StructureMap() {
5069      super();
5070    }
5071
5072  /**
5073   * Constructor
5074   */
5075    public StructureMap(UriType url, StringType name, Enumeration<PublicationStatus> status) {
5076      super();
5077      this.url = url;
5078      this.name = name;
5079      this.status = status;
5080    }
5081
5082    /**
5083     * @return {@link #url} (An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure map is (or will be) published. The URL SHOULD include the major version of the structure map. For more information see [Technical and Business Versions](resource.html#versions).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
5084     */
5085    public UriType getUrlElement() { 
5086      if (this.url == null)
5087        if (Configuration.errorOnAutoCreate())
5088          throw new Error("Attempt to auto-create StructureMap.url");
5089        else if (Configuration.doAutoCreate())
5090          this.url = new UriType(); // bb
5091      return this.url;
5092    }
5093
5094    public boolean hasUrlElement() { 
5095      return this.url != null && !this.url.isEmpty();
5096    }
5097
5098    public boolean hasUrl() { 
5099      return this.url != null && !this.url.isEmpty();
5100    }
5101
5102    /**
5103     * @param value {@link #url} (An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure map is (or will be) published. The URL SHOULD include the major version of the structure map. For more information see [Technical and Business Versions](resource.html#versions).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
5104     */
5105    public StructureMap setUrlElement(UriType value) { 
5106      this.url = value;
5107      return this;
5108    }
5109
5110    /**
5111     * @return An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure map is (or will be) published. The URL SHOULD include the major version of the structure map. For more information see [Technical and Business Versions](resource.html#versions).
5112     */
5113    public String getUrl() { 
5114      return this.url == null ? null : this.url.getValue();
5115    }
5116
5117    /**
5118     * @param value An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure map is (or will be) published. The URL SHOULD include the major version of the structure map. For more information see [Technical and Business Versions](resource.html#versions).
5119     */
5120    public StructureMap setUrl(String value) { 
5121        if (this.url == null)
5122          this.url = new UriType();
5123        this.url.setValue(value);
5124      return this;
5125    }
5126
5127    /**
5128     * @return {@link #identifier} (A formal identifier that is used to identify this structure map when it is represented in other formats, or referenced in a specification, model, design or an instance.)
5129     */
5130    public List<Identifier> getIdentifier() { 
5131      if (this.identifier == null)
5132        this.identifier = new ArrayList<Identifier>();
5133      return this.identifier;
5134    }
5135
5136    /**
5137     * @return Returns a reference to <code>this</code> for easy method chaining
5138     */
5139    public StructureMap setIdentifier(List<Identifier> theIdentifier) { 
5140      this.identifier = theIdentifier;
5141      return this;
5142    }
5143
5144    public boolean hasIdentifier() { 
5145      if (this.identifier == null)
5146        return false;
5147      for (Identifier item : this.identifier)
5148        if (!item.isEmpty())
5149          return true;
5150      return false;
5151    }
5152
5153    public Identifier addIdentifier() { //3
5154      Identifier t = new Identifier();
5155      if (this.identifier == null)
5156        this.identifier = new ArrayList<Identifier>();
5157      this.identifier.add(t);
5158      return t;
5159    }
5160
5161    public StructureMap addIdentifier(Identifier t) { //3
5162      if (t == null)
5163        return this;
5164      if (this.identifier == null)
5165        this.identifier = new ArrayList<Identifier>();
5166      this.identifier.add(t);
5167      return this;
5168    }
5169
5170    /**
5171     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
5172     */
5173    public Identifier getIdentifierFirstRep() { 
5174      if (getIdentifier().isEmpty()) {
5175        addIdentifier();
5176      }
5177      return getIdentifier().get(0);
5178    }
5179
5180    /**
5181     * @return {@link #version} (The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
5182     */
5183    public StringType getVersionElement() { 
5184      if (this.version == null)
5185        if (Configuration.errorOnAutoCreate())
5186          throw new Error("Attempt to auto-create StructureMap.version");
5187        else if (Configuration.doAutoCreate())
5188          this.version = new StringType(); // bb
5189      return this.version;
5190    }
5191
5192    public boolean hasVersionElement() { 
5193      return this.version != null && !this.version.isEmpty();
5194    }
5195
5196    public boolean hasVersion() { 
5197      return this.version != null && !this.version.isEmpty();
5198    }
5199
5200    /**
5201     * @param value {@link #version} (The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
5202     */
5203    public StructureMap setVersionElement(StringType value) { 
5204      this.version = value;
5205      return this;
5206    }
5207
5208    /**
5209     * @return The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
5210     */
5211    public String getVersion() { 
5212      return this.version == null ? null : this.version.getValue();
5213    }
5214
5215    /**
5216     * @param value The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
5217     */
5218    public StructureMap setVersion(String value) { 
5219      if (Utilities.noString(value))
5220        this.version = null;
5221      else {
5222        if (this.version == null)
5223          this.version = new StringType();
5224        this.version.setValue(value);
5225      }
5226      return this;
5227    }
5228
5229    /**
5230     * @return {@link #name} (A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
5231     */
5232    public StringType getNameElement() { 
5233      if (this.name == null)
5234        if (Configuration.errorOnAutoCreate())
5235          throw new Error("Attempt to auto-create StructureMap.name");
5236        else if (Configuration.doAutoCreate())
5237          this.name = new StringType(); // bb
5238      return this.name;
5239    }
5240
5241    public boolean hasNameElement() { 
5242      return this.name != null && !this.name.isEmpty();
5243    }
5244
5245    public boolean hasName() { 
5246      return this.name != null && !this.name.isEmpty();
5247    }
5248
5249    /**
5250     * @param value {@link #name} (A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
5251     */
5252    public StructureMap setNameElement(StringType value) { 
5253      this.name = value;
5254      return this;
5255    }
5256
5257    /**
5258     * @return A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.
5259     */
5260    public String getName() { 
5261      return this.name == null ? null : this.name.getValue();
5262    }
5263
5264    /**
5265     * @param value A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.
5266     */
5267    public StructureMap setName(String value) { 
5268        if (this.name == null)
5269          this.name = new StringType();
5270        this.name.setValue(value);
5271      return this;
5272    }
5273
5274    /**
5275     * @return {@link #title} (A short, descriptive, user-friendly title for the structure map.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
5276     */
5277    public StringType getTitleElement() { 
5278      if (this.title == null)
5279        if (Configuration.errorOnAutoCreate())
5280          throw new Error("Attempt to auto-create StructureMap.title");
5281        else if (Configuration.doAutoCreate())
5282          this.title = new StringType(); // bb
5283      return this.title;
5284    }
5285
5286    public boolean hasTitleElement() { 
5287      return this.title != null && !this.title.isEmpty();
5288    }
5289
5290    public boolean hasTitle() { 
5291      return this.title != null && !this.title.isEmpty();
5292    }
5293
5294    /**
5295     * @param value {@link #title} (A short, descriptive, user-friendly title for the structure map.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
5296     */
5297    public StructureMap setTitleElement(StringType value) { 
5298      this.title = value;
5299      return this;
5300    }
5301
5302    /**
5303     * @return A short, descriptive, user-friendly title for the structure map.
5304     */
5305    public String getTitle() { 
5306      return this.title == null ? null : this.title.getValue();
5307    }
5308
5309    /**
5310     * @param value A short, descriptive, user-friendly title for the structure map.
5311     */
5312    public StructureMap setTitle(String value) { 
5313      if (Utilities.noString(value))
5314        this.title = null;
5315      else {
5316        if (this.title == null)
5317          this.title = new StringType();
5318        this.title.setValue(value);
5319      }
5320      return this;
5321    }
5322
5323    /**
5324     * @return {@link #status} (The status of this structure map. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
5325     */
5326    public Enumeration<PublicationStatus> getStatusElement() { 
5327      if (this.status == null)
5328        if (Configuration.errorOnAutoCreate())
5329          throw new Error("Attempt to auto-create StructureMap.status");
5330        else if (Configuration.doAutoCreate())
5331          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
5332      return this.status;
5333    }
5334
5335    public boolean hasStatusElement() { 
5336      return this.status != null && !this.status.isEmpty();
5337    }
5338
5339    public boolean hasStatus() { 
5340      return this.status != null && !this.status.isEmpty();
5341    }
5342
5343    /**
5344     * @param value {@link #status} (The status of this structure map. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
5345     */
5346    public StructureMap setStatusElement(Enumeration<PublicationStatus> value) { 
5347      this.status = value;
5348      return this;
5349    }
5350
5351    /**
5352     * @return The status of this structure map. Enables tracking the life-cycle of the content.
5353     */
5354    public PublicationStatus getStatus() { 
5355      return this.status == null ? null : this.status.getValue();
5356    }
5357
5358    /**
5359     * @param value The status of this structure map. Enables tracking the life-cycle of the content.
5360     */
5361    public StructureMap setStatus(PublicationStatus value) { 
5362        if (this.status == null)
5363          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
5364        this.status.setValue(value);
5365      return this;
5366    }
5367
5368    /**
5369     * @return {@link #experimental} (A boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
5370     */
5371    public BooleanType getExperimentalElement() { 
5372      if (this.experimental == null)
5373        if (Configuration.errorOnAutoCreate())
5374          throw new Error("Attempt to auto-create StructureMap.experimental");
5375        else if (Configuration.doAutoCreate())
5376          this.experimental = new BooleanType(); // bb
5377      return this.experimental;
5378    }
5379
5380    public boolean hasExperimentalElement() { 
5381      return this.experimental != null && !this.experimental.isEmpty();
5382    }
5383
5384    public boolean hasExperimental() { 
5385      return this.experimental != null && !this.experimental.isEmpty();
5386    }
5387
5388    /**
5389     * @param value {@link #experimental} (A boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
5390     */
5391    public StructureMap setExperimentalElement(BooleanType value) { 
5392      this.experimental = value;
5393      return this;
5394    }
5395
5396    /**
5397     * @return A boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
5398     */
5399    public boolean getExperimental() { 
5400      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
5401    }
5402
5403    /**
5404     * @param value A boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
5405     */
5406    public StructureMap setExperimental(boolean value) { 
5407        if (this.experimental == null)
5408          this.experimental = new BooleanType();
5409        this.experimental.setValue(value);
5410      return this;
5411    }
5412
5413    /**
5414     * @return {@link #date} (The date  (and optionally time) when the structure map was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
5415     */
5416    public DateTimeType getDateElement() { 
5417      if (this.date == null)
5418        if (Configuration.errorOnAutoCreate())
5419          throw new Error("Attempt to auto-create StructureMap.date");
5420        else if (Configuration.doAutoCreate())
5421          this.date = new DateTimeType(); // bb
5422      return this.date;
5423    }
5424
5425    public boolean hasDateElement() { 
5426      return this.date != null && !this.date.isEmpty();
5427    }
5428
5429    public boolean hasDate() { 
5430      return this.date != null && !this.date.isEmpty();
5431    }
5432
5433    /**
5434     * @param value {@link #date} (The date  (and optionally time) when the structure map was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
5435     */
5436    public StructureMap setDateElement(DateTimeType value) { 
5437      this.date = value;
5438      return this;
5439    }
5440
5441    /**
5442     * @return The date  (and optionally time) when the structure map was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.
5443     */
5444    public Date getDate() { 
5445      return this.date == null ? null : this.date.getValue();
5446    }
5447
5448    /**
5449     * @param value The date  (and optionally time) when the structure map was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.
5450     */
5451    public StructureMap setDate(Date value) { 
5452      if (value == null)
5453        this.date = null;
5454      else {
5455        if (this.date == null)
5456          this.date = new DateTimeType();
5457        this.date.setValue(value);
5458      }
5459      return this;
5460    }
5461
5462    /**
5463     * @return {@link #publisher} (The name of the individual or organization that published the structure map.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
5464     */
5465    public StringType getPublisherElement() { 
5466      if (this.publisher == null)
5467        if (Configuration.errorOnAutoCreate())
5468          throw new Error("Attempt to auto-create StructureMap.publisher");
5469        else if (Configuration.doAutoCreate())
5470          this.publisher = new StringType(); // bb
5471      return this.publisher;
5472    }
5473
5474    public boolean hasPublisherElement() { 
5475      return this.publisher != null && !this.publisher.isEmpty();
5476    }
5477
5478    public boolean hasPublisher() { 
5479      return this.publisher != null && !this.publisher.isEmpty();
5480    }
5481
5482    /**
5483     * @param value {@link #publisher} (The name of the individual or organization that published the structure map.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
5484     */
5485    public StructureMap setPublisherElement(StringType value) { 
5486      this.publisher = value;
5487      return this;
5488    }
5489
5490    /**
5491     * @return The name of the individual or organization that published the structure map.
5492     */
5493    public String getPublisher() { 
5494      return this.publisher == null ? null : this.publisher.getValue();
5495    }
5496
5497    /**
5498     * @param value The name of the individual or organization that published the structure map.
5499     */
5500    public StructureMap setPublisher(String value) { 
5501      if (Utilities.noString(value))
5502        this.publisher = null;
5503      else {
5504        if (this.publisher == null)
5505          this.publisher = new StringType();
5506        this.publisher.setValue(value);
5507      }
5508      return this;
5509    }
5510
5511    /**
5512     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
5513     */
5514    public List<ContactDetail> getContact() { 
5515      if (this.contact == null)
5516        this.contact = new ArrayList<ContactDetail>();
5517      return this.contact;
5518    }
5519
5520    /**
5521     * @return Returns a reference to <code>this</code> for easy method chaining
5522     */
5523    public StructureMap setContact(List<ContactDetail> theContact) { 
5524      this.contact = theContact;
5525      return this;
5526    }
5527
5528    public boolean hasContact() { 
5529      if (this.contact == null)
5530        return false;
5531      for (ContactDetail item : this.contact)
5532        if (!item.isEmpty())
5533          return true;
5534      return false;
5535    }
5536
5537    public ContactDetail addContact() { //3
5538      ContactDetail t = new ContactDetail();
5539      if (this.contact == null)
5540        this.contact = new ArrayList<ContactDetail>();
5541      this.contact.add(t);
5542      return t;
5543    }
5544
5545    public StructureMap addContact(ContactDetail t) { //3
5546      if (t == null)
5547        return this;
5548      if (this.contact == null)
5549        this.contact = new ArrayList<ContactDetail>();
5550      this.contact.add(t);
5551      return this;
5552    }
5553
5554    /**
5555     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
5556     */
5557    public ContactDetail getContactFirstRep() { 
5558      if (getContact().isEmpty()) {
5559        addContact();
5560      }
5561      return getContact().get(0);
5562    }
5563
5564    /**
5565     * @return {@link #description} (A free text natural language description of the structure map from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
5566     */
5567    public MarkdownType getDescriptionElement() { 
5568      if (this.description == null)
5569        if (Configuration.errorOnAutoCreate())
5570          throw new Error("Attempt to auto-create StructureMap.description");
5571        else if (Configuration.doAutoCreate())
5572          this.description = new MarkdownType(); // bb
5573      return this.description;
5574    }
5575
5576    public boolean hasDescriptionElement() { 
5577      return this.description != null && !this.description.isEmpty();
5578    }
5579
5580    public boolean hasDescription() { 
5581      return this.description != null && !this.description.isEmpty();
5582    }
5583
5584    /**
5585     * @param value {@link #description} (A free text natural language description of the structure map from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
5586     */
5587    public StructureMap setDescriptionElement(MarkdownType value) { 
5588      this.description = value;
5589      return this;
5590    }
5591
5592    /**
5593     * @return A free text natural language description of the structure map from a consumer's perspective.
5594     */
5595    public String getDescription() { 
5596      return this.description == null ? null : this.description.getValue();
5597    }
5598
5599    /**
5600     * @param value A free text natural language description of the structure map from a consumer's perspective.
5601     */
5602    public StructureMap setDescription(String value) { 
5603      if (value == null)
5604        this.description = null;
5605      else {
5606        if (this.description == null)
5607          this.description = new MarkdownType();
5608        this.description.setValue(value);
5609      }
5610      return this;
5611    }
5612
5613    /**
5614     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate structure map instances.)
5615     */
5616    public List<UsageContext> getUseContext() { 
5617      if (this.useContext == null)
5618        this.useContext = new ArrayList<UsageContext>();
5619      return this.useContext;
5620    }
5621
5622    /**
5623     * @return Returns a reference to <code>this</code> for easy method chaining
5624     */
5625    public StructureMap setUseContext(List<UsageContext> theUseContext) { 
5626      this.useContext = theUseContext;
5627      return this;
5628    }
5629
5630    public boolean hasUseContext() { 
5631      if (this.useContext == null)
5632        return false;
5633      for (UsageContext item : this.useContext)
5634        if (!item.isEmpty())
5635          return true;
5636      return false;
5637    }
5638
5639    public UsageContext addUseContext() { //3
5640      UsageContext t = new UsageContext();
5641      if (this.useContext == null)
5642        this.useContext = new ArrayList<UsageContext>();
5643      this.useContext.add(t);
5644      return t;
5645    }
5646
5647    public StructureMap addUseContext(UsageContext t) { //3
5648      if (t == null)
5649        return this;
5650      if (this.useContext == null)
5651        this.useContext = new ArrayList<UsageContext>();
5652      this.useContext.add(t);
5653      return this;
5654    }
5655
5656    /**
5657     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
5658     */
5659    public UsageContext getUseContextFirstRep() { 
5660      if (getUseContext().isEmpty()) {
5661        addUseContext();
5662      }
5663      return getUseContext().get(0);
5664    }
5665
5666    /**
5667     * @return {@link #jurisdiction} (A legal or geographic region in which the structure map is intended to be used.)
5668     */
5669    public List<CodeableConcept> getJurisdiction() { 
5670      if (this.jurisdiction == null)
5671        this.jurisdiction = new ArrayList<CodeableConcept>();
5672      return this.jurisdiction;
5673    }
5674
5675    /**
5676     * @return Returns a reference to <code>this</code> for easy method chaining
5677     */
5678    public StructureMap setJurisdiction(List<CodeableConcept> theJurisdiction) { 
5679      this.jurisdiction = theJurisdiction;
5680      return this;
5681    }
5682
5683    public boolean hasJurisdiction() { 
5684      if (this.jurisdiction == null)
5685        return false;
5686      for (CodeableConcept item : this.jurisdiction)
5687        if (!item.isEmpty())
5688          return true;
5689      return false;
5690    }
5691
5692    public CodeableConcept addJurisdiction() { //3
5693      CodeableConcept t = new CodeableConcept();
5694      if (this.jurisdiction == null)
5695        this.jurisdiction = new ArrayList<CodeableConcept>();
5696      this.jurisdiction.add(t);
5697      return t;
5698    }
5699
5700    public StructureMap addJurisdiction(CodeableConcept t) { //3
5701      if (t == null)
5702        return this;
5703      if (this.jurisdiction == null)
5704        this.jurisdiction = new ArrayList<CodeableConcept>();
5705      this.jurisdiction.add(t);
5706      return this;
5707    }
5708
5709    /**
5710     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
5711     */
5712    public CodeableConcept getJurisdictionFirstRep() { 
5713      if (getJurisdiction().isEmpty()) {
5714        addJurisdiction();
5715      }
5716      return getJurisdiction().get(0);
5717    }
5718
5719    /**
5720     * @return {@link #purpose} (Explaination of why this structure map is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
5721     */
5722    public MarkdownType getPurposeElement() { 
5723      if (this.purpose == null)
5724        if (Configuration.errorOnAutoCreate())
5725          throw new Error("Attempt to auto-create StructureMap.purpose");
5726        else if (Configuration.doAutoCreate())
5727          this.purpose = new MarkdownType(); // bb
5728      return this.purpose;
5729    }
5730
5731    public boolean hasPurposeElement() { 
5732      return this.purpose != null && !this.purpose.isEmpty();
5733    }
5734
5735    public boolean hasPurpose() { 
5736      return this.purpose != null && !this.purpose.isEmpty();
5737    }
5738
5739    /**
5740     * @param value {@link #purpose} (Explaination of why this structure map is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
5741     */
5742    public StructureMap setPurposeElement(MarkdownType value) { 
5743      this.purpose = value;
5744      return this;
5745    }
5746
5747    /**
5748     * @return Explaination of why this structure map is needed and why it has been designed as it has.
5749     */
5750    public String getPurpose() { 
5751      return this.purpose == null ? null : this.purpose.getValue();
5752    }
5753
5754    /**
5755     * @param value Explaination of why this structure map is needed and why it has been designed as it has.
5756     */
5757    public StructureMap setPurpose(String value) { 
5758      if (value == null)
5759        this.purpose = null;
5760      else {
5761        if (this.purpose == null)
5762          this.purpose = new MarkdownType();
5763        this.purpose.setValue(value);
5764      }
5765      return this;
5766    }
5767
5768    /**
5769     * @return {@link #copyright} (A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
5770     */
5771    public MarkdownType getCopyrightElement() { 
5772      if (this.copyright == null)
5773        if (Configuration.errorOnAutoCreate())
5774          throw new Error("Attempt to auto-create StructureMap.copyright");
5775        else if (Configuration.doAutoCreate())
5776          this.copyright = new MarkdownType(); // bb
5777      return this.copyright;
5778    }
5779
5780    public boolean hasCopyrightElement() { 
5781      return this.copyright != null && !this.copyright.isEmpty();
5782    }
5783
5784    public boolean hasCopyright() { 
5785      return this.copyright != null && !this.copyright.isEmpty();
5786    }
5787
5788    /**
5789     * @param value {@link #copyright} (A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
5790     */
5791    public StructureMap setCopyrightElement(MarkdownType value) { 
5792      this.copyright = value;
5793      return this;
5794    }
5795
5796    /**
5797     * @return A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.
5798     */
5799    public String getCopyright() { 
5800      return this.copyright == null ? null : this.copyright.getValue();
5801    }
5802
5803    /**
5804     * @param value A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.
5805     */
5806    public StructureMap setCopyright(String value) { 
5807      if (value == null)
5808        this.copyright = null;
5809      else {
5810        if (this.copyright == null)
5811          this.copyright = new MarkdownType();
5812        this.copyright.setValue(value);
5813      }
5814      return this;
5815    }
5816
5817    /**
5818     * @return {@link #structure} (A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced.)
5819     */
5820    public List<StructureMapStructureComponent> getStructure() { 
5821      if (this.structure == null)
5822        this.structure = new ArrayList<StructureMapStructureComponent>();
5823      return this.structure;
5824    }
5825
5826    /**
5827     * @return Returns a reference to <code>this</code> for easy method chaining
5828     */
5829    public StructureMap setStructure(List<StructureMapStructureComponent> theStructure) { 
5830      this.structure = theStructure;
5831      return this;
5832    }
5833
5834    public boolean hasStructure() { 
5835      if (this.structure == null)
5836        return false;
5837      for (StructureMapStructureComponent item : this.structure)
5838        if (!item.isEmpty())
5839          return true;
5840      return false;
5841    }
5842
5843    public StructureMapStructureComponent addStructure() { //3
5844      StructureMapStructureComponent t = new StructureMapStructureComponent();
5845      if (this.structure == null)
5846        this.structure = new ArrayList<StructureMapStructureComponent>();
5847      this.structure.add(t);
5848      return t;
5849    }
5850
5851    public StructureMap addStructure(StructureMapStructureComponent t) { //3
5852      if (t == null)
5853        return this;
5854      if (this.structure == null)
5855        this.structure = new ArrayList<StructureMapStructureComponent>();
5856      this.structure.add(t);
5857      return this;
5858    }
5859
5860    /**
5861     * @return The first repetition of repeating field {@link #structure}, creating it if it does not already exist
5862     */
5863    public StructureMapStructureComponent getStructureFirstRep() { 
5864      if (getStructure().isEmpty()) {
5865        addStructure();
5866      }
5867      return getStructure().get(0);
5868    }
5869
5870    /**
5871     * @return {@link #import_} (Other maps used by this map (canonical URLs).)
5872     */
5873    public List<UriType> getImport() { 
5874      if (this.import_ == null)
5875        this.import_ = new ArrayList<UriType>();
5876      return this.import_;
5877    }
5878
5879    /**
5880     * @return Returns a reference to <code>this</code> for easy method chaining
5881     */
5882    public StructureMap setImport(List<UriType> theImport) { 
5883      this.import_ = theImport;
5884      return this;
5885    }
5886
5887    public boolean hasImport() { 
5888      if (this.import_ == null)
5889        return false;
5890      for (UriType item : this.import_)
5891        if (!item.isEmpty())
5892          return true;
5893      return false;
5894    }
5895
5896    /**
5897     * @return {@link #import_} (Other maps used by this map (canonical URLs).)
5898     */
5899    public UriType addImportElement() {//2 
5900      UriType t = new UriType();
5901      if (this.import_ == null)
5902        this.import_ = new ArrayList<UriType>();
5903      this.import_.add(t);
5904      return t;
5905    }
5906
5907    /**
5908     * @param value {@link #import_} (Other maps used by this map (canonical URLs).)
5909     */
5910    public StructureMap addImport(String value) { //1
5911      UriType t = new UriType();
5912      t.setValue(value);
5913      if (this.import_ == null)
5914        this.import_ = new ArrayList<UriType>();
5915      this.import_.add(t);
5916      return this;
5917    }
5918
5919    /**
5920     * @param value {@link #import_} (Other maps used by this map (canonical URLs).)
5921     */
5922    public boolean hasImport(String value) { 
5923      if (this.import_ == null)
5924        return false;
5925      for (UriType v : this.import_)
5926        if (v.equals(value)) // uri
5927          return true;
5928      return false;
5929    }
5930
5931    /**
5932     * @return {@link #group} (Organizes the mapping into managable chunks for human review/ease of maintenance.)
5933     */
5934    public List<StructureMapGroupComponent> getGroup() { 
5935      if (this.group == null)
5936        this.group = new ArrayList<StructureMapGroupComponent>();
5937      return this.group;
5938    }
5939
5940    /**
5941     * @return Returns a reference to <code>this</code> for easy method chaining
5942     */
5943    public StructureMap setGroup(List<StructureMapGroupComponent> theGroup) { 
5944      this.group = theGroup;
5945      return this;
5946    }
5947
5948    public boolean hasGroup() { 
5949      if (this.group == null)
5950        return false;
5951      for (StructureMapGroupComponent item : this.group)
5952        if (!item.isEmpty())
5953          return true;
5954      return false;
5955    }
5956
5957    public StructureMapGroupComponent addGroup() { //3
5958      StructureMapGroupComponent t = new StructureMapGroupComponent();
5959      if (this.group == null)
5960        this.group = new ArrayList<StructureMapGroupComponent>();
5961      this.group.add(t);
5962      return t;
5963    }
5964
5965    public StructureMap addGroup(StructureMapGroupComponent t) { //3
5966      if (t == null)
5967        return this;
5968      if (this.group == null)
5969        this.group = new ArrayList<StructureMapGroupComponent>();
5970      this.group.add(t);
5971      return this;
5972    }
5973
5974    /**
5975     * @return The first repetition of repeating field {@link #group}, creating it if it does not already exist
5976     */
5977    public StructureMapGroupComponent getGroupFirstRep() { 
5978      if (getGroup().isEmpty()) {
5979        addGroup();
5980      }
5981      return getGroup().get(0);
5982    }
5983
5984      protected void listChildren(List<Property> childrenList) {
5985        super.listChildren(childrenList);
5986        childrenList.add(new Property("url", "uri", "An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure map is (or will be) published. The URL SHOULD include the major version of the structure map. For more information see [Technical and Business Versions](resource.html#versions).", 0, java.lang.Integer.MAX_VALUE, url));
5987        childrenList.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this structure map when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
5988        childrenList.add(new Property("version", "string", "The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.", 0, java.lang.Integer.MAX_VALUE, version));
5989        childrenList.add(new Property("name", "string", "A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, java.lang.Integer.MAX_VALUE, name));
5990        childrenList.add(new Property("title", "string", "A short, descriptive, user-friendly title for the structure map.", 0, java.lang.Integer.MAX_VALUE, title));
5991        childrenList.add(new Property("status", "code", "The status of this structure map. Enables tracking the life-cycle of the content.", 0, java.lang.Integer.MAX_VALUE, status));
5992        childrenList.add(new Property("experimental", "boolean", "A boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, java.lang.Integer.MAX_VALUE, experimental));
5993        childrenList.add(new Property("date", "dateTime", "The date  (and optionally time) when the structure map was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.", 0, java.lang.Integer.MAX_VALUE, date));
5994        childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the structure map.", 0, java.lang.Integer.MAX_VALUE, publisher));
5995        childrenList.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
5996        childrenList.add(new Property("description", "markdown", "A free text natural language description of the structure map from a consumer's perspective.", 0, java.lang.Integer.MAX_VALUE, description));
5997        childrenList.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate structure map instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
5998        childrenList.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the structure map is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
5999        childrenList.add(new Property("purpose", "markdown", "Explaination of why this structure map is needed and why it has been designed as it has.", 0, java.lang.Integer.MAX_VALUE, purpose));
6000        childrenList.add(new Property("copyright", "markdown", "A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.", 0, java.lang.Integer.MAX_VALUE, copyright));
6001        childrenList.add(new Property("structure", "", "A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced.", 0, java.lang.Integer.MAX_VALUE, structure));
6002        childrenList.add(new Property("import", "uri", "Other maps used by this map (canonical URLs).", 0, java.lang.Integer.MAX_VALUE, import_));
6003        childrenList.add(new Property("group", "", "Organizes the mapping into managable chunks for human review/ease of maintenance.", 0, java.lang.Integer.MAX_VALUE, group));
6004      }
6005
6006      @Override
6007      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6008        switch (hash) {
6009        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
6010        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
6011        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
6012        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
6013        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
6014        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
6015        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
6016        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
6017        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
6018        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
6019        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
6020        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
6021        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
6022        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
6023        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
6024        case 144518515: /*structure*/ return this.structure == null ? new Base[0] : this.structure.toArray(new Base[this.structure.size()]); // StructureMapStructureComponent
6025        case -1184795739: /*import*/ return this.import_ == null ? new Base[0] : this.import_.toArray(new Base[this.import_.size()]); // UriType
6026        case 98629247: /*group*/ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // StructureMapGroupComponent
6027        default: return super.getProperty(hash, name, checkValid);
6028        }
6029
6030      }
6031
6032      @Override
6033      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6034        switch (hash) {
6035        case 116079: // url
6036          this.url = castToUri(value); // UriType
6037          return value;
6038        case -1618432855: // identifier
6039          this.getIdentifier().add(castToIdentifier(value)); // Identifier
6040          return value;
6041        case 351608024: // version
6042          this.version = castToString(value); // StringType
6043          return value;
6044        case 3373707: // name
6045          this.name = castToString(value); // StringType
6046          return value;
6047        case 110371416: // title
6048          this.title = castToString(value); // StringType
6049          return value;
6050        case -892481550: // status
6051          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
6052          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
6053          return value;
6054        case -404562712: // experimental
6055          this.experimental = castToBoolean(value); // BooleanType
6056          return value;
6057        case 3076014: // date
6058          this.date = castToDateTime(value); // DateTimeType
6059          return value;
6060        case 1447404028: // publisher
6061          this.publisher = castToString(value); // StringType
6062          return value;
6063        case 951526432: // contact
6064          this.getContact().add(castToContactDetail(value)); // ContactDetail
6065          return value;
6066        case -1724546052: // description
6067          this.description = castToMarkdown(value); // MarkdownType
6068          return value;
6069        case -669707736: // useContext
6070          this.getUseContext().add(castToUsageContext(value)); // UsageContext
6071          return value;
6072        case -507075711: // jurisdiction
6073          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
6074          return value;
6075        case -220463842: // purpose
6076          this.purpose = castToMarkdown(value); // MarkdownType
6077          return value;
6078        case 1522889671: // copyright
6079          this.copyright = castToMarkdown(value); // MarkdownType
6080          return value;
6081        case 144518515: // structure
6082          this.getStructure().add((StructureMapStructureComponent) value); // StructureMapStructureComponent
6083          return value;
6084        case -1184795739: // import
6085          this.getImport().add(castToUri(value)); // UriType
6086          return value;
6087        case 98629247: // group
6088          this.getGroup().add((StructureMapGroupComponent) value); // StructureMapGroupComponent
6089          return value;
6090        default: return super.setProperty(hash, name, value);
6091        }
6092
6093      }
6094
6095      @Override
6096      public Base setProperty(String name, Base value) throws FHIRException {
6097        if (name.equals("url")) {
6098          this.url = castToUri(value); // UriType
6099        } else if (name.equals("identifier")) {
6100          this.getIdentifier().add(castToIdentifier(value));
6101        } else if (name.equals("version")) {
6102          this.version = castToString(value); // StringType
6103        } else if (name.equals("name")) {
6104          this.name = castToString(value); // StringType
6105        } else if (name.equals("title")) {
6106          this.title = castToString(value); // StringType
6107        } else if (name.equals("status")) {
6108          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
6109          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
6110        } else if (name.equals("experimental")) {
6111          this.experimental = castToBoolean(value); // BooleanType
6112        } else if (name.equals("date")) {
6113          this.date = castToDateTime(value); // DateTimeType
6114        } else if (name.equals("publisher")) {
6115          this.publisher = castToString(value); // StringType
6116        } else if (name.equals("contact")) {
6117          this.getContact().add(castToContactDetail(value));
6118        } else if (name.equals("description")) {
6119          this.description = castToMarkdown(value); // MarkdownType
6120        } else if (name.equals("useContext")) {
6121          this.getUseContext().add(castToUsageContext(value));
6122        } else if (name.equals("jurisdiction")) {
6123          this.getJurisdiction().add(castToCodeableConcept(value));
6124        } else if (name.equals("purpose")) {
6125          this.purpose = castToMarkdown(value); // MarkdownType
6126        } else if (name.equals("copyright")) {
6127          this.copyright = castToMarkdown(value); // MarkdownType
6128        } else if (name.equals("structure")) {
6129          this.getStructure().add((StructureMapStructureComponent) value);
6130        } else if (name.equals("import")) {
6131          this.getImport().add(castToUri(value));
6132        } else if (name.equals("group")) {
6133          this.getGroup().add((StructureMapGroupComponent) value);
6134        } else
6135          return super.setProperty(name, value);
6136        return value;
6137      }
6138
6139      @Override
6140      public Base makeProperty(int hash, String name) throws FHIRException {
6141        switch (hash) {
6142        case 116079:  return getUrlElement();
6143        case -1618432855:  return addIdentifier(); 
6144        case 351608024:  return getVersionElement();
6145        case 3373707:  return getNameElement();
6146        case 110371416:  return getTitleElement();
6147        case -892481550:  return getStatusElement();
6148        case -404562712:  return getExperimentalElement();
6149        case 3076014:  return getDateElement();
6150        case 1447404028:  return getPublisherElement();
6151        case 951526432:  return addContact(); 
6152        case -1724546052:  return getDescriptionElement();
6153        case -669707736:  return addUseContext(); 
6154        case -507075711:  return addJurisdiction(); 
6155        case -220463842:  return getPurposeElement();
6156        case 1522889671:  return getCopyrightElement();
6157        case 144518515:  return addStructure(); 
6158        case -1184795739:  return addImportElement();
6159        case 98629247:  return addGroup(); 
6160        default: return super.makeProperty(hash, name);
6161        }
6162
6163      }
6164
6165      @Override
6166      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6167        switch (hash) {
6168        case 116079: /*url*/ return new String[] {"uri"};
6169        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
6170        case 351608024: /*version*/ return new String[] {"string"};
6171        case 3373707: /*name*/ return new String[] {"string"};
6172        case 110371416: /*title*/ return new String[] {"string"};
6173        case -892481550: /*status*/ return new String[] {"code"};
6174        case -404562712: /*experimental*/ return new String[] {"boolean"};
6175        case 3076014: /*date*/ return new String[] {"dateTime"};
6176        case 1447404028: /*publisher*/ return new String[] {"string"};
6177        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
6178        case -1724546052: /*description*/ return new String[] {"markdown"};
6179        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
6180        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
6181        case -220463842: /*purpose*/ return new String[] {"markdown"};
6182        case 1522889671: /*copyright*/ return new String[] {"markdown"};
6183        case 144518515: /*structure*/ return new String[] {};
6184        case -1184795739: /*import*/ return new String[] {"uri"};
6185        case 98629247: /*group*/ return new String[] {};
6186        default: return super.getTypesForProperty(hash, name);
6187        }
6188
6189      }
6190
6191      @Override
6192      public Base addChild(String name) throws FHIRException {
6193        if (name.equals("url")) {
6194          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.url");
6195        }
6196        else if (name.equals("identifier")) {
6197          return addIdentifier();
6198        }
6199        else if (name.equals("version")) {
6200          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.version");
6201        }
6202        else if (name.equals("name")) {
6203          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
6204        }
6205        else if (name.equals("title")) {
6206          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.title");
6207        }
6208        else if (name.equals("status")) {
6209          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.status");
6210        }
6211        else if (name.equals("experimental")) {
6212          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.experimental");
6213        }
6214        else if (name.equals("date")) {
6215          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.date");
6216        }
6217        else if (name.equals("publisher")) {
6218          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.publisher");
6219        }
6220        else if (name.equals("contact")) {
6221          return addContact();
6222        }
6223        else if (name.equals("description")) {
6224          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.description");
6225        }
6226        else if (name.equals("useContext")) {
6227          return addUseContext();
6228        }
6229        else if (name.equals("jurisdiction")) {
6230          return addJurisdiction();
6231        }
6232        else if (name.equals("purpose")) {
6233          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.purpose");
6234        }
6235        else if (name.equals("copyright")) {
6236          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.copyright");
6237        }
6238        else if (name.equals("structure")) {
6239          return addStructure();
6240        }
6241        else if (name.equals("import")) {
6242          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.import");
6243        }
6244        else if (name.equals("group")) {
6245          return addGroup();
6246        }
6247        else
6248          return super.addChild(name);
6249      }
6250
6251  public String fhirType() {
6252    return "StructureMap";
6253
6254  }
6255
6256      public StructureMap copy() {
6257        StructureMap dst = new StructureMap();
6258        copyValues(dst);
6259        dst.url = url == null ? null : url.copy();
6260        if (identifier != null) {
6261          dst.identifier = new ArrayList<Identifier>();
6262          for (Identifier i : identifier)
6263            dst.identifier.add(i.copy());
6264        };
6265        dst.version = version == null ? null : version.copy();
6266        dst.name = name == null ? null : name.copy();
6267        dst.title = title == null ? null : title.copy();
6268        dst.status = status == null ? null : status.copy();
6269        dst.experimental = experimental == null ? null : experimental.copy();
6270        dst.date = date == null ? null : date.copy();
6271        dst.publisher = publisher == null ? null : publisher.copy();
6272        if (contact != null) {
6273          dst.contact = new ArrayList<ContactDetail>();
6274          for (ContactDetail i : contact)
6275            dst.contact.add(i.copy());
6276        };
6277        dst.description = description == null ? null : description.copy();
6278        if (useContext != null) {
6279          dst.useContext = new ArrayList<UsageContext>();
6280          for (UsageContext i : useContext)
6281            dst.useContext.add(i.copy());
6282        };
6283        if (jurisdiction != null) {
6284          dst.jurisdiction = new ArrayList<CodeableConcept>();
6285          for (CodeableConcept i : jurisdiction)
6286            dst.jurisdiction.add(i.copy());
6287        };
6288        dst.purpose = purpose == null ? null : purpose.copy();
6289        dst.copyright = copyright == null ? null : copyright.copy();
6290        if (structure != null) {
6291          dst.structure = new ArrayList<StructureMapStructureComponent>();
6292          for (StructureMapStructureComponent i : structure)
6293            dst.structure.add(i.copy());
6294        };
6295        if (import_ != null) {
6296          dst.import_ = new ArrayList<UriType>();
6297          for (UriType i : import_)
6298            dst.import_.add(i.copy());
6299        };
6300        if (group != null) {
6301          dst.group = new ArrayList<StructureMapGroupComponent>();
6302          for (StructureMapGroupComponent i : group)
6303            dst.group.add(i.copy());
6304        };
6305        return dst;
6306      }
6307
6308      protected StructureMap typedCopy() {
6309        return copy();
6310      }
6311
6312      @Override
6313      public boolean equalsDeep(Base other) {
6314        if (!super.equalsDeep(other))
6315          return false;
6316        if (!(other instanceof StructureMap))
6317          return false;
6318        StructureMap o = (StructureMap) other;
6319        return compareDeep(identifier, o.identifier, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
6320           && compareDeep(structure, o.structure, true) && compareDeep(import_, o.import_, true) && compareDeep(group, o.group, true)
6321          ;
6322      }
6323
6324      @Override
6325      public boolean equalsShallow(Base other) {
6326        if (!super.equalsShallow(other))
6327          return false;
6328        if (!(other instanceof StructureMap))
6329          return false;
6330        StructureMap o = (StructureMap) other;
6331        return compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true) && compareValues(import_, o.import_, true)
6332          ;
6333      }
6334
6335      public boolean isEmpty() {
6336        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, purpose, copyright
6337          , structure, import_, group);
6338      }
6339
6340  @Override
6341  public ResourceType getResourceType() {
6342    return ResourceType.StructureMap;
6343   }
6344
6345 /**
6346   * Search parameter: <b>date</b>
6347   * <p>
6348   * Description: <b>The structure map publication date</b><br>
6349   * Type: <b>date</b><br>
6350   * Path: <b>StructureMap.date</b><br>
6351   * </p>
6352   */
6353  @SearchParamDefinition(name="date", path="StructureMap.date", description="The structure map publication date", type="date" )
6354  public static final String SP_DATE = "date";
6355 /**
6356   * <b>Fluent Client</b> search parameter constant for <b>date</b>
6357   * <p>
6358   * Description: <b>The structure map publication date</b><br>
6359   * Type: <b>date</b><br>
6360   * Path: <b>StructureMap.date</b><br>
6361   * </p>
6362   */
6363  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
6364
6365 /**
6366   * Search parameter: <b>identifier</b>
6367   * <p>
6368   * Description: <b>External identifier for the structure map</b><br>
6369   * Type: <b>token</b><br>
6370   * Path: <b>StructureMap.identifier</b><br>
6371   * </p>
6372   */
6373  @SearchParamDefinition(name="identifier", path="StructureMap.identifier", description="External identifier for the structure map", type="token" )
6374  public static final String SP_IDENTIFIER = "identifier";
6375 /**
6376   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
6377   * <p>
6378   * Description: <b>External identifier for the structure map</b><br>
6379   * Type: <b>token</b><br>
6380   * Path: <b>StructureMap.identifier</b><br>
6381   * </p>
6382   */
6383  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
6384
6385 /**
6386   * Search parameter: <b>jurisdiction</b>
6387   * <p>
6388   * Description: <b>Intended jurisdiction for the structure map</b><br>
6389   * Type: <b>token</b><br>
6390   * Path: <b>StructureMap.jurisdiction</b><br>
6391   * </p>
6392   */
6393  @SearchParamDefinition(name="jurisdiction", path="StructureMap.jurisdiction", description="Intended jurisdiction for the structure map", type="token" )
6394  public static final String SP_JURISDICTION = "jurisdiction";
6395 /**
6396   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
6397   * <p>
6398   * Description: <b>Intended jurisdiction for the structure map</b><br>
6399   * Type: <b>token</b><br>
6400   * Path: <b>StructureMap.jurisdiction</b><br>
6401   * </p>
6402   */
6403  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
6404
6405 /**
6406   * Search parameter: <b>name</b>
6407   * <p>
6408   * Description: <b>Computationally friendly name of the structure map</b><br>
6409   * Type: <b>string</b><br>
6410   * Path: <b>StructureMap.name</b><br>
6411   * </p>
6412   */
6413  @SearchParamDefinition(name="name", path="StructureMap.name", description="Computationally friendly name of the structure map", type="string" )
6414  public static final String SP_NAME = "name";
6415 /**
6416   * <b>Fluent Client</b> search parameter constant for <b>name</b>
6417   * <p>
6418   * Description: <b>Computationally friendly name of the structure map</b><br>
6419   * Type: <b>string</b><br>
6420   * Path: <b>StructureMap.name</b><br>
6421   * </p>
6422   */
6423  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
6424
6425 /**
6426   * Search parameter: <b>description</b>
6427   * <p>
6428   * Description: <b>The description of the structure map</b><br>
6429   * Type: <b>string</b><br>
6430   * Path: <b>StructureMap.description</b><br>
6431   * </p>
6432   */
6433  @SearchParamDefinition(name="description", path="StructureMap.description", description="The description of the structure map", type="string" )
6434  public static final String SP_DESCRIPTION = "description";
6435 /**
6436   * <b>Fluent Client</b> search parameter constant for <b>description</b>
6437   * <p>
6438   * Description: <b>The description of the structure map</b><br>
6439   * Type: <b>string</b><br>
6440   * Path: <b>StructureMap.description</b><br>
6441   * </p>
6442   */
6443  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
6444
6445 /**
6446   * Search parameter: <b>publisher</b>
6447   * <p>
6448   * Description: <b>Name of the publisher of the structure map</b><br>
6449   * Type: <b>string</b><br>
6450   * Path: <b>StructureMap.publisher</b><br>
6451   * </p>
6452   */
6453  @SearchParamDefinition(name="publisher", path="StructureMap.publisher", description="Name of the publisher of the structure map", type="string" )
6454  public static final String SP_PUBLISHER = "publisher";
6455 /**
6456   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
6457   * <p>
6458   * Description: <b>Name of the publisher of the structure map</b><br>
6459   * Type: <b>string</b><br>
6460   * Path: <b>StructureMap.publisher</b><br>
6461   * </p>
6462   */
6463  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
6464
6465 /**
6466   * Search parameter: <b>title</b>
6467   * <p>
6468   * Description: <b>The human-friendly name of the structure map</b><br>
6469   * Type: <b>string</b><br>
6470   * Path: <b>StructureMap.title</b><br>
6471   * </p>
6472   */
6473  @SearchParamDefinition(name="title", path="StructureMap.title", description="The human-friendly name of the structure map", type="string" )
6474  public static final String SP_TITLE = "title";
6475 /**
6476   * <b>Fluent Client</b> search parameter constant for <b>title</b>
6477   * <p>
6478   * Description: <b>The human-friendly name of the structure map</b><br>
6479   * Type: <b>string</b><br>
6480   * Path: <b>StructureMap.title</b><br>
6481   * </p>
6482   */
6483  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
6484
6485 /**
6486   * Search parameter: <b>version</b>
6487   * <p>
6488   * Description: <b>The business version of the structure map</b><br>
6489   * Type: <b>token</b><br>
6490   * Path: <b>StructureMap.version</b><br>
6491   * </p>
6492   */
6493  @SearchParamDefinition(name="version", path="StructureMap.version", description="The business version of the structure map", type="token" )
6494  public static final String SP_VERSION = "version";
6495 /**
6496   * <b>Fluent Client</b> search parameter constant for <b>version</b>
6497   * <p>
6498   * Description: <b>The business version of the structure map</b><br>
6499   * Type: <b>token</b><br>
6500   * Path: <b>StructureMap.version</b><br>
6501   * </p>
6502   */
6503  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
6504
6505 /**
6506   * Search parameter: <b>url</b>
6507   * <p>
6508   * Description: <b>The uri that identifies the structure map</b><br>
6509   * Type: <b>uri</b><br>
6510   * Path: <b>StructureMap.url</b><br>
6511   * </p>
6512   */
6513  @SearchParamDefinition(name="url", path="StructureMap.url", description="The uri that identifies the structure map", type="uri" )
6514  public static final String SP_URL = "url";
6515 /**
6516   * <b>Fluent Client</b> search parameter constant for <b>url</b>
6517   * <p>
6518   * Description: <b>The uri that identifies the structure map</b><br>
6519   * Type: <b>uri</b><br>
6520   * Path: <b>StructureMap.url</b><br>
6521   * </p>
6522   */
6523  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
6524
6525 /**
6526   * Search parameter: <b>status</b>
6527   * <p>
6528   * Description: <b>The current status of the structure map</b><br>
6529   * Type: <b>token</b><br>
6530   * Path: <b>StructureMap.status</b><br>
6531   * </p>
6532   */
6533  @SearchParamDefinition(name="status", path="StructureMap.status", description="The current status of the structure map", type="token" )
6534  public static final String SP_STATUS = "status";
6535 /**
6536   * <b>Fluent Client</b> search parameter constant for <b>status</b>
6537   * <p>
6538   * Description: <b>The current status of the structure map</b><br>
6539   * Type: <b>token</b><br>
6540   * Path: <b>StructureMap.status</b><br>
6541   * </p>
6542   */
6543  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
6544
6545// added from java-adornments.txt:
6546
6547  public String toString() {
6548    return StructureMapUtilities.render(this);
6549  }
6550
6551
6552// end addition
6553
6554}
6555