001package org.hl7.fhir.r4.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 Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.r4.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.r4.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/StructureDefinition/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 than 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 than 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 than 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 than 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 FHIRPath 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 FHIRPath 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 = {CanonicalType.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 CanonicalType 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 = 364750586L;
1101
1102    /**
1103     * Constructor
1104     */
1105      public StructureMapStructureComponent() {
1106        super();
1107      }
1108
1109    /**
1110     * Constructor
1111     */
1112      public StructureMapStructureComponent(CanonicalType 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 CanonicalType 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 CanonicalType(); // 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(CanonicalType 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 CanonicalType();
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> children) {
1307          super.listChildren(children);
1308          children.add(new Property("url", "canonical(StructureDefinition)", "The canonical URL that identifies the structure.", 0, 1, url));
1309          children.add(new Property("mode", "code", "How the referenced structure is used in this mapping.", 0, 1, mode));
1310          children.add(new Property("alias", "string", "The name used for this type in the map.", 0, 1, alias));
1311          children.add(new Property("documentation", "string", "Documentation that describes how the structure is used in the mapping.", 0, 1, documentation));
1312        }
1313
1314        @Override
1315        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1316          switch (_hash) {
1317          case 116079: /*url*/  return new Property("url", "canonical(StructureDefinition)", "The canonical URL that identifies the structure.", 0, 1, url);
1318          case 3357091: /*mode*/  return new Property("mode", "code", "How the referenced structure is used in this mapping.", 0, 1, mode);
1319          case 92902992: /*alias*/  return new Property("alias", "string", "The name used for this type in the map.", 0, 1, alias);
1320          case 1587405498: /*documentation*/  return new Property("documentation", "string", "Documentation that describes how the structure is used in the mapping.", 0, 1, documentation);
1321          default: return super.getNamedProperty(_hash, _name, _checkValid);
1322          }
1323
1324        }
1325
1326      @Override
1327      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1328        switch (hash) {
1329        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // CanonicalType
1330        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<StructureMapModelMode>
1331        case 92902992: /*alias*/ return this.alias == null ? new Base[0] : new Base[] {this.alias}; // StringType
1332        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
1333        default: return super.getProperty(hash, name, checkValid);
1334        }
1335
1336      }
1337
1338      @Override
1339      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1340        switch (hash) {
1341        case 116079: // url
1342          this.url = castToCanonical(value); // CanonicalType
1343          return value;
1344        case 3357091: // mode
1345          value = new StructureMapModelModeEnumFactory().fromType(castToCode(value));
1346          this.mode = (Enumeration) value; // Enumeration<StructureMapModelMode>
1347          return value;
1348        case 92902992: // alias
1349          this.alias = castToString(value); // StringType
1350          return value;
1351        case 1587405498: // documentation
1352          this.documentation = castToString(value); // StringType
1353          return value;
1354        default: return super.setProperty(hash, name, value);
1355        }
1356
1357      }
1358
1359      @Override
1360      public Base setProperty(String name, Base value) throws FHIRException {
1361        if (name.equals("url")) {
1362          this.url = castToCanonical(value); // CanonicalType
1363        } else if (name.equals("mode")) {
1364          value = new StructureMapModelModeEnumFactory().fromType(castToCode(value));
1365          this.mode = (Enumeration) value; // Enumeration<StructureMapModelMode>
1366        } else if (name.equals("alias")) {
1367          this.alias = castToString(value); // StringType
1368        } else if (name.equals("documentation")) {
1369          this.documentation = castToString(value); // StringType
1370        } else
1371          return super.setProperty(name, value);
1372        return value;
1373      }
1374
1375      @Override
1376      public Base makeProperty(int hash, String name) throws FHIRException {
1377        switch (hash) {
1378        case 116079:  return getUrlElement();
1379        case 3357091:  return getModeElement();
1380        case 92902992:  return getAliasElement();
1381        case 1587405498:  return getDocumentationElement();
1382        default: return super.makeProperty(hash, name);
1383        }
1384
1385      }
1386
1387      @Override
1388      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1389        switch (hash) {
1390        case 116079: /*url*/ return new String[] {"canonical"};
1391        case 3357091: /*mode*/ return new String[] {"code"};
1392        case 92902992: /*alias*/ return new String[] {"string"};
1393        case 1587405498: /*documentation*/ return new String[] {"string"};
1394        default: return super.getTypesForProperty(hash, name);
1395        }
1396
1397      }
1398
1399      @Override
1400      public Base addChild(String name) throws FHIRException {
1401        if (name.equals("url")) {
1402          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.url");
1403        }
1404        else if (name.equals("mode")) {
1405          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.mode");
1406        }
1407        else if (name.equals("alias")) {
1408          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.alias");
1409        }
1410        else if (name.equals("documentation")) {
1411          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
1412        }
1413        else
1414          return super.addChild(name);
1415      }
1416
1417      public StructureMapStructureComponent copy() {
1418        StructureMapStructureComponent dst = new StructureMapStructureComponent();
1419        copyValues(dst);
1420        dst.url = url == null ? null : url.copy();
1421        dst.mode = mode == null ? null : mode.copy();
1422        dst.alias = alias == null ? null : alias.copy();
1423        dst.documentation = documentation == null ? null : documentation.copy();
1424        return dst;
1425      }
1426
1427      @Override
1428      public boolean equalsDeep(Base other_) {
1429        if (!super.equalsDeep(other_))
1430          return false;
1431        if (!(other_ instanceof StructureMapStructureComponent))
1432          return false;
1433        StructureMapStructureComponent o = (StructureMapStructureComponent) other_;
1434        return compareDeep(url, o.url, true) && compareDeep(mode, o.mode, true) && compareDeep(alias, o.alias, true)
1435           && compareDeep(documentation, o.documentation, true);
1436      }
1437
1438      @Override
1439      public boolean equalsShallow(Base other_) {
1440        if (!super.equalsShallow(other_))
1441          return false;
1442        if (!(other_ instanceof StructureMapStructureComponent))
1443          return false;
1444        StructureMapStructureComponent o = (StructureMapStructureComponent) other_;
1445        return compareValues(mode, o.mode, true) && compareValues(alias, o.alias, true) && compareValues(documentation, o.documentation, true)
1446          ;
1447      }
1448
1449      public boolean isEmpty() {
1450        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, mode, alias, documentation
1451          );
1452      }
1453
1454  public String fhirType() {
1455    return "StructureMap.structure";
1456
1457  }
1458
1459  }
1460
1461    @Block()
1462    public static class StructureMapGroupComponent extends BackboneElement implements IBaseBackboneElement {
1463        /**
1464         * A unique name for the group for the convenience of human readers.
1465         */
1466        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1467        @Description(shortDefinition="Human-readable label", formalDefinition="A unique name for the group for the convenience of human readers." )
1468        protected IdType name;
1469
1470        /**
1471         * Another group that this group adds rules to.
1472         */
1473        @Child(name = "extends", type = {IdType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1474        @Description(shortDefinition="Another group that this group adds rules to", formalDefinition="Another group that this group adds rules to." )
1475        protected IdType extends_;
1476
1477        /**
1478         * If this is the default rule set to apply for the source type or this combination of types.
1479         */
1480        @Child(name = "typeMode", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1481        @Description(shortDefinition="none | types | type-and-types", formalDefinition="If this is the default rule set to apply for the source type or this combination of types." )
1482        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-group-type-mode")
1483        protected Enumeration<StructureMapGroupTypeMode> typeMode;
1484
1485        /**
1486         * Additional supporting documentation that explains the purpose of the group and the types of mappings within it.
1487         */
1488        @Child(name = "documentation", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1489        @Description(shortDefinition="Additional description/explanation for group", formalDefinition="Additional supporting documentation that explains the purpose of the group and the types of mappings within it." )
1490        protected StringType documentation;
1491
1492        /**
1493         * A name assigned to an instance of data. The instance must be provided when the mapping is invoked.
1494         */
1495        @Child(name = "input", type = {}, order=5, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1496        @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." )
1497        protected List<StructureMapGroupInputComponent> input;
1498
1499        /**
1500         * Transform Rule from source to target.
1501         */
1502        @Child(name = "rule", type = {}, order=6, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1503        @Description(shortDefinition="Transform Rule from source to target", formalDefinition="Transform Rule from source to target." )
1504        protected List<StructureMapGroupRuleComponent> rule;
1505
1506        private static final long serialVersionUID = -1474595081L;
1507
1508    /**
1509     * Constructor
1510     */
1511      public StructureMapGroupComponent() {
1512        super();
1513      }
1514
1515    /**
1516     * Constructor
1517     */
1518      public StructureMapGroupComponent(IdType name, Enumeration<StructureMapGroupTypeMode> typeMode) {
1519        super();
1520        this.name = name;
1521        this.typeMode = typeMode;
1522      }
1523
1524        /**
1525         * @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
1526         */
1527        public IdType getNameElement() { 
1528          if (this.name == null)
1529            if (Configuration.errorOnAutoCreate())
1530              throw new Error("Attempt to auto-create StructureMapGroupComponent.name");
1531            else if (Configuration.doAutoCreate())
1532              this.name = new IdType(); // bb
1533          return this.name;
1534        }
1535
1536        public boolean hasNameElement() { 
1537          return this.name != null && !this.name.isEmpty();
1538        }
1539
1540        public boolean hasName() { 
1541          return this.name != null && !this.name.isEmpty();
1542        }
1543
1544        /**
1545         * @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
1546         */
1547        public StructureMapGroupComponent setNameElement(IdType value) { 
1548          this.name = value;
1549          return this;
1550        }
1551
1552        /**
1553         * @return A unique name for the group for the convenience of human readers.
1554         */
1555        public String getName() { 
1556          return this.name == null ? null : this.name.getValue();
1557        }
1558
1559        /**
1560         * @param value A unique name for the group for the convenience of human readers.
1561         */
1562        public StructureMapGroupComponent setName(String value) { 
1563            if (this.name == null)
1564              this.name = new IdType();
1565            this.name.setValue(value);
1566          return this;
1567        }
1568
1569        /**
1570         * @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
1571         */
1572        public IdType getExtendsElement() { 
1573          if (this.extends_ == null)
1574            if (Configuration.errorOnAutoCreate())
1575              throw new Error("Attempt to auto-create StructureMapGroupComponent.extends_");
1576            else if (Configuration.doAutoCreate())
1577              this.extends_ = new IdType(); // bb
1578          return this.extends_;
1579        }
1580
1581        public boolean hasExtendsElement() { 
1582          return this.extends_ != null && !this.extends_.isEmpty();
1583        }
1584
1585        public boolean hasExtends() { 
1586          return this.extends_ != null && !this.extends_.isEmpty();
1587        }
1588
1589        /**
1590         * @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
1591         */
1592        public StructureMapGroupComponent setExtendsElement(IdType value) { 
1593          this.extends_ = value;
1594          return this;
1595        }
1596
1597        /**
1598         * @return Another group that this group adds rules to.
1599         */
1600        public String getExtends() { 
1601          return this.extends_ == null ? null : this.extends_.getValue();
1602        }
1603
1604        /**
1605         * @param value Another group that this group adds rules to.
1606         */
1607        public StructureMapGroupComponent setExtends(String value) { 
1608          if (Utilities.noString(value))
1609            this.extends_ = null;
1610          else {
1611            if (this.extends_ == null)
1612              this.extends_ = new IdType();
1613            this.extends_.setValue(value);
1614          }
1615          return this;
1616        }
1617
1618        /**
1619         * @return {@link #typeMode} (If this is the default rule set to apply for the 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
1620         */
1621        public Enumeration<StructureMapGroupTypeMode> getTypeModeElement() { 
1622          if (this.typeMode == null)
1623            if (Configuration.errorOnAutoCreate())
1624              throw new Error("Attempt to auto-create StructureMapGroupComponent.typeMode");
1625            else if (Configuration.doAutoCreate())
1626              this.typeMode = new Enumeration<StructureMapGroupTypeMode>(new StructureMapGroupTypeModeEnumFactory()); // bb
1627          return this.typeMode;
1628        }
1629
1630        public boolean hasTypeModeElement() { 
1631          return this.typeMode != null && !this.typeMode.isEmpty();
1632        }
1633
1634        public boolean hasTypeMode() { 
1635          return this.typeMode != null && !this.typeMode.isEmpty();
1636        }
1637
1638        /**
1639         * @param value {@link #typeMode} (If this is the default rule set to apply for the 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
1640         */
1641        public StructureMapGroupComponent setTypeModeElement(Enumeration<StructureMapGroupTypeMode> value) { 
1642          this.typeMode = value;
1643          return this;
1644        }
1645
1646        /**
1647         * @return If this is the default rule set to apply for the source type or this combination of types.
1648         */
1649        public StructureMapGroupTypeMode getTypeMode() { 
1650          return this.typeMode == null ? null : this.typeMode.getValue();
1651        }
1652
1653        /**
1654         * @param value If this is the default rule set to apply for the source type or this combination of types.
1655         */
1656        public StructureMapGroupComponent setTypeMode(StructureMapGroupTypeMode value) { 
1657            if (this.typeMode == null)
1658              this.typeMode = new Enumeration<StructureMapGroupTypeMode>(new StructureMapGroupTypeModeEnumFactory());
1659            this.typeMode.setValue(value);
1660          return this;
1661        }
1662
1663        /**
1664         * @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
1665         */
1666        public StringType getDocumentationElement() { 
1667          if (this.documentation == null)
1668            if (Configuration.errorOnAutoCreate())
1669              throw new Error("Attempt to auto-create StructureMapGroupComponent.documentation");
1670            else if (Configuration.doAutoCreate())
1671              this.documentation = new StringType(); // bb
1672          return this.documentation;
1673        }
1674
1675        public boolean hasDocumentationElement() { 
1676          return this.documentation != null && !this.documentation.isEmpty();
1677        }
1678
1679        public boolean hasDocumentation() { 
1680          return this.documentation != null && !this.documentation.isEmpty();
1681        }
1682
1683        /**
1684         * @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
1685         */
1686        public StructureMapGroupComponent setDocumentationElement(StringType value) { 
1687          this.documentation = value;
1688          return this;
1689        }
1690
1691        /**
1692         * @return Additional supporting documentation that explains the purpose of the group and the types of mappings within it.
1693         */
1694        public String getDocumentation() { 
1695          return this.documentation == null ? null : this.documentation.getValue();
1696        }
1697
1698        /**
1699         * @param value Additional supporting documentation that explains the purpose of the group and the types of mappings within it.
1700         */
1701        public StructureMapGroupComponent setDocumentation(String value) { 
1702          if (Utilities.noString(value))
1703            this.documentation = null;
1704          else {
1705            if (this.documentation == null)
1706              this.documentation = new StringType();
1707            this.documentation.setValue(value);
1708          }
1709          return this;
1710        }
1711
1712        /**
1713         * @return {@link #input} (A name assigned to an instance of data. The instance must be provided when the mapping is invoked.)
1714         */
1715        public List<StructureMapGroupInputComponent> getInput() { 
1716          if (this.input == null)
1717            this.input = new ArrayList<StructureMapGroupInputComponent>();
1718          return this.input;
1719        }
1720
1721        /**
1722         * @return Returns a reference to <code>this</code> for easy method chaining
1723         */
1724        public StructureMapGroupComponent setInput(List<StructureMapGroupInputComponent> theInput) { 
1725          this.input = theInput;
1726          return this;
1727        }
1728
1729        public boolean hasInput() { 
1730          if (this.input == null)
1731            return false;
1732          for (StructureMapGroupInputComponent item : this.input)
1733            if (!item.isEmpty())
1734              return true;
1735          return false;
1736        }
1737
1738        public StructureMapGroupInputComponent addInput() { //3
1739          StructureMapGroupInputComponent t = new StructureMapGroupInputComponent();
1740          if (this.input == null)
1741            this.input = new ArrayList<StructureMapGroupInputComponent>();
1742          this.input.add(t);
1743          return t;
1744        }
1745
1746        public StructureMapGroupComponent addInput(StructureMapGroupInputComponent t) { //3
1747          if (t == null)
1748            return this;
1749          if (this.input == null)
1750            this.input = new ArrayList<StructureMapGroupInputComponent>();
1751          this.input.add(t);
1752          return this;
1753        }
1754
1755        /**
1756         * @return The first repetition of repeating field {@link #input}, creating it if it does not already exist
1757         */
1758        public StructureMapGroupInputComponent getInputFirstRep() { 
1759          if (getInput().isEmpty()) {
1760            addInput();
1761          }
1762          return getInput().get(0);
1763        }
1764
1765        /**
1766         * @return {@link #rule} (Transform Rule from source to target.)
1767         */
1768        public List<StructureMapGroupRuleComponent> getRule() { 
1769          if (this.rule == null)
1770            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
1771          return this.rule;
1772        }
1773
1774        /**
1775         * @return Returns a reference to <code>this</code> for easy method chaining
1776         */
1777        public StructureMapGroupComponent setRule(List<StructureMapGroupRuleComponent> theRule) { 
1778          this.rule = theRule;
1779          return this;
1780        }
1781
1782        public boolean hasRule() { 
1783          if (this.rule == null)
1784            return false;
1785          for (StructureMapGroupRuleComponent item : this.rule)
1786            if (!item.isEmpty())
1787              return true;
1788          return false;
1789        }
1790
1791        public StructureMapGroupRuleComponent addRule() { //3
1792          StructureMapGroupRuleComponent t = new StructureMapGroupRuleComponent();
1793          if (this.rule == null)
1794            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
1795          this.rule.add(t);
1796          return t;
1797        }
1798
1799        public StructureMapGroupComponent addRule(StructureMapGroupRuleComponent t) { //3
1800          if (t == null)
1801            return this;
1802          if (this.rule == null)
1803            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
1804          this.rule.add(t);
1805          return this;
1806        }
1807
1808        /**
1809         * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist
1810         */
1811        public StructureMapGroupRuleComponent getRuleFirstRep() { 
1812          if (getRule().isEmpty()) {
1813            addRule();
1814          }
1815          return getRule().get(0);
1816        }
1817
1818        protected void listChildren(List<Property> children) {
1819          super.listChildren(children);
1820          children.add(new Property("name", "id", "A unique name for the group for the convenience of human readers.", 0, 1, name));
1821          children.add(new Property("extends", "id", "Another group that this group adds rules to.", 0, 1, extends_));
1822          children.add(new Property("typeMode", "code", "If this is the default rule set to apply for the source type or this combination of types.", 0, 1, typeMode));
1823          children.add(new Property("documentation", "string", "Additional supporting documentation that explains the purpose of the group and the types of mappings within it.", 0, 1, documentation));
1824          children.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));
1825          children.add(new Property("rule", "", "Transform Rule from source to target.", 0, java.lang.Integer.MAX_VALUE, rule));
1826        }
1827
1828        @Override
1829        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1830          switch (_hash) {
1831          case 3373707: /*name*/  return new Property("name", "id", "A unique name for the group for the convenience of human readers.", 0, 1, name);
1832          case -1305664359: /*extends*/  return new Property("extends", "id", "Another group that this group adds rules to.", 0, 1, extends_);
1833          case -676524035: /*typeMode*/  return new Property("typeMode", "code", "If this is the default rule set to apply for the source type or this combination of types.", 0, 1, typeMode);
1834          case 1587405498: /*documentation*/  return new Property("documentation", "string", "Additional supporting documentation that explains the purpose of the group and the types of mappings within it.", 0, 1, documentation);
1835          case 100358090: /*input*/  return 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);
1836          case 3512060: /*rule*/  return new Property("rule", "", "Transform Rule from source to target.", 0, java.lang.Integer.MAX_VALUE, rule);
1837          default: return super.getNamedProperty(_hash, _name, _checkValid);
1838          }
1839
1840        }
1841
1842      @Override
1843      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1844        switch (hash) {
1845        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
1846        case -1305664359: /*extends*/ return this.extends_ == null ? new Base[0] : new Base[] {this.extends_}; // IdType
1847        case -676524035: /*typeMode*/ return this.typeMode == null ? new Base[0] : new Base[] {this.typeMode}; // Enumeration<StructureMapGroupTypeMode>
1848        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
1849        case 100358090: /*input*/ return this.input == null ? new Base[0] : this.input.toArray(new Base[this.input.size()]); // StructureMapGroupInputComponent
1850        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // StructureMapGroupRuleComponent
1851        default: return super.getProperty(hash, name, checkValid);
1852        }
1853
1854      }
1855
1856      @Override
1857      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1858        switch (hash) {
1859        case 3373707: // name
1860          this.name = castToId(value); // IdType
1861          return value;
1862        case -1305664359: // extends
1863          this.extends_ = castToId(value); // IdType
1864          return value;
1865        case -676524035: // typeMode
1866          value = new StructureMapGroupTypeModeEnumFactory().fromType(castToCode(value));
1867          this.typeMode = (Enumeration) value; // Enumeration<StructureMapGroupTypeMode>
1868          return value;
1869        case 1587405498: // documentation
1870          this.documentation = castToString(value); // StringType
1871          return value;
1872        case 100358090: // input
1873          this.getInput().add((StructureMapGroupInputComponent) value); // StructureMapGroupInputComponent
1874          return value;
1875        case 3512060: // rule
1876          this.getRule().add((StructureMapGroupRuleComponent) value); // StructureMapGroupRuleComponent
1877          return value;
1878        default: return super.setProperty(hash, name, value);
1879        }
1880
1881      }
1882
1883      @Override
1884      public Base setProperty(String name, Base value) throws FHIRException {
1885        if (name.equals("name")) {
1886          this.name = castToId(value); // IdType
1887        } else if (name.equals("extends")) {
1888          this.extends_ = castToId(value); // IdType
1889        } else if (name.equals("typeMode")) {
1890          value = new StructureMapGroupTypeModeEnumFactory().fromType(castToCode(value));
1891          this.typeMode = (Enumeration) value; // Enumeration<StructureMapGroupTypeMode>
1892        } else if (name.equals("documentation")) {
1893          this.documentation = castToString(value); // StringType
1894        } else if (name.equals("input")) {
1895          this.getInput().add((StructureMapGroupInputComponent) value);
1896        } else if (name.equals("rule")) {
1897          this.getRule().add((StructureMapGroupRuleComponent) value);
1898        } else
1899          return super.setProperty(name, value);
1900        return value;
1901      }
1902
1903      @Override
1904      public Base makeProperty(int hash, String name) throws FHIRException {
1905        switch (hash) {
1906        case 3373707:  return getNameElement();
1907        case -1305664359:  return getExtendsElement();
1908        case -676524035:  return getTypeModeElement();
1909        case 1587405498:  return getDocumentationElement();
1910        case 100358090:  return addInput(); 
1911        case 3512060:  return addRule(); 
1912        default: return super.makeProperty(hash, name);
1913        }
1914
1915      }
1916
1917      @Override
1918      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1919        switch (hash) {
1920        case 3373707: /*name*/ return new String[] {"id"};
1921        case -1305664359: /*extends*/ return new String[] {"id"};
1922        case -676524035: /*typeMode*/ return new String[] {"code"};
1923        case 1587405498: /*documentation*/ return new String[] {"string"};
1924        case 100358090: /*input*/ return new String[] {};
1925        case 3512060: /*rule*/ return new String[] {};
1926        default: return super.getTypesForProperty(hash, name);
1927        }
1928
1929      }
1930
1931      @Override
1932      public Base addChild(String name) throws FHIRException {
1933        if (name.equals("name")) {
1934          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
1935        }
1936        else if (name.equals("extends")) {
1937          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.extends");
1938        }
1939        else if (name.equals("typeMode")) {
1940          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.typeMode");
1941        }
1942        else if (name.equals("documentation")) {
1943          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
1944        }
1945        else if (name.equals("input")) {
1946          return addInput();
1947        }
1948        else if (name.equals("rule")) {
1949          return addRule();
1950        }
1951        else
1952          return super.addChild(name);
1953      }
1954
1955      public StructureMapGroupComponent copy() {
1956        StructureMapGroupComponent dst = new StructureMapGroupComponent();
1957        copyValues(dst);
1958        dst.name = name == null ? null : name.copy();
1959        dst.extends_ = extends_ == null ? null : extends_.copy();
1960        dst.typeMode = typeMode == null ? null : typeMode.copy();
1961        dst.documentation = documentation == null ? null : documentation.copy();
1962        if (input != null) {
1963          dst.input = new ArrayList<StructureMapGroupInputComponent>();
1964          for (StructureMapGroupInputComponent i : input)
1965            dst.input.add(i.copy());
1966        };
1967        if (rule != null) {
1968          dst.rule = new ArrayList<StructureMapGroupRuleComponent>();
1969          for (StructureMapGroupRuleComponent i : rule)
1970            dst.rule.add(i.copy());
1971        };
1972        return dst;
1973      }
1974
1975      @Override
1976      public boolean equalsDeep(Base other_) {
1977        if (!super.equalsDeep(other_))
1978          return false;
1979        if (!(other_ instanceof StructureMapGroupComponent))
1980          return false;
1981        StructureMapGroupComponent o = (StructureMapGroupComponent) other_;
1982        return compareDeep(name, o.name, true) && compareDeep(extends_, o.extends_, true) && compareDeep(typeMode, o.typeMode, true)
1983           && compareDeep(documentation, o.documentation, true) && compareDeep(input, o.input, true) && compareDeep(rule, o.rule, true)
1984          ;
1985      }
1986
1987      @Override
1988      public boolean equalsShallow(Base other_) {
1989        if (!super.equalsShallow(other_))
1990          return false;
1991        if (!(other_ instanceof StructureMapGroupComponent))
1992          return false;
1993        StructureMapGroupComponent o = (StructureMapGroupComponent) other_;
1994        return compareValues(name, o.name, true) && compareValues(extends_, o.extends_, true) && compareValues(typeMode, o.typeMode, true)
1995           && compareValues(documentation, o.documentation, true);
1996      }
1997
1998      public boolean isEmpty() {
1999        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, extends_, typeMode
2000          , documentation, input, rule);
2001      }
2002
2003  public String fhirType() {
2004    return "StructureMap.group";
2005
2006  }
2007
2008// added from java-adornments.txt:
2009
2010  public String toString() {
2011    return StructureMapUtilities.groupToString(this);
2012  }
2013
2014
2015// end addition
2016  }
2017
2018    @Block()
2019    public static class StructureMapGroupInputComponent extends BackboneElement implements IBaseBackboneElement {
2020        /**
2021         * Name for this instance of data.
2022         */
2023        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2024        @Description(shortDefinition="Name for this instance of data", formalDefinition="Name for this instance of data." )
2025        protected IdType name;
2026
2027        /**
2028         * Type for this instance of data.
2029         */
2030        @Child(name = "type", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2031        @Description(shortDefinition="Type for this instance of data", formalDefinition="Type for this instance of data." )
2032        protected StringType type;
2033
2034        /**
2035         * Mode for this instance of data.
2036         */
2037        @Child(name = "mode", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
2038        @Description(shortDefinition="source | target", formalDefinition="Mode for this instance of data." )
2039        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-input-mode")
2040        protected Enumeration<StructureMapInputMode> mode;
2041
2042        /**
2043         * Documentation for this instance of data.
2044         */
2045        @Child(name = "documentation", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
2046        @Description(shortDefinition="Documentation for this instance of data", formalDefinition="Documentation for this instance of data." )
2047        protected StringType documentation;
2048
2049        private static final long serialVersionUID = -25050724L;
2050
2051    /**
2052     * Constructor
2053     */
2054      public StructureMapGroupInputComponent() {
2055        super();
2056      }
2057
2058    /**
2059     * Constructor
2060     */
2061      public StructureMapGroupInputComponent(IdType name, Enumeration<StructureMapInputMode> mode) {
2062        super();
2063        this.name = name;
2064        this.mode = mode;
2065      }
2066
2067        /**
2068         * @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
2069         */
2070        public IdType getNameElement() { 
2071          if (this.name == null)
2072            if (Configuration.errorOnAutoCreate())
2073              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.name");
2074            else if (Configuration.doAutoCreate())
2075              this.name = new IdType(); // bb
2076          return this.name;
2077        }
2078
2079        public boolean hasNameElement() { 
2080          return this.name != null && !this.name.isEmpty();
2081        }
2082
2083        public boolean hasName() { 
2084          return this.name != null && !this.name.isEmpty();
2085        }
2086
2087        /**
2088         * @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
2089         */
2090        public StructureMapGroupInputComponent setNameElement(IdType value) { 
2091          this.name = value;
2092          return this;
2093        }
2094
2095        /**
2096         * @return Name for this instance of data.
2097         */
2098        public String getName() { 
2099          return this.name == null ? null : this.name.getValue();
2100        }
2101
2102        /**
2103         * @param value Name for this instance of data.
2104         */
2105        public StructureMapGroupInputComponent setName(String value) { 
2106            if (this.name == null)
2107              this.name = new IdType();
2108            this.name.setValue(value);
2109          return this;
2110        }
2111
2112        /**
2113         * @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
2114         */
2115        public StringType getTypeElement() { 
2116          if (this.type == null)
2117            if (Configuration.errorOnAutoCreate())
2118              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.type");
2119            else if (Configuration.doAutoCreate())
2120              this.type = new StringType(); // bb
2121          return this.type;
2122        }
2123
2124        public boolean hasTypeElement() { 
2125          return this.type != null && !this.type.isEmpty();
2126        }
2127
2128        public boolean hasType() { 
2129          return this.type != null && !this.type.isEmpty();
2130        }
2131
2132        /**
2133         * @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
2134         */
2135        public StructureMapGroupInputComponent setTypeElement(StringType value) { 
2136          this.type = value;
2137          return this;
2138        }
2139
2140        /**
2141         * @return Type for this instance of data.
2142         */
2143        public String getType() { 
2144          return this.type == null ? null : this.type.getValue();
2145        }
2146
2147        /**
2148         * @param value Type for this instance of data.
2149         */
2150        public StructureMapGroupInputComponent setType(String value) { 
2151          if (Utilities.noString(value))
2152            this.type = null;
2153          else {
2154            if (this.type == null)
2155              this.type = new StringType();
2156            this.type.setValue(value);
2157          }
2158          return this;
2159        }
2160
2161        /**
2162         * @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
2163         */
2164        public Enumeration<StructureMapInputMode> getModeElement() { 
2165          if (this.mode == null)
2166            if (Configuration.errorOnAutoCreate())
2167              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.mode");
2168            else if (Configuration.doAutoCreate())
2169              this.mode = new Enumeration<StructureMapInputMode>(new StructureMapInputModeEnumFactory()); // bb
2170          return this.mode;
2171        }
2172
2173        public boolean hasModeElement() { 
2174          return this.mode != null && !this.mode.isEmpty();
2175        }
2176
2177        public boolean hasMode() { 
2178          return this.mode != null && !this.mode.isEmpty();
2179        }
2180
2181        /**
2182         * @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
2183         */
2184        public StructureMapGroupInputComponent setModeElement(Enumeration<StructureMapInputMode> value) { 
2185          this.mode = value;
2186          return this;
2187        }
2188
2189        /**
2190         * @return Mode for this instance of data.
2191         */
2192        public StructureMapInputMode getMode() { 
2193          return this.mode == null ? null : this.mode.getValue();
2194        }
2195
2196        /**
2197         * @param value Mode for this instance of data.
2198         */
2199        public StructureMapGroupInputComponent setMode(StructureMapInputMode value) { 
2200            if (this.mode == null)
2201              this.mode = new Enumeration<StructureMapInputMode>(new StructureMapInputModeEnumFactory());
2202            this.mode.setValue(value);
2203          return this;
2204        }
2205
2206        /**
2207         * @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
2208         */
2209        public StringType getDocumentationElement() { 
2210          if (this.documentation == null)
2211            if (Configuration.errorOnAutoCreate())
2212              throw new Error("Attempt to auto-create StructureMapGroupInputComponent.documentation");
2213            else if (Configuration.doAutoCreate())
2214              this.documentation = new StringType(); // bb
2215          return this.documentation;
2216        }
2217
2218        public boolean hasDocumentationElement() { 
2219          return this.documentation != null && !this.documentation.isEmpty();
2220        }
2221
2222        public boolean hasDocumentation() { 
2223          return this.documentation != null && !this.documentation.isEmpty();
2224        }
2225
2226        /**
2227         * @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
2228         */
2229        public StructureMapGroupInputComponent setDocumentationElement(StringType value) { 
2230          this.documentation = value;
2231          return this;
2232        }
2233
2234        /**
2235         * @return Documentation for this instance of data.
2236         */
2237        public String getDocumentation() { 
2238          return this.documentation == null ? null : this.documentation.getValue();
2239        }
2240
2241        /**
2242         * @param value Documentation for this instance of data.
2243         */
2244        public StructureMapGroupInputComponent setDocumentation(String value) { 
2245          if (Utilities.noString(value))
2246            this.documentation = null;
2247          else {
2248            if (this.documentation == null)
2249              this.documentation = new StringType();
2250            this.documentation.setValue(value);
2251          }
2252          return this;
2253        }
2254
2255        protected void listChildren(List<Property> children) {
2256          super.listChildren(children);
2257          children.add(new Property("name", "id", "Name for this instance of data.", 0, 1, name));
2258          children.add(new Property("type", "string", "Type for this instance of data.", 0, 1, type));
2259          children.add(new Property("mode", "code", "Mode for this instance of data.", 0, 1, mode));
2260          children.add(new Property("documentation", "string", "Documentation for this instance of data.", 0, 1, documentation));
2261        }
2262
2263        @Override
2264        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2265          switch (_hash) {
2266          case 3373707: /*name*/  return new Property("name", "id", "Name for this instance of data.", 0, 1, name);
2267          case 3575610: /*type*/  return new Property("type", "string", "Type for this instance of data.", 0, 1, type);
2268          case 3357091: /*mode*/  return new Property("mode", "code", "Mode for this instance of data.", 0, 1, mode);
2269          case 1587405498: /*documentation*/  return new Property("documentation", "string", "Documentation for this instance of data.", 0, 1, documentation);
2270          default: return super.getNamedProperty(_hash, _name, _checkValid);
2271          }
2272
2273        }
2274
2275      @Override
2276      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2277        switch (hash) {
2278        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
2279        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // StringType
2280        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<StructureMapInputMode>
2281        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
2282        default: return super.getProperty(hash, name, checkValid);
2283        }
2284
2285      }
2286
2287      @Override
2288      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2289        switch (hash) {
2290        case 3373707: // name
2291          this.name = castToId(value); // IdType
2292          return value;
2293        case 3575610: // type
2294          this.type = castToString(value); // StringType
2295          return value;
2296        case 3357091: // mode
2297          value = new StructureMapInputModeEnumFactory().fromType(castToCode(value));
2298          this.mode = (Enumeration) value; // Enumeration<StructureMapInputMode>
2299          return value;
2300        case 1587405498: // documentation
2301          this.documentation = castToString(value); // StringType
2302          return value;
2303        default: return super.setProperty(hash, name, value);
2304        }
2305
2306      }
2307
2308      @Override
2309      public Base setProperty(String name, Base value) throws FHIRException {
2310        if (name.equals("name")) {
2311          this.name = castToId(value); // IdType
2312        } else if (name.equals("type")) {
2313          this.type = castToString(value); // StringType
2314        } else if (name.equals("mode")) {
2315          value = new StructureMapInputModeEnumFactory().fromType(castToCode(value));
2316          this.mode = (Enumeration) value; // Enumeration<StructureMapInputMode>
2317        } else if (name.equals("documentation")) {
2318          this.documentation = castToString(value); // StringType
2319        } else
2320          return super.setProperty(name, value);
2321        return value;
2322      }
2323
2324      @Override
2325      public Base makeProperty(int hash, String name) throws FHIRException {
2326        switch (hash) {
2327        case 3373707:  return getNameElement();
2328        case 3575610:  return getTypeElement();
2329        case 3357091:  return getModeElement();
2330        case 1587405498:  return getDocumentationElement();
2331        default: return super.makeProperty(hash, name);
2332        }
2333
2334      }
2335
2336      @Override
2337      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2338        switch (hash) {
2339        case 3373707: /*name*/ return new String[] {"id"};
2340        case 3575610: /*type*/ return new String[] {"string"};
2341        case 3357091: /*mode*/ return new String[] {"code"};
2342        case 1587405498: /*documentation*/ return new String[] {"string"};
2343        default: return super.getTypesForProperty(hash, name);
2344        }
2345
2346      }
2347
2348      @Override
2349      public Base addChild(String name) throws FHIRException {
2350        if (name.equals("name")) {
2351          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
2352        }
2353        else if (name.equals("type")) {
2354          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.type");
2355        }
2356        else if (name.equals("mode")) {
2357          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.mode");
2358        }
2359        else if (name.equals("documentation")) {
2360          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
2361        }
2362        else
2363          return super.addChild(name);
2364      }
2365
2366      public StructureMapGroupInputComponent copy() {
2367        StructureMapGroupInputComponent dst = new StructureMapGroupInputComponent();
2368        copyValues(dst);
2369        dst.name = name == null ? null : name.copy();
2370        dst.type = type == null ? null : type.copy();
2371        dst.mode = mode == null ? null : mode.copy();
2372        dst.documentation = documentation == null ? null : documentation.copy();
2373        return dst;
2374      }
2375
2376      @Override
2377      public boolean equalsDeep(Base other_) {
2378        if (!super.equalsDeep(other_))
2379          return false;
2380        if (!(other_ instanceof StructureMapGroupInputComponent))
2381          return false;
2382        StructureMapGroupInputComponent o = (StructureMapGroupInputComponent) other_;
2383        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true) && compareDeep(mode, o.mode, true)
2384           && compareDeep(documentation, o.documentation, true);
2385      }
2386
2387      @Override
2388      public boolean equalsShallow(Base other_) {
2389        if (!super.equalsShallow(other_))
2390          return false;
2391        if (!(other_ instanceof StructureMapGroupInputComponent))
2392          return false;
2393        StructureMapGroupInputComponent o = (StructureMapGroupInputComponent) other_;
2394        return compareValues(name, o.name, true) && compareValues(type, o.type, true) && compareValues(mode, o.mode, true)
2395           && compareValues(documentation, o.documentation, true);
2396      }
2397
2398      public boolean isEmpty() {
2399        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type, mode, documentation
2400          );
2401      }
2402
2403  public String fhirType() {
2404    return "StructureMap.group.input";
2405
2406  }
2407
2408  }
2409
2410    @Block()
2411    public static class StructureMapGroupRuleComponent extends BackboneElement implements IBaseBackboneElement {
2412        /**
2413         * Name of the rule for internal references.
2414         */
2415        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2416        @Description(shortDefinition="Name of the rule for internal references", formalDefinition="Name of the rule for internal references." )
2417        protected IdType name;
2418
2419        /**
2420         * Source inputs to the mapping.
2421         */
2422        @Child(name = "source", type = {}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2423        @Description(shortDefinition="Source inputs to the mapping", formalDefinition="Source inputs to the mapping." )
2424        protected List<StructureMapGroupRuleSourceComponent> source;
2425
2426        /**
2427         * Content to create because of this mapping rule.
2428         */
2429        @Child(name = "target", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2430        @Description(shortDefinition="Content to create because of this mapping rule", formalDefinition="Content to create because of this mapping rule." )
2431        protected List<StructureMapGroupRuleTargetComponent> target;
2432
2433        /**
2434         * Rules contained in this rule.
2435         */
2436        @Child(name = "rule", type = {StructureMapGroupRuleComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2437        @Description(shortDefinition="Rules contained in this rule", formalDefinition="Rules contained in this rule." )
2438        protected List<StructureMapGroupRuleComponent> rule;
2439
2440        /**
2441         * Which other rules to apply in the context of this rule.
2442         */
2443        @Child(name = "dependent", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2444        @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." )
2445        protected List<StructureMapGroupRuleDependentComponent> dependent;
2446
2447        /**
2448         * Documentation for this instance of data.
2449         */
2450        @Child(name = "documentation", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
2451        @Description(shortDefinition="Documentation for this instance of data", formalDefinition="Documentation for this instance of data." )
2452        protected StringType documentation;
2453
2454        private static final long serialVersionUID = 773925517L;
2455
2456    /**
2457     * Constructor
2458     */
2459      public StructureMapGroupRuleComponent() {
2460        super();
2461      }
2462
2463    /**
2464     * Constructor
2465     */
2466      public StructureMapGroupRuleComponent(IdType name) {
2467        super();
2468        this.name = name;
2469      }
2470
2471        /**
2472         * @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
2473         */
2474        public IdType getNameElement() { 
2475          if (this.name == null)
2476            if (Configuration.errorOnAutoCreate())
2477              throw new Error("Attempt to auto-create StructureMapGroupRuleComponent.name");
2478            else if (Configuration.doAutoCreate())
2479              this.name = new IdType(); // bb
2480          return this.name;
2481        }
2482
2483        public boolean hasNameElement() { 
2484          return this.name != null && !this.name.isEmpty();
2485        }
2486
2487        public boolean hasName() { 
2488          return this.name != null && !this.name.isEmpty();
2489        }
2490
2491        /**
2492         * @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
2493         */
2494        public StructureMapGroupRuleComponent setNameElement(IdType value) { 
2495          this.name = value;
2496          return this;
2497        }
2498
2499        /**
2500         * @return Name of the rule for internal references.
2501         */
2502        public String getName() { 
2503          return this.name == null ? null : this.name.getValue();
2504        }
2505
2506        /**
2507         * @param value Name of the rule for internal references.
2508         */
2509        public StructureMapGroupRuleComponent setName(String value) { 
2510            if (this.name == null)
2511              this.name = new IdType();
2512            this.name.setValue(value);
2513          return this;
2514        }
2515
2516        /**
2517         * @return {@link #source} (Source inputs to the mapping.)
2518         */
2519        public List<StructureMapGroupRuleSourceComponent> getSource() { 
2520          if (this.source == null)
2521            this.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2522          return this.source;
2523        }
2524
2525        /**
2526         * @return Returns a reference to <code>this</code> for easy method chaining
2527         */
2528        public StructureMapGroupRuleComponent setSource(List<StructureMapGroupRuleSourceComponent> theSource) { 
2529          this.source = theSource;
2530          return this;
2531        }
2532
2533        public boolean hasSource() { 
2534          if (this.source == null)
2535            return false;
2536          for (StructureMapGroupRuleSourceComponent item : this.source)
2537            if (!item.isEmpty())
2538              return true;
2539          return false;
2540        }
2541
2542        public StructureMapGroupRuleSourceComponent addSource() { //3
2543          StructureMapGroupRuleSourceComponent t = new StructureMapGroupRuleSourceComponent();
2544          if (this.source == null)
2545            this.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2546          this.source.add(t);
2547          return t;
2548        }
2549
2550        public StructureMapGroupRuleComponent addSource(StructureMapGroupRuleSourceComponent t) { //3
2551          if (t == null)
2552            return this;
2553          if (this.source == null)
2554            this.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2555          this.source.add(t);
2556          return this;
2557        }
2558
2559        /**
2560         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
2561         */
2562        public StructureMapGroupRuleSourceComponent getSourceFirstRep() { 
2563          if (getSource().isEmpty()) {
2564            addSource();
2565          }
2566          return getSource().get(0);
2567        }
2568
2569        /**
2570         * @return {@link #target} (Content to create because of this mapping rule.)
2571         */
2572        public List<StructureMapGroupRuleTargetComponent> getTarget() { 
2573          if (this.target == null)
2574            this.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2575          return this.target;
2576        }
2577
2578        /**
2579         * @return Returns a reference to <code>this</code> for easy method chaining
2580         */
2581        public StructureMapGroupRuleComponent setTarget(List<StructureMapGroupRuleTargetComponent> theTarget) { 
2582          this.target = theTarget;
2583          return this;
2584        }
2585
2586        public boolean hasTarget() { 
2587          if (this.target == null)
2588            return false;
2589          for (StructureMapGroupRuleTargetComponent item : this.target)
2590            if (!item.isEmpty())
2591              return true;
2592          return false;
2593        }
2594
2595        public StructureMapGroupRuleTargetComponent addTarget() { //3
2596          StructureMapGroupRuleTargetComponent t = new StructureMapGroupRuleTargetComponent();
2597          if (this.target == null)
2598            this.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2599          this.target.add(t);
2600          return t;
2601        }
2602
2603        public StructureMapGroupRuleComponent addTarget(StructureMapGroupRuleTargetComponent t) { //3
2604          if (t == null)
2605            return this;
2606          if (this.target == null)
2607            this.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2608          this.target.add(t);
2609          return this;
2610        }
2611
2612        /**
2613         * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist
2614         */
2615        public StructureMapGroupRuleTargetComponent getTargetFirstRep() { 
2616          if (getTarget().isEmpty()) {
2617            addTarget();
2618          }
2619          return getTarget().get(0);
2620        }
2621
2622        /**
2623         * @return {@link #rule} (Rules contained in this rule.)
2624         */
2625        public List<StructureMapGroupRuleComponent> getRule() { 
2626          if (this.rule == null)
2627            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
2628          return this.rule;
2629        }
2630
2631        /**
2632         * @return Returns a reference to <code>this</code> for easy method chaining
2633         */
2634        public StructureMapGroupRuleComponent setRule(List<StructureMapGroupRuleComponent> theRule) { 
2635          this.rule = theRule;
2636          return this;
2637        }
2638
2639        public boolean hasRule() { 
2640          if (this.rule == null)
2641            return false;
2642          for (StructureMapGroupRuleComponent item : this.rule)
2643            if (!item.isEmpty())
2644              return true;
2645          return false;
2646        }
2647
2648        public StructureMapGroupRuleComponent addRule() { //3
2649          StructureMapGroupRuleComponent t = new StructureMapGroupRuleComponent();
2650          if (this.rule == null)
2651            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
2652          this.rule.add(t);
2653          return t;
2654        }
2655
2656        public StructureMapGroupRuleComponent addRule(StructureMapGroupRuleComponent t) { //3
2657          if (t == null)
2658            return this;
2659          if (this.rule == null)
2660            this.rule = new ArrayList<StructureMapGroupRuleComponent>();
2661          this.rule.add(t);
2662          return this;
2663        }
2664
2665        /**
2666         * @return The first repetition of repeating field {@link #rule}, creating it if it does not already exist
2667         */
2668        public StructureMapGroupRuleComponent getRuleFirstRep() { 
2669          if (getRule().isEmpty()) {
2670            addRule();
2671          }
2672          return getRule().get(0);
2673        }
2674
2675        /**
2676         * @return {@link #dependent} (Which other rules to apply in the context of this rule.)
2677         */
2678        public List<StructureMapGroupRuleDependentComponent> getDependent() { 
2679          if (this.dependent == null)
2680            this.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2681          return this.dependent;
2682        }
2683
2684        /**
2685         * @return Returns a reference to <code>this</code> for easy method chaining
2686         */
2687        public StructureMapGroupRuleComponent setDependent(List<StructureMapGroupRuleDependentComponent> theDependent) { 
2688          this.dependent = theDependent;
2689          return this;
2690        }
2691
2692        public boolean hasDependent() { 
2693          if (this.dependent == null)
2694            return false;
2695          for (StructureMapGroupRuleDependentComponent item : this.dependent)
2696            if (!item.isEmpty())
2697              return true;
2698          return false;
2699        }
2700
2701        public StructureMapGroupRuleDependentComponent addDependent() { //3
2702          StructureMapGroupRuleDependentComponent t = new StructureMapGroupRuleDependentComponent();
2703          if (this.dependent == null)
2704            this.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2705          this.dependent.add(t);
2706          return t;
2707        }
2708
2709        public StructureMapGroupRuleComponent addDependent(StructureMapGroupRuleDependentComponent t) { //3
2710          if (t == null)
2711            return this;
2712          if (this.dependent == null)
2713            this.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2714          this.dependent.add(t);
2715          return this;
2716        }
2717
2718        /**
2719         * @return The first repetition of repeating field {@link #dependent}, creating it if it does not already exist
2720         */
2721        public StructureMapGroupRuleDependentComponent getDependentFirstRep() { 
2722          if (getDependent().isEmpty()) {
2723            addDependent();
2724          }
2725          return getDependent().get(0);
2726        }
2727
2728        /**
2729         * @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
2730         */
2731        public StringType getDocumentationElement() { 
2732          if (this.documentation == null)
2733            if (Configuration.errorOnAutoCreate())
2734              throw new Error("Attempt to auto-create StructureMapGroupRuleComponent.documentation");
2735            else if (Configuration.doAutoCreate())
2736              this.documentation = new StringType(); // bb
2737          return this.documentation;
2738        }
2739
2740        public boolean hasDocumentationElement() { 
2741          return this.documentation != null && !this.documentation.isEmpty();
2742        }
2743
2744        public boolean hasDocumentation() { 
2745          return this.documentation != null && !this.documentation.isEmpty();
2746        }
2747
2748        /**
2749         * @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
2750         */
2751        public StructureMapGroupRuleComponent setDocumentationElement(StringType value) { 
2752          this.documentation = value;
2753          return this;
2754        }
2755
2756        /**
2757         * @return Documentation for this instance of data.
2758         */
2759        public String getDocumentation() { 
2760          return this.documentation == null ? null : this.documentation.getValue();
2761        }
2762
2763        /**
2764         * @param value Documentation for this instance of data.
2765         */
2766        public StructureMapGroupRuleComponent setDocumentation(String value) { 
2767          if (Utilities.noString(value))
2768            this.documentation = null;
2769          else {
2770            if (this.documentation == null)
2771              this.documentation = new StringType();
2772            this.documentation.setValue(value);
2773          }
2774          return this;
2775        }
2776
2777        protected void listChildren(List<Property> children) {
2778          super.listChildren(children);
2779          children.add(new Property("name", "id", "Name of the rule for internal references.", 0, 1, name));
2780          children.add(new Property("source", "", "Source inputs to the mapping.", 0, java.lang.Integer.MAX_VALUE, source));
2781          children.add(new Property("target", "", "Content to create because of this mapping rule.", 0, java.lang.Integer.MAX_VALUE, target));
2782          children.add(new Property("rule", "@StructureMap.group.rule", "Rules contained in this rule.", 0, java.lang.Integer.MAX_VALUE, rule));
2783          children.add(new Property("dependent", "", "Which other rules to apply in the context of this rule.", 0, java.lang.Integer.MAX_VALUE, dependent));
2784          children.add(new Property("documentation", "string", "Documentation for this instance of data.", 0, 1, documentation));
2785        }
2786
2787        @Override
2788        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2789          switch (_hash) {
2790          case 3373707: /*name*/  return new Property("name", "id", "Name of the rule for internal references.", 0, 1, name);
2791          case -896505829: /*source*/  return new Property("source", "", "Source inputs to the mapping.", 0, java.lang.Integer.MAX_VALUE, source);
2792          case -880905839: /*target*/  return new Property("target", "", "Content to create because of this mapping rule.", 0, java.lang.Integer.MAX_VALUE, target);
2793          case 3512060: /*rule*/  return new Property("rule", "@StructureMap.group.rule", "Rules contained in this rule.", 0, java.lang.Integer.MAX_VALUE, rule);
2794          case -1109226753: /*dependent*/  return new Property("dependent", "", "Which other rules to apply in the context of this rule.", 0, java.lang.Integer.MAX_VALUE, dependent);
2795          case 1587405498: /*documentation*/  return new Property("documentation", "string", "Documentation for this instance of data.", 0, 1, documentation);
2796          default: return super.getNamedProperty(_hash, _name, _checkValid);
2797          }
2798
2799        }
2800
2801      @Override
2802      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2803        switch (hash) {
2804        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
2805        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // StructureMapGroupRuleSourceComponent
2806        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // StructureMapGroupRuleTargetComponent
2807        case 3512060: /*rule*/ return this.rule == null ? new Base[0] : this.rule.toArray(new Base[this.rule.size()]); // StructureMapGroupRuleComponent
2808        case -1109226753: /*dependent*/ return this.dependent == null ? new Base[0] : this.dependent.toArray(new Base[this.dependent.size()]); // StructureMapGroupRuleDependentComponent
2809        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
2810        default: return super.getProperty(hash, name, checkValid);
2811        }
2812
2813      }
2814
2815      @Override
2816      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2817        switch (hash) {
2818        case 3373707: // name
2819          this.name = castToId(value); // IdType
2820          return value;
2821        case -896505829: // source
2822          this.getSource().add((StructureMapGroupRuleSourceComponent) value); // StructureMapGroupRuleSourceComponent
2823          return value;
2824        case -880905839: // target
2825          this.getTarget().add((StructureMapGroupRuleTargetComponent) value); // StructureMapGroupRuleTargetComponent
2826          return value;
2827        case 3512060: // rule
2828          this.getRule().add((StructureMapGroupRuleComponent) value); // StructureMapGroupRuleComponent
2829          return value;
2830        case -1109226753: // dependent
2831          this.getDependent().add((StructureMapGroupRuleDependentComponent) value); // StructureMapGroupRuleDependentComponent
2832          return value;
2833        case 1587405498: // documentation
2834          this.documentation = castToString(value); // StringType
2835          return value;
2836        default: return super.setProperty(hash, name, value);
2837        }
2838
2839      }
2840
2841      @Override
2842      public Base setProperty(String name, Base value) throws FHIRException {
2843        if (name.equals("name")) {
2844          this.name = castToId(value); // IdType
2845        } else if (name.equals("source")) {
2846          this.getSource().add((StructureMapGroupRuleSourceComponent) value);
2847        } else if (name.equals("target")) {
2848          this.getTarget().add((StructureMapGroupRuleTargetComponent) value);
2849        } else if (name.equals("rule")) {
2850          this.getRule().add((StructureMapGroupRuleComponent) value);
2851        } else if (name.equals("dependent")) {
2852          this.getDependent().add((StructureMapGroupRuleDependentComponent) value);
2853        } else if (name.equals("documentation")) {
2854          this.documentation = castToString(value); // StringType
2855        } else
2856          return super.setProperty(name, value);
2857        return value;
2858      }
2859
2860      @Override
2861      public Base makeProperty(int hash, String name) throws FHIRException {
2862        switch (hash) {
2863        case 3373707:  return getNameElement();
2864        case -896505829:  return addSource(); 
2865        case -880905839:  return addTarget(); 
2866        case 3512060:  return addRule(); 
2867        case -1109226753:  return addDependent(); 
2868        case 1587405498:  return getDocumentationElement();
2869        default: return super.makeProperty(hash, name);
2870        }
2871
2872      }
2873
2874      @Override
2875      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2876        switch (hash) {
2877        case 3373707: /*name*/ return new String[] {"id"};
2878        case -896505829: /*source*/ return new String[] {};
2879        case -880905839: /*target*/ return new String[] {};
2880        case 3512060: /*rule*/ return new String[] {"@StructureMap.group.rule"};
2881        case -1109226753: /*dependent*/ return new String[] {};
2882        case 1587405498: /*documentation*/ return new String[] {"string"};
2883        default: return super.getTypesForProperty(hash, name);
2884        }
2885
2886      }
2887
2888      @Override
2889      public Base addChild(String name) throws FHIRException {
2890        if (name.equals("name")) {
2891          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
2892        }
2893        else if (name.equals("source")) {
2894          return addSource();
2895        }
2896        else if (name.equals("target")) {
2897          return addTarget();
2898        }
2899        else if (name.equals("rule")) {
2900          return addRule();
2901        }
2902        else if (name.equals("dependent")) {
2903          return addDependent();
2904        }
2905        else if (name.equals("documentation")) {
2906          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.documentation");
2907        }
2908        else
2909          return super.addChild(name);
2910      }
2911
2912      public StructureMapGroupRuleComponent copy() {
2913        StructureMapGroupRuleComponent dst = new StructureMapGroupRuleComponent();
2914        copyValues(dst);
2915        dst.name = name == null ? null : name.copy();
2916        if (source != null) {
2917          dst.source = new ArrayList<StructureMapGroupRuleSourceComponent>();
2918          for (StructureMapGroupRuleSourceComponent i : source)
2919            dst.source.add(i.copy());
2920        };
2921        if (target != null) {
2922          dst.target = new ArrayList<StructureMapGroupRuleTargetComponent>();
2923          for (StructureMapGroupRuleTargetComponent i : target)
2924            dst.target.add(i.copy());
2925        };
2926        if (rule != null) {
2927          dst.rule = new ArrayList<StructureMapGroupRuleComponent>();
2928          for (StructureMapGroupRuleComponent i : rule)
2929            dst.rule.add(i.copy());
2930        };
2931        if (dependent != null) {
2932          dst.dependent = new ArrayList<StructureMapGroupRuleDependentComponent>();
2933          for (StructureMapGroupRuleDependentComponent i : dependent)
2934            dst.dependent.add(i.copy());
2935        };
2936        dst.documentation = documentation == null ? null : documentation.copy();
2937        return dst;
2938      }
2939
2940      @Override
2941      public boolean equalsDeep(Base other_) {
2942        if (!super.equalsDeep(other_))
2943          return false;
2944        if (!(other_ instanceof StructureMapGroupRuleComponent))
2945          return false;
2946        StructureMapGroupRuleComponent o = (StructureMapGroupRuleComponent) other_;
2947        return compareDeep(name, o.name, true) && compareDeep(source, o.source, true) && compareDeep(target, o.target, true)
2948           && compareDeep(rule, o.rule, true) && compareDeep(dependent, o.dependent, true) && compareDeep(documentation, o.documentation, true)
2949          ;
2950      }
2951
2952      @Override
2953      public boolean equalsShallow(Base other_) {
2954        if (!super.equalsShallow(other_))
2955          return false;
2956        if (!(other_ instanceof StructureMapGroupRuleComponent))
2957          return false;
2958        StructureMapGroupRuleComponent o = (StructureMapGroupRuleComponent) other_;
2959        return compareValues(name, o.name, true) && compareValues(documentation, o.documentation, true);
2960      }
2961
2962      public boolean isEmpty() {
2963        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, source, target, rule
2964          , dependent, documentation);
2965      }
2966
2967  public String fhirType() {
2968    return "StructureMap.group.rule";
2969
2970  }
2971
2972// added from java-adornments.txt:
2973
2974  public String toString() {
2975    return StructureMapUtilities.ruleToString(this);
2976  }
2977
2978
2979// end addition
2980  }
2981
2982    @Block()
2983    public static class StructureMapGroupRuleSourceComponent extends BackboneElement implements IBaseBackboneElement {
2984        /**
2985         * Type or variable this rule applies to.
2986         */
2987        @Child(name = "context", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2988        @Description(shortDefinition="Type or variable this rule applies to", formalDefinition="Type or variable this rule applies to." )
2989        protected IdType context;
2990
2991        /**
2992         * Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.
2993         */
2994        @Child(name = "min", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2995        @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." )
2996        protected IntegerType min;
2997
2998        /**
2999         * 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).
3000         */
3001        @Child(name = "max", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
3002        @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)." )
3003        protected StringType max;
3004
3005        /**
3006         * Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.
3007         */
3008        @Child(name = "type", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3009        @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." )
3010        protected StringType type;
3011
3012        /**
3013         * A value to use if there is no existing value in the source object.
3014         */
3015        @Child(name = "defaultValue", type = {}, order=5, min=0, max=1, modifier=false, summary=true)
3016        @Description(shortDefinition="Default value if no value exists", formalDefinition="A value to use if there is no existing value in the source object." )
3017        protected org.hl7.fhir.r4.model.Type defaultValue;
3018
3019        /**
3020         * Optional field for this source.
3021         */
3022        @Child(name = "element", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
3023        @Description(shortDefinition="Optional field for this source", formalDefinition="Optional field for this source." )
3024        protected StringType element;
3025
3026        /**
3027         * How to handle the list mode for this element.
3028         */
3029        @Child(name = "listMode", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
3030        @Description(shortDefinition="first | not_first | last | not_last | only_one", formalDefinition="How to handle the list mode for this element." )
3031        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-source-list-mode")
3032        protected Enumeration<StructureMapSourceListMode> listMode;
3033
3034        /**
3035         * Named context for field, if a field is specified.
3036         */
3037        @Child(name = "variable", type = {IdType.class}, order=8, min=0, max=1, modifier=false, summary=true)
3038        @Description(shortDefinition="Named context for field, if a field is specified", formalDefinition="Named context for field, if a field is specified." )
3039        protected IdType variable;
3040
3041        /**
3042         * FHIRPath expression  - must be true or the rule does not apply.
3043         */
3044        @Child(name = "condition", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
3045        @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." )
3046        protected StringType condition;
3047
3048        /**
3049         * FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.
3050         */
3051        @Child(name = "check", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
3052        @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." )
3053        protected StringType check;
3054
3055        /**
3056         * A FHIRPath expression which specifies a message to put in the transform log when content matching the source rule is found.
3057         */
3058        @Child(name = "logMessage", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=true)
3059        @Description(shortDefinition="Message to put in log if source exists (FHIRPath)", formalDefinition="A FHIRPath expression which specifies a message to put in the transform log when content matching the source rule is found." )
3060        protected StringType logMessage;
3061
3062        private static final long serialVersionUID = 736427977L;
3063
3064    /**
3065     * Constructor
3066     */
3067      public StructureMapGroupRuleSourceComponent() {
3068        super();
3069      }
3070
3071    /**
3072     * Constructor
3073     */
3074      public StructureMapGroupRuleSourceComponent(IdType context) {
3075        super();
3076        this.context = context;
3077      }
3078
3079        /**
3080         * @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
3081         */
3082        public IdType getContextElement() { 
3083          if (this.context == null)
3084            if (Configuration.errorOnAutoCreate())
3085              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.context");
3086            else if (Configuration.doAutoCreate())
3087              this.context = new IdType(); // bb
3088          return this.context;
3089        }
3090
3091        public boolean hasContextElement() { 
3092          return this.context != null && !this.context.isEmpty();
3093        }
3094
3095        public boolean hasContext() { 
3096          return this.context != null && !this.context.isEmpty();
3097        }
3098
3099        /**
3100         * @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
3101         */
3102        public StructureMapGroupRuleSourceComponent setContextElement(IdType value) { 
3103          this.context = value;
3104          return this;
3105        }
3106
3107        /**
3108         * @return Type or variable this rule applies to.
3109         */
3110        public String getContext() { 
3111          return this.context == null ? null : this.context.getValue();
3112        }
3113
3114        /**
3115         * @param value Type or variable this rule applies to.
3116         */
3117        public StructureMapGroupRuleSourceComponent setContext(String value) { 
3118            if (this.context == null)
3119              this.context = new IdType();
3120            this.context.setValue(value);
3121          return this;
3122        }
3123
3124        /**
3125         * @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
3126         */
3127        public IntegerType getMinElement() { 
3128          if (this.min == null)
3129            if (Configuration.errorOnAutoCreate())
3130              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.min");
3131            else if (Configuration.doAutoCreate())
3132              this.min = new IntegerType(); // bb
3133          return this.min;
3134        }
3135
3136        public boolean hasMinElement() { 
3137          return this.min != null && !this.min.isEmpty();
3138        }
3139
3140        public boolean hasMin() { 
3141          return this.min != null && !this.min.isEmpty();
3142        }
3143
3144        /**
3145         * @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
3146         */
3147        public StructureMapGroupRuleSourceComponent setMinElement(IntegerType value) { 
3148          this.min = value;
3149          return this;
3150        }
3151
3152        /**
3153         * @return Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.
3154         */
3155        public int getMin() { 
3156          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
3157        }
3158
3159        /**
3160         * @param value Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.
3161         */
3162        public StructureMapGroupRuleSourceComponent setMin(int value) { 
3163            if (this.min == null)
3164              this.min = new IntegerType();
3165            this.min.setValue(value);
3166          return this;
3167        }
3168
3169        /**
3170         * @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
3171         */
3172        public StringType getMaxElement() { 
3173          if (this.max == null)
3174            if (Configuration.errorOnAutoCreate())
3175              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.max");
3176            else if (Configuration.doAutoCreate())
3177              this.max = new StringType(); // bb
3178          return this.max;
3179        }
3180
3181        public boolean hasMaxElement() { 
3182          return this.max != null && !this.max.isEmpty();
3183        }
3184
3185        public boolean hasMax() { 
3186          return this.max != null && !this.max.isEmpty();
3187        }
3188
3189        /**
3190         * @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
3191         */
3192        public StructureMapGroupRuleSourceComponent setMaxElement(StringType value) { 
3193          this.max = value;
3194          return this;
3195        }
3196
3197        /**
3198         * @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).
3199         */
3200        public String getMax() { 
3201          return this.max == null ? null : this.max.getValue();
3202        }
3203
3204        /**
3205         * @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).
3206         */
3207        public StructureMapGroupRuleSourceComponent setMax(String value) { 
3208          if (Utilities.noString(value))
3209            this.max = null;
3210          else {
3211            if (this.max == null)
3212              this.max = new StringType();
3213            this.max.setValue(value);
3214          }
3215          return this;
3216        }
3217
3218        /**
3219         * @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
3220         */
3221        public StringType getTypeElement() { 
3222          if (this.type == null)
3223            if (Configuration.errorOnAutoCreate())
3224              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.type");
3225            else if (Configuration.doAutoCreate())
3226              this.type = new StringType(); // bb
3227          return this.type;
3228        }
3229
3230        public boolean hasTypeElement() { 
3231          return this.type != null && !this.type.isEmpty();
3232        }
3233
3234        public boolean hasType() { 
3235          return this.type != null && !this.type.isEmpty();
3236        }
3237
3238        /**
3239         * @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
3240         */
3241        public StructureMapGroupRuleSourceComponent setTypeElement(StringType value) { 
3242          this.type = value;
3243          return this;
3244        }
3245
3246        /**
3247         * @return Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.
3248         */
3249        public String getType() { 
3250          return this.type == null ? null : this.type.getValue();
3251        }
3252
3253        /**
3254         * @param value Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.
3255         */
3256        public StructureMapGroupRuleSourceComponent setType(String value) { 
3257          if (Utilities.noString(value))
3258            this.type = null;
3259          else {
3260            if (this.type == null)
3261              this.type = new StringType();
3262            this.type.setValue(value);
3263          }
3264          return this;
3265        }
3266
3267        /**
3268         * @return {@link #defaultValue} (A value to use if there is no existing value in the source object.)
3269         */
3270        public org.hl7.fhir.r4.model.Type getDefaultValue() { 
3271          return this.defaultValue;
3272        }
3273
3274        public boolean hasDefaultValue() { 
3275          return this.defaultValue != null && !this.defaultValue.isEmpty();
3276        }
3277
3278        /**
3279         * @param value {@link #defaultValue} (A value to use if there is no existing value in the source object.)
3280         */
3281        public StructureMapGroupRuleSourceComponent setDefaultValue(org.hl7.fhir.r4.model.Type value) { 
3282          this.defaultValue = value;
3283          return this;
3284        }
3285
3286        /**
3287         * @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
3288         */
3289        public StringType getElementElement() { 
3290          if (this.element == null)
3291            if (Configuration.errorOnAutoCreate())
3292              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.element");
3293            else if (Configuration.doAutoCreate())
3294              this.element = new StringType(); // bb
3295          return this.element;
3296        }
3297
3298        public boolean hasElementElement() { 
3299          return this.element != null && !this.element.isEmpty();
3300        }
3301
3302        public boolean hasElement() { 
3303          return this.element != null && !this.element.isEmpty();
3304        }
3305
3306        /**
3307         * @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
3308         */
3309        public StructureMapGroupRuleSourceComponent setElementElement(StringType value) { 
3310          this.element = value;
3311          return this;
3312        }
3313
3314        /**
3315         * @return Optional field for this source.
3316         */
3317        public String getElement() { 
3318          return this.element == null ? null : this.element.getValue();
3319        }
3320
3321        /**
3322         * @param value Optional field for this source.
3323         */
3324        public StructureMapGroupRuleSourceComponent setElement(String value) { 
3325          if (Utilities.noString(value))
3326            this.element = null;
3327          else {
3328            if (this.element == null)
3329              this.element = new StringType();
3330            this.element.setValue(value);
3331          }
3332          return this;
3333        }
3334
3335        /**
3336         * @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
3337         */
3338        public Enumeration<StructureMapSourceListMode> getListModeElement() { 
3339          if (this.listMode == null)
3340            if (Configuration.errorOnAutoCreate())
3341              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.listMode");
3342            else if (Configuration.doAutoCreate())
3343              this.listMode = new Enumeration<StructureMapSourceListMode>(new StructureMapSourceListModeEnumFactory()); // bb
3344          return this.listMode;
3345        }
3346
3347        public boolean hasListModeElement() { 
3348          return this.listMode != null && !this.listMode.isEmpty();
3349        }
3350
3351        public boolean hasListMode() { 
3352          return this.listMode != null && !this.listMode.isEmpty();
3353        }
3354
3355        /**
3356         * @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
3357         */
3358        public StructureMapGroupRuleSourceComponent setListModeElement(Enumeration<StructureMapSourceListMode> value) { 
3359          this.listMode = value;
3360          return this;
3361        }
3362
3363        /**
3364         * @return How to handle the list mode for this element.
3365         */
3366        public StructureMapSourceListMode getListMode() { 
3367          return this.listMode == null ? null : this.listMode.getValue();
3368        }
3369
3370        /**
3371         * @param value How to handle the list mode for this element.
3372         */
3373        public StructureMapGroupRuleSourceComponent setListMode(StructureMapSourceListMode value) { 
3374          if (value == null)
3375            this.listMode = null;
3376          else {
3377            if (this.listMode == null)
3378              this.listMode = new Enumeration<StructureMapSourceListMode>(new StructureMapSourceListModeEnumFactory());
3379            this.listMode.setValue(value);
3380          }
3381          return this;
3382        }
3383
3384        /**
3385         * @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
3386         */
3387        public IdType getVariableElement() { 
3388          if (this.variable == null)
3389            if (Configuration.errorOnAutoCreate())
3390              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.variable");
3391            else if (Configuration.doAutoCreate())
3392              this.variable = new IdType(); // bb
3393          return this.variable;
3394        }
3395
3396        public boolean hasVariableElement() { 
3397          return this.variable != null && !this.variable.isEmpty();
3398        }
3399
3400        public boolean hasVariable() { 
3401          return this.variable != null && !this.variable.isEmpty();
3402        }
3403
3404        /**
3405         * @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
3406         */
3407        public StructureMapGroupRuleSourceComponent setVariableElement(IdType value) { 
3408          this.variable = value;
3409          return this;
3410        }
3411
3412        /**
3413         * @return Named context for field, if a field is specified.
3414         */
3415        public String getVariable() { 
3416          return this.variable == null ? null : this.variable.getValue();
3417        }
3418
3419        /**
3420         * @param value Named context for field, if a field is specified.
3421         */
3422        public StructureMapGroupRuleSourceComponent setVariable(String value) { 
3423          if (Utilities.noString(value))
3424            this.variable = null;
3425          else {
3426            if (this.variable == null)
3427              this.variable = new IdType();
3428            this.variable.setValue(value);
3429          }
3430          return this;
3431        }
3432
3433        /**
3434         * @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
3435         */
3436        public StringType getConditionElement() { 
3437          if (this.condition == null)
3438            if (Configuration.errorOnAutoCreate())
3439              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.condition");
3440            else if (Configuration.doAutoCreate())
3441              this.condition = new StringType(); // bb
3442          return this.condition;
3443        }
3444
3445        public boolean hasConditionElement() { 
3446          return this.condition != null && !this.condition.isEmpty();
3447        }
3448
3449        public boolean hasCondition() { 
3450          return this.condition != null && !this.condition.isEmpty();
3451        }
3452
3453        /**
3454         * @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
3455         */
3456        public StructureMapGroupRuleSourceComponent setConditionElement(StringType value) { 
3457          this.condition = value;
3458          return this;
3459        }
3460
3461        /**
3462         * @return FHIRPath expression  - must be true or the rule does not apply.
3463         */
3464        public String getCondition() { 
3465          return this.condition == null ? null : this.condition.getValue();
3466        }
3467
3468        /**
3469         * @param value FHIRPath expression  - must be true or the rule does not apply.
3470         */
3471        public StructureMapGroupRuleSourceComponent setCondition(String value) { 
3472          if (Utilities.noString(value))
3473            this.condition = null;
3474          else {
3475            if (this.condition == null)
3476              this.condition = new StringType();
3477            this.condition.setValue(value);
3478          }
3479          return this;
3480        }
3481
3482        /**
3483         * @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
3484         */
3485        public StringType getCheckElement() { 
3486          if (this.check == null)
3487            if (Configuration.errorOnAutoCreate())
3488              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.check");
3489            else if (Configuration.doAutoCreate())
3490              this.check = new StringType(); // bb
3491          return this.check;
3492        }
3493
3494        public boolean hasCheckElement() { 
3495          return this.check != null && !this.check.isEmpty();
3496        }
3497
3498        public boolean hasCheck() { 
3499          return this.check != null && !this.check.isEmpty();
3500        }
3501
3502        /**
3503         * @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
3504         */
3505        public StructureMapGroupRuleSourceComponent setCheckElement(StringType value) { 
3506          this.check = value;
3507          return this;
3508        }
3509
3510        /**
3511         * @return FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.
3512         */
3513        public String getCheck() { 
3514          return this.check == null ? null : this.check.getValue();
3515        }
3516
3517        /**
3518         * @param value FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.
3519         */
3520        public StructureMapGroupRuleSourceComponent setCheck(String value) { 
3521          if (Utilities.noString(value))
3522            this.check = null;
3523          else {
3524            if (this.check == null)
3525              this.check = new StringType();
3526            this.check.setValue(value);
3527          }
3528          return this;
3529        }
3530
3531        /**
3532         * @return {@link #logMessage} (A FHIRPath expression which specifies a message to put in the transform log when content matching the source rule is found.). This is the underlying object with id, value and extensions. The accessor "getLogMessage" gives direct access to the value
3533         */
3534        public StringType getLogMessageElement() { 
3535          if (this.logMessage == null)
3536            if (Configuration.errorOnAutoCreate())
3537              throw new Error("Attempt to auto-create StructureMapGroupRuleSourceComponent.logMessage");
3538            else if (Configuration.doAutoCreate())
3539              this.logMessage = new StringType(); // bb
3540          return this.logMessage;
3541        }
3542
3543        public boolean hasLogMessageElement() { 
3544          return this.logMessage != null && !this.logMessage.isEmpty();
3545        }
3546
3547        public boolean hasLogMessage() { 
3548          return this.logMessage != null && !this.logMessage.isEmpty();
3549        }
3550
3551        /**
3552         * @param value {@link #logMessage} (A FHIRPath expression which specifies a message to put in the transform log when content matching the source rule is found.). This is the underlying object with id, value and extensions. The accessor "getLogMessage" gives direct access to the value
3553         */
3554        public StructureMapGroupRuleSourceComponent setLogMessageElement(StringType value) { 
3555          this.logMessage = value;
3556          return this;
3557        }
3558
3559        /**
3560         * @return A FHIRPath expression which specifies a message to put in the transform log when content matching the source rule is found.
3561         */
3562        public String getLogMessage() { 
3563          return this.logMessage == null ? null : this.logMessage.getValue();
3564        }
3565
3566        /**
3567         * @param value A FHIRPath expression which specifies a message to put in the transform log when content matching the source rule is found.
3568         */
3569        public StructureMapGroupRuleSourceComponent setLogMessage(String value) { 
3570          if (Utilities.noString(value))
3571            this.logMessage = null;
3572          else {
3573            if (this.logMessage == null)
3574              this.logMessage = new StringType();
3575            this.logMessage.setValue(value);
3576          }
3577          return this;
3578        }
3579
3580        protected void listChildren(List<Property> children) {
3581          super.listChildren(children);
3582          children.add(new Property("context", "id", "Type or variable this rule applies to.", 0, 1, context));
3583          children.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, 1, min));
3584          children.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, 1, max));
3585          children.add(new Property("type", "string", "Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.", 0, 1, type));
3586          children.add(new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue));
3587          children.add(new Property("element", "string", "Optional field for this source.", 0, 1, element));
3588          children.add(new Property("listMode", "code", "How to handle the list mode for this element.", 0, 1, listMode));
3589          children.add(new Property("variable", "id", "Named context for field, if a field is specified.", 0, 1, variable));
3590          children.add(new Property("condition", "string", "FHIRPath expression  - must be true or the rule does not apply.", 0, 1, condition));
3591          children.add(new Property("check", "string", "FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.", 0, 1, check));
3592          children.add(new Property("logMessage", "string", "A FHIRPath expression which specifies a message to put in the transform log when content matching the source rule is found.", 0, 1, logMessage));
3593        }
3594
3595        @Override
3596        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3597          switch (_hash) {
3598          case 951530927: /*context*/  return new Property("context", "id", "Type or variable this rule applies to.", 0, 1, context);
3599          case 108114: /*min*/  return 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, 1, min);
3600          case 107876: /*max*/  return 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, 1, max);
3601          case 3575610: /*type*/  return new Property("type", "string", "Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.", 0, 1, type);
3602          case 587922128: /*defaultValue[x]*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3603          case -659125328: /*defaultValue*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3604          case 1470297600: /*defaultValueBase64Binary*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3605          case 600437336: /*defaultValueBoolean*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3606          case 264593188: /*defaultValueCanonical*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3607          case 1044993469: /*defaultValueCode*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3608          case 1045010302: /*defaultValueDate*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3609          case 1220374379: /*defaultValueDateTime*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3610          case 2077989249: /*defaultValueDecimal*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3611          case -2059245333: /*defaultValueId*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3612          case -1801671663: /*defaultValueInstant*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3613          case -1801189522: /*defaultValueInteger*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3614          case -325436225: /*defaultValueMarkdown*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3615          case 587910138: /*defaultValueOid*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3616          case -737344154: /*defaultValuePositiveInt*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3617          case -320515103: /*defaultValueString*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3618          case 1045494429: /*defaultValueTime*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3619          case 539117290: /*defaultValueUnsignedInt*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3620          case 587916188: /*defaultValueUri*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3621          case 587916191: /*defaultValueUrl*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3622          case 1045535627: /*defaultValueUuid*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3623          case -611966428: /*defaultValueAddress*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3624          case -1851689217: /*defaultValueAnnotation*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3625          case 2034820339: /*defaultValueAttachment*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3626          case -410434095: /*defaultValueCodeableConcept*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3627          case -783616198: /*defaultValueCoding*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3628          case -344740576: /*defaultValueContactPoint*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3629          case -975393912: /*defaultValueHumanName*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3630          case -1915078535: /*defaultValueIdentifier*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3631          case -420255343: /*defaultValuePeriod*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3632          case -1857379237: /*defaultValueQuantity*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3633          case -1951495315: /*defaultValueRange*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3634          case -1951489477: /*defaultValueRatio*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3635          case -1488914053: /*defaultValueReference*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3636          case -449641228: /*defaultValueSampledData*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3637          case 509825768: /*defaultValueSignature*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3638          case -302193638: /*defaultValueTiming*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3639          case -754548089: /*defaultValueDosage*/  return new Property("defaultValue[x]", "*", "A value to use if there is no existing value in the source object.", 0, 1, defaultValue);
3640          case -1662836996: /*element*/  return new Property("element", "string", "Optional field for this source.", 0, 1, element);
3641          case 1345445729: /*listMode*/  return new Property("listMode", "code", "How to handle the list mode for this element.", 0, 1, listMode);
3642          case -1249586564: /*variable*/  return new Property("variable", "id", "Named context for field, if a field is specified.", 0, 1, variable);
3643          case -861311717: /*condition*/  return new Property("condition", "string", "FHIRPath expression  - must be true or the rule does not apply.", 0, 1, condition);
3644          case 94627080: /*check*/  return new Property("check", "string", "FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.", 0, 1, check);
3645          case -1067155421: /*logMessage*/  return new Property("logMessage", "string", "A FHIRPath expression which specifies a message to put in the transform log when content matching the source rule is found.", 0, 1, logMessage);
3646          default: return super.getNamedProperty(_hash, _name, _checkValid);
3647          }
3648
3649        }
3650
3651      @Override
3652      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3653        switch (hash) {
3654        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // IdType
3655        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // IntegerType
3656        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
3657        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // StringType
3658        case -659125328: /*defaultValue*/ return this.defaultValue == null ? new Base[0] : new Base[] {this.defaultValue}; // org.hl7.fhir.r4.model.Type
3659        case -1662836996: /*element*/ return this.element == null ? new Base[0] : new Base[] {this.element}; // StringType
3660        case 1345445729: /*listMode*/ return this.listMode == null ? new Base[0] : new Base[] {this.listMode}; // Enumeration<StructureMapSourceListMode>
3661        case -1249586564: /*variable*/ return this.variable == null ? new Base[0] : new Base[] {this.variable}; // IdType
3662        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // StringType
3663        case 94627080: /*check*/ return this.check == null ? new Base[0] : new Base[] {this.check}; // StringType
3664        case -1067155421: /*logMessage*/ return this.logMessage == null ? new Base[0] : new Base[] {this.logMessage}; // StringType
3665        default: return super.getProperty(hash, name, checkValid);
3666        }
3667
3668      }
3669
3670      @Override
3671      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3672        switch (hash) {
3673        case 951530927: // context
3674          this.context = castToId(value); // IdType
3675          return value;
3676        case 108114: // min
3677          this.min = castToInteger(value); // IntegerType
3678          return value;
3679        case 107876: // max
3680          this.max = castToString(value); // StringType
3681          return value;
3682        case 3575610: // type
3683          this.type = castToString(value); // StringType
3684          return value;
3685        case -659125328: // defaultValue
3686          this.defaultValue = castToType(value); // org.hl7.fhir.r4.model.Type
3687          return value;
3688        case -1662836996: // element
3689          this.element = castToString(value); // StringType
3690          return value;
3691        case 1345445729: // listMode
3692          value = new StructureMapSourceListModeEnumFactory().fromType(castToCode(value));
3693          this.listMode = (Enumeration) value; // Enumeration<StructureMapSourceListMode>
3694          return value;
3695        case -1249586564: // variable
3696          this.variable = castToId(value); // IdType
3697          return value;
3698        case -861311717: // condition
3699          this.condition = castToString(value); // StringType
3700          return value;
3701        case 94627080: // check
3702          this.check = castToString(value); // StringType
3703          return value;
3704        case -1067155421: // logMessage
3705          this.logMessage = castToString(value); // StringType
3706          return value;
3707        default: return super.setProperty(hash, name, value);
3708        }
3709
3710      }
3711
3712      @Override
3713      public Base setProperty(String name, Base value) throws FHIRException {
3714        if (name.equals("context")) {
3715          this.context = castToId(value); // IdType
3716        } else if (name.equals("min")) {
3717          this.min = castToInteger(value); // IntegerType
3718        } else if (name.equals("max")) {
3719          this.max = castToString(value); // StringType
3720        } else if (name.equals("type")) {
3721          this.type = castToString(value); // StringType
3722        } else if (name.equals("defaultValue[x]")) {
3723          this.defaultValue = castToType(value); // org.hl7.fhir.r4.model.Type
3724        } else if (name.equals("element")) {
3725          this.element = castToString(value); // StringType
3726        } else if (name.equals("listMode")) {
3727          value = new StructureMapSourceListModeEnumFactory().fromType(castToCode(value));
3728          this.listMode = (Enumeration) value; // Enumeration<StructureMapSourceListMode>
3729        } else if (name.equals("variable")) {
3730          this.variable = castToId(value); // IdType
3731        } else if (name.equals("condition")) {
3732          this.condition = castToString(value); // StringType
3733        } else if (name.equals("check")) {
3734          this.check = castToString(value); // StringType
3735        } else if (name.equals("logMessage")) {
3736          this.logMessage = castToString(value); // StringType
3737        } else
3738          return super.setProperty(name, value);
3739        return value;
3740      }
3741
3742      @Override
3743      public Base makeProperty(int hash, String name) throws FHIRException {
3744        switch (hash) {
3745        case 951530927:  return getContextElement();
3746        case 108114:  return getMinElement();
3747        case 107876:  return getMaxElement();
3748        case 3575610:  return getTypeElement();
3749        case 587922128:  return getDefaultValue(); 
3750        case -659125328:  return getDefaultValue(); 
3751        case -1662836996:  return getElementElement();
3752        case 1345445729:  return getListModeElement();
3753        case -1249586564:  return getVariableElement();
3754        case -861311717:  return getConditionElement();
3755        case 94627080:  return getCheckElement();
3756        case -1067155421:  return getLogMessageElement();
3757        default: return super.makeProperty(hash, name);
3758        }
3759
3760      }
3761
3762      @Override
3763      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3764        switch (hash) {
3765        case 951530927: /*context*/ return new String[] {"id"};
3766        case 108114: /*min*/ return new String[] {"integer"};
3767        case 107876: /*max*/ return new String[] {"string"};
3768        case 3575610: /*type*/ return new String[] {"string"};
3769        case -659125328: /*defaultValue*/ return new String[] {"*"};
3770        case -1662836996: /*element*/ return new String[] {"string"};
3771        case 1345445729: /*listMode*/ return new String[] {"code"};
3772        case -1249586564: /*variable*/ return new String[] {"id"};
3773        case -861311717: /*condition*/ return new String[] {"string"};
3774        case 94627080: /*check*/ return new String[] {"string"};
3775        case -1067155421: /*logMessage*/ return new String[] {"string"};
3776        default: return super.getTypesForProperty(hash, name);
3777        }
3778
3779      }
3780
3781      @Override
3782      public Base addChild(String name) throws FHIRException {
3783        if (name.equals("context")) {
3784          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.context");
3785        }
3786        else if (name.equals("min")) {
3787          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.min");
3788        }
3789        else if (name.equals("max")) {
3790          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.max");
3791        }
3792        else if (name.equals("type")) {
3793          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.type");
3794        }
3795        else if (name.equals("defaultValueBase64Binary")) {
3796          this.defaultValue = new Base64BinaryType();
3797          return this.defaultValue;
3798        }
3799        else if (name.equals("defaultValueBoolean")) {
3800          this.defaultValue = new BooleanType();
3801          return this.defaultValue;
3802        }
3803        else if (name.equals("defaultValueCanonical")) {
3804          this.defaultValue = new CanonicalType();
3805          return this.defaultValue;
3806        }
3807        else if (name.equals("defaultValueCode")) {
3808          this.defaultValue = new CodeType();
3809          return this.defaultValue;
3810        }
3811        else if (name.equals("defaultValueDate")) {
3812          this.defaultValue = new DateType();
3813          return this.defaultValue;
3814        }
3815        else if (name.equals("defaultValueDateTime")) {
3816          this.defaultValue = new DateTimeType();
3817          return this.defaultValue;
3818        }
3819        else if (name.equals("defaultValueDecimal")) {
3820          this.defaultValue = new DecimalType();
3821          return this.defaultValue;
3822        }
3823        else if (name.equals("defaultValueId")) {
3824          this.defaultValue = new IdType();
3825          return this.defaultValue;
3826        }
3827        else if (name.equals("defaultValueInstant")) {
3828          this.defaultValue = new InstantType();
3829          return this.defaultValue;
3830        }
3831        else if (name.equals("defaultValueInteger")) {
3832          this.defaultValue = new IntegerType();
3833          return this.defaultValue;
3834        }
3835        else if (name.equals("defaultValueMarkdown")) {
3836          this.defaultValue = new MarkdownType();
3837          return this.defaultValue;
3838        }
3839        else if (name.equals("defaultValueOid")) {
3840          this.defaultValue = new OidType();
3841          return this.defaultValue;
3842        }
3843        else if (name.equals("defaultValuePositiveInt")) {
3844          this.defaultValue = new PositiveIntType();
3845          return this.defaultValue;
3846        }
3847        else if (name.equals("defaultValueString")) {
3848          this.defaultValue = new StringType();
3849          return this.defaultValue;
3850        }
3851        else if (name.equals("defaultValueTime")) {
3852          this.defaultValue = new TimeType();
3853          return this.defaultValue;
3854        }
3855        else if (name.equals("defaultValueUnsignedInt")) {
3856          this.defaultValue = new UnsignedIntType();
3857          return this.defaultValue;
3858        }
3859        else if (name.equals("defaultValueUri")) {
3860          this.defaultValue = new UriType();
3861          return this.defaultValue;
3862        }
3863        else if (name.equals("defaultValueUrl")) {
3864          this.defaultValue = new UrlType();
3865          return this.defaultValue;
3866        }
3867        else if (name.equals("defaultValueUuid")) {
3868          this.defaultValue = new UuidType();
3869          return this.defaultValue;
3870        }
3871        else if (name.equals("defaultValueAddress")) {
3872          this.defaultValue = new Address();
3873          return this.defaultValue;
3874        }
3875        else if (name.equals("defaultValueAge")) {
3876          this.defaultValue = new Age();
3877          return this.defaultValue;
3878        }
3879        else if (name.equals("defaultValueAnnotation")) {
3880          this.defaultValue = new Annotation();
3881          return this.defaultValue;
3882        }
3883        else if (name.equals("defaultValueAttachment")) {
3884          this.defaultValue = new Attachment();
3885          return this.defaultValue;
3886        }
3887        else if (name.equals("defaultValueCodeableConcept")) {
3888          this.defaultValue = new CodeableConcept();
3889          return this.defaultValue;
3890        }
3891        else if (name.equals("defaultValueCoding")) {
3892          this.defaultValue = new Coding();
3893          return this.defaultValue;
3894        }
3895        else if (name.equals("defaultValueContactPoint")) {
3896          this.defaultValue = new ContactPoint();
3897          return this.defaultValue;
3898        }
3899        else if (name.equals("defaultValueCount")) {
3900          this.defaultValue = new Count();
3901          return this.defaultValue;
3902        }
3903        else if (name.equals("defaultValueDistance")) {
3904          this.defaultValue = new Distance();
3905          return this.defaultValue;
3906        }
3907        else if (name.equals("defaultValueDuration")) {
3908          this.defaultValue = new Duration();
3909          return this.defaultValue;
3910        }
3911        else if (name.equals("defaultValueHumanName")) {
3912          this.defaultValue = new HumanName();
3913          return this.defaultValue;
3914        }
3915        else if (name.equals("defaultValueIdentifier")) {
3916          this.defaultValue = new Identifier();
3917          return this.defaultValue;
3918        }
3919        else if (name.equals("defaultValueMoney")) {
3920          this.defaultValue = new Money();
3921          return this.defaultValue;
3922        }
3923        else if (name.equals("defaultValuePeriod")) {
3924          this.defaultValue = new Period();
3925          return this.defaultValue;
3926        }
3927        else if (name.equals("defaultValueQuantity")) {
3928          this.defaultValue = new Quantity();
3929          return this.defaultValue;
3930        }
3931        else if (name.equals("defaultValueRange")) {
3932          this.defaultValue = new Range();
3933          return this.defaultValue;
3934        }
3935        else if (name.equals("defaultValueRatio")) {
3936          this.defaultValue = new Ratio();
3937          return this.defaultValue;
3938        }
3939        else if (name.equals("defaultValueReference")) {
3940          this.defaultValue = new Reference();
3941          return this.defaultValue;
3942        }
3943        else if (name.equals("defaultValueSampledData")) {
3944          this.defaultValue = new SampledData();
3945          return this.defaultValue;
3946        }
3947        else if (name.equals("defaultValueSignature")) {
3948          this.defaultValue = new Signature();
3949          return this.defaultValue;
3950        }
3951        else if (name.equals("defaultValueTiming")) {
3952          this.defaultValue = new Timing();
3953          return this.defaultValue;
3954        }
3955        else if (name.equals("defaultValueParameterDefinition")) {
3956          this.defaultValue = new ParameterDefinition();
3957          return this.defaultValue;
3958        }
3959        else if (name.equals("defaultValueDataRequirement")) {
3960          this.defaultValue = new DataRequirement();
3961          return this.defaultValue;
3962        }
3963        else if (name.equals("defaultValueRelatedArtifact")) {
3964          this.defaultValue = new RelatedArtifact();
3965          return this.defaultValue;
3966        }
3967        else if (name.equals("defaultValueContactDetail")) {
3968          this.defaultValue = new ContactDetail();
3969          return this.defaultValue;
3970        }
3971        else if (name.equals("defaultValueContributor")) {
3972          this.defaultValue = new Contributor();
3973          return this.defaultValue;
3974        }
3975        else if (name.equals("defaultValueTriggerDefinition")) {
3976          this.defaultValue = new TriggerDefinition();
3977          return this.defaultValue;
3978        }
3979        else if (name.equals("defaultValueExpression")) {
3980          this.defaultValue = new Expression();
3981          return this.defaultValue;
3982        }
3983        else if (name.equals("defaultValueUsageContext")) {
3984          this.defaultValue = new UsageContext();
3985          return this.defaultValue;
3986        }
3987        else if (name.equals("defaultValueDosage")) {
3988          this.defaultValue = new Dosage();
3989          return this.defaultValue;
3990        }
3991        else if (name.equals("element")) {
3992          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.element");
3993        }
3994        else if (name.equals("listMode")) {
3995          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.listMode");
3996        }
3997        else if (name.equals("variable")) {
3998          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.variable");
3999        }
4000        else if (name.equals("condition")) {
4001          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.condition");
4002        }
4003        else if (name.equals("check")) {
4004          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.check");
4005        }
4006        else if (name.equals("logMessage")) {
4007          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.logMessage");
4008        }
4009        else
4010          return super.addChild(name);
4011      }
4012
4013      public StructureMapGroupRuleSourceComponent copy() {
4014        StructureMapGroupRuleSourceComponent dst = new StructureMapGroupRuleSourceComponent();
4015        copyValues(dst);
4016        dst.context = context == null ? null : context.copy();
4017        dst.min = min == null ? null : min.copy();
4018        dst.max = max == null ? null : max.copy();
4019        dst.type = type == null ? null : type.copy();
4020        dst.defaultValue = defaultValue == null ? null : defaultValue.copy();
4021        dst.element = element == null ? null : element.copy();
4022        dst.listMode = listMode == null ? null : listMode.copy();
4023        dst.variable = variable == null ? null : variable.copy();
4024        dst.condition = condition == null ? null : condition.copy();
4025        dst.check = check == null ? null : check.copy();
4026        dst.logMessage = logMessage == null ? null : logMessage.copy();
4027        return dst;
4028      }
4029
4030      @Override
4031      public boolean equalsDeep(Base other_) {
4032        if (!super.equalsDeep(other_))
4033          return false;
4034        if (!(other_ instanceof StructureMapGroupRuleSourceComponent))
4035          return false;
4036        StructureMapGroupRuleSourceComponent o = (StructureMapGroupRuleSourceComponent) other_;
4037        return compareDeep(context, o.context, true) && compareDeep(min, o.min, true) && compareDeep(max, o.max, true)
4038           && compareDeep(type, o.type, true) && compareDeep(defaultValue, o.defaultValue, true) && compareDeep(element, o.element, true)
4039           && compareDeep(listMode, o.listMode, true) && compareDeep(variable, o.variable, true) && compareDeep(condition, o.condition, true)
4040           && compareDeep(check, o.check, true) && compareDeep(logMessage, o.logMessage, true);
4041      }
4042
4043      @Override
4044      public boolean equalsShallow(Base other_) {
4045        if (!super.equalsShallow(other_))
4046          return false;
4047        if (!(other_ instanceof StructureMapGroupRuleSourceComponent))
4048          return false;
4049        StructureMapGroupRuleSourceComponent o = (StructureMapGroupRuleSourceComponent) other_;
4050        return compareValues(context, o.context, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
4051           && compareValues(type, o.type, true) && compareValues(element, o.element, true) && compareValues(listMode, o.listMode, true)
4052           && compareValues(variable, o.variable, true) && compareValues(condition, o.condition, true) && compareValues(check, o.check, true)
4053           && compareValues(logMessage, o.logMessage, true);
4054      }
4055
4056      public boolean isEmpty() {
4057        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(context, min, max, type
4058          , defaultValue, element, listMode, variable, condition, check, logMessage);
4059      }
4060
4061  public String fhirType() {
4062    return "StructureMap.group.rule.source";
4063
4064  }
4065
4066// added from java-adornments.txt:
4067
4068  public String toString() {
4069    return StructureMapUtilities.sourceToString(this);
4070  }
4071
4072
4073// end addition
4074  }
4075
4076    @Block()
4077    public static class StructureMapGroupRuleTargetComponent extends BackboneElement implements IBaseBackboneElement {
4078        /**
4079         * Type or variable this rule applies to.
4080         */
4081        @Child(name = "context", type = {IdType.class}, order=1, min=0, max=1, modifier=false, summary=true)
4082        @Description(shortDefinition="Type or variable this rule applies to", formalDefinition="Type or variable this rule applies to." )
4083        protected IdType context;
4084
4085        /**
4086         * How to interpret the context.
4087         */
4088        @Child(name = "contextType", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
4089        @Description(shortDefinition="type | variable", formalDefinition="How to interpret the context." )
4090        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-context-type")
4091        protected Enumeration<StructureMapContextType> contextType;
4092
4093        /**
4094         * Field to create in the context.
4095         */
4096        @Child(name = "element", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
4097        @Description(shortDefinition="Field to create in the context", formalDefinition="Field to create in the context." )
4098        protected StringType element;
4099
4100        /**
4101         * Named context for field, if desired, and a field is specified.
4102         */
4103        @Child(name = "variable", type = {IdType.class}, order=4, min=0, max=1, modifier=false, summary=true)
4104        @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." )
4105        protected IdType variable;
4106
4107        /**
4108         * If field is a list, how to manage the list.
4109         */
4110        @Child(name = "listMode", type = {CodeType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4111        @Description(shortDefinition="first | share | last | collate", formalDefinition="If field is a list, how to manage the list." )
4112        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-target-list-mode")
4113        protected List<Enumeration<StructureMapTargetListMode>> listMode;
4114
4115        /**
4116         * Internal rule reference for shared list items.
4117         */
4118        @Child(name = "listRuleId", type = {IdType.class}, order=6, min=0, max=1, modifier=false, summary=true)
4119        @Description(shortDefinition="Internal rule reference for shared list items", formalDefinition="Internal rule reference for shared list items." )
4120        protected IdType listRuleId;
4121
4122        /**
4123         * How the data is copied / created.
4124         */
4125        @Child(name = "transform", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
4126        @Description(shortDefinition="create | copy +", formalDefinition="How the data is copied / created." )
4127        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/map-transform")
4128        protected Enumeration<StructureMapTransform> transform;
4129
4130        /**
4131         * Parameters to the transform.
4132         */
4133        @Child(name = "parameter", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4134        @Description(shortDefinition="Parameters to the transform", formalDefinition="Parameters to the transform." )
4135        protected List<StructureMapGroupRuleTargetParameterComponent> parameter;
4136
4137        private static final long serialVersionUID = -1441766429L;
4138
4139    /**
4140     * Constructor
4141     */
4142      public StructureMapGroupRuleTargetComponent() {
4143        super();
4144      }
4145
4146        /**
4147         * @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
4148         */
4149        public IdType getContextElement() { 
4150          if (this.context == null)
4151            if (Configuration.errorOnAutoCreate())
4152              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.context");
4153            else if (Configuration.doAutoCreate())
4154              this.context = new IdType(); // bb
4155          return this.context;
4156        }
4157
4158        public boolean hasContextElement() { 
4159          return this.context != null && !this.context.isEmpty();
4160        }
4161
4162        public boolean hasContext() { 
4163          return this.context != null && !this.context.isEmpty();
4164        }
4165
4166        /**
4167         * @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
4168         */
4169        public StructureMapGroupRuleTargetComponent setContextElement(IdType value) { 
4170          this.context = value;
4171          return this;
4172        }
4173
4174        /**
4175         * @return Type or variable this rule applies to.
4176         */
4177        public String getContext() { 
4178          return this.context == null ? null : this.context.getValue();
4179        }
4180
4181        /**
4182         * @param value Type or variable this rule applies to.
4183         */
4184        public StructureMapGroupRuleTargetComponent setContext(String value) { 
4185          if (Utilities.noString(value))
4186            this.context = null;
4187          else {
4188            if (this.context == null)
4189              this.context = new IdType();
4190            this.context.setValue(value);
4191          }
4192          return this;
4193        }
4194
4195        /**
4196         * @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
4197         */
4198        public Enumeration<StructureMapContextType> getContextTypeElement() { 
4199          if (this.contextType == null)
4200            if (Configuration.errorOnAutoCreate())
4201              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.contextType");
4202            else if (Configuration.doAutoCreate())
4203              this.contextType = new Enumeration<StructureMapContextType>(new StructureMapContextTypeEnumFactory()); // bb
4204          return this.contextType;
4205        }
4206
4207        public boolean hasContextTypeElement() { 
4208          return this.contextType != null && !this.contextType.isEmpty();
4209        }
4210
4211        public boolean hasContextType() { 
4212          return this.contextType != null && !this.contextType.isEmpty();
4213        }
4214
4215        /**
4216         * @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
4217         */
4218        public StructureMapGroupRuleTargetComponent setContextTypeElement(Enumeration<StructureMapContextType> value) { 
4219          this.contextType = value;
4220          return this;
4221        }
4222
4223        /**
4224         * @return How to interpret the context.
4225         */
4226        public StructureMapContextType getContextType() { 
4227          return this.contextType == null ? null : this.contextType.getValue();
4228        }
4229
4230        /**
4231         * @param value How to interpret the context.
4232         */
4233        public StructureMapGroupRuleTargetComponent setContextType(StructureMapContextType value) { 
4234          if (value == null)
4235            this.contextType = null;
4236          else {
4237            if (this.contextType == null)
4238              this.contextType = new Enumeration<StructureMapContextType>(new StructureMapContextTypeEnumFactory());
4239            this.contextType.setValue(value);
4240          }
4241          return this;
4242        }
4243
4244        /**
4245         * @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
4246         */
4247        public StringType getElementElement() { 
4248          if (this.element == null)
4249            if (Configuration.errorOnAutoCreate())
4250              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.element");
4251            else if (Configuration.doAutoCreate())
4252              this.element = new StringType(); // bb
4253          return this.element;
4254        }
4255
4256        public boolean hasElementElement() { 
4257          return this.element != null && !this.element.isEmpty();
4258        }
4259
4260        public boolean hasElement() { 
4261          return this.element != null && !this.element.isEmpty();
4262        }
4263
4264        /**
4265         * @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
4266         */
4267        public StructureMapGroupRuleTargetComponent setElementElement(StringType value) { 
4268          this.element = value;
4269          return this;
4270        }
4271
4272        /**
4273         * @return Field to create in the context.
4274         */
4275        public String getElement() { 
4276          return this.element == null ? null : this.element.getValue();
4277        }
4278
4279        /**
4280         * @param value Field to create in the context.
4281         */
4282        public StructureMapGroupRuleTargetComponent setElement(String value) { 
4283          if (Utilities.noString(value))
4284            this.element = null;
4285          else {
4286            if (this.element == null)
4287              this.element = new StringType();
4288            this.element.setValue(value);
4289          }
4290          return this;
4291        }
4292
4293        /**
4294         * @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
4295         */
4296        public IdType getVariableElement() { 
4297          if (this.variable == null)
4298            if (Configuration.errorOnAutoCreate())
4299              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.variable");
4300            else if (Configuration.doAutoCreate())
4301              this.variable = new IdType(); // bb
4302          return this.variable;
4303        }
4304
4305        public boolean hasVariableElement() { 
4306          return this.variable != null && !this.variable.isEmpty();
4307        }
4308
4309        public boolean hasVariable() { 
4310          return this.variable != null && !this.variable.isEmpty();
4311        }
4312
4313        /**
4314         * @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
4315         */
4316        public StructureMapGroupRuleTargetComponent setVariableElement(IdType value) { 
4317          this.variable = value;
4318          return this;
4319        }
4320
4321        /**
4322         * @return Named context for field, if desired, and a field is specified.
4323         */
4324        public String getVariable() { 
4325          return this.variable == null ? null : this.variable.getValue();
4326        }
4327
4328        /**
4329         * @param value Named context for field, if desired, and a field is specified.
4330         */
4331        public StructureMapGroupRuleTargetComponent setVariable(String value) { 
4332          if (Utilities.noString(value))
4333            this.variable = null;
4334          else {
4335            if (this.variable == null)
4336              this.variable = new IdType();
4337            this.variable.setValue(value);
4338          }
4339          return this;
4340        }
4341
4342        /**
4343         * @return {@link #listMode} (If field is a list, how to manage the list.)
4344         */
4345        public List<Enumeration<StructureMapTargetListMode>> getListMode() { 
4346          if (this.listMode == null)
4347            this.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4348          return this.listMode;
4349        }
4350
4351        /**
4352         * @return Returns a reference to <code>this</code> for easy method chaining
4353         */
4354        public StructureMapGroupRuleTargetComponent setListMode(List<Enumeration<StructureMapTargetListMode>> theListMode) { 
4355          this.listMode = theListMode;
4356          return this;
4357        }
4358
4359        public boolean hasListMode() { 
4360          if (this.listMode == null)
4361            return false;
4362          for (Enumeration<StructureMapTargetListMode> item : this.listMode)
4363            if (!item.isEmpty())
4364              return true;
4365          return false;
4366        }
4367
4368        /**
4369         * @return {@link #listMode} (If field is a list, how to manage the list.)
4370         */
4371        public Enumeration<StructureMapTargetListMode> addListModeElement() {//2 
4372          Enumeration<StructureMapTargetListMode> t = new Enumeration<StructureMapTargetListMode>(new StructureMapTargetListModeEnumFactory());
4373          if (this.listMode == null)
4374            this.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4375          this.listMode.add(t);
4376          return t;
4377        }
4378
4379        /**
4380         * @param value {@link #listMode} (If field is a list, how to manage the list.)
4381         */
4382        public StructureMapGroupRuleTargetComponent addListMode(StructureMapTargetListMode value) { //1
4383          Enumeration<StructureMapTargetListMode> t = new Enumeration<StructureMapTargetListMode>(new StructureMapTargetListModeEnumFactory());
4384          t.setValue(value);
4385          if (this.listMode == null)
4386            this.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4387          this.listMode.add(t);
4388          return this;
4389        }
4390
4391        /**
4392         * @param value {@link #listMode} (If field is a list, how to manage the list.)
4393         */
4394        public boolean hasListMode(StructureMapTargetListMode value) { 
4395          if (this.listMode == null)
4396            return false;
4397          for (Enumeration<StructureMapTargetListMode> v : this.listMode)
4398            if (v.getValue().equals(value)) // code
4399              return true;
4400          return false;
4401        }
4402
4403        /**
4404         * @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
4405         */
4406        public IdType getListRuleIdElement() { 
4407          if (this.listRuleId == null)
4408            if (Configuration.errorOnAutoCreate())
4409              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.listRuleId");
4410            else if (Configuration.doAutoCreate())
4411              this.listRuleId = new IdType(); // bb
4412          return this.listRuleId;
4413        }
4414
4415        public boolean hasListRuleIdElement() { 
4416          return this.listRuleId != null && !this.listRuleId.isEmpty();
4417        }
4418
4419        public boolean hasListRuleId() { 
4420          return this.listRuleId != null && !this.listRuleId.isEmpty();
4421        }
4422
4423        /**
4424         * @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
4425         */
4426        public StructureMapGroupRuleTargetComponent setListRuleIdElement(IdType value) { 
4427          this.listRuleId = value;
4428          return this;
4429        }
4430
4431        /**
4432         * @return Internal rule reference for shared list items.
4433         */
4434        public String getListRuleId() { 
4435          return this.listRuleId == null ? null : this.listRuleId.getValue();
4436        }
4437
4438        /**
4439         * @param value Internal rule reference for shared list items.
4440         */
4441        public StructureMapGroupRuleTargetComponent setListRuleId(String value) { 
4442          if (Utilities.noString(value))
4443            this.listRuleId = null;
4444          else {
4445            if (this.listRuleId == null)
4446              this.listRuleId = new IdType();
4447            this.listRuleId.setValue(value);
4448          }
4449          return this;
4450        }
4451
4452        /**
4453         * @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
4454         */
4455        public Enumeration<StructureMapTransform> getTransformElement() { 
4456          if (this.transform == null)
4457            if (Configuration.errorOnAutoCreate())
4458              throw new Error("Attempt to auto-create StructureMapGroupRuleTargetComponent.transform");
4459            else if (Configuration.doAutoCreate())
4460              this.transform = new Enumeration<StructureMapTransform>(new StructureMapTransformEnumFactory()); // bb
4461          return this.transform;
4462        }
4463
4464        public boolean hasTransformElement() { 
4465          return this.transform != null && !this.transform.isEmpty();
4466        }
4467
4468        public boolean hasTransform() { 
4469          return this.transform != null && !this.transform.isEmpty();
4470        }
4471
4472        /**
4473         * @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
4474         */
4475        public StructureMapGroupRuleTargetComponent setTransformElement(Enumeration<StructureMapTransform> value) { 
4476          this.transform = value;
4477          return this;
4478        }
4479
4480        /**
4481         * @return How the data is copied / created.
4482         */
4483        public StructureMapTransform getTransform() { 
4484          return this.transform == null ? null : this.transform.getValue();
4485        }
4486
4487        /**
4488         * @param value How the data is copied / created.
4489         */
4490        public StructureMapGroupRuleTargetComponent setTransform(StructureMapTransform value) { 
4491          if (value == null)
4492            this.transform = null;
4493          else {
4494            if (this.transform == null)
4495              this.transform = new Enumeration<StructureMapTransform>(new StructureMapTransformEnumFactory());
4496            this.transform.setValue(value);
4497          }
4498          return this;
4499        }
4500
4501        /**
4502         * @return {@link #parameter} (Parameters to the transform.)
4503         */
4504        public List<StructureMapGroupRuleTargetParameterComponent> getParameter() { 
4505          if (this.parameter == null)
4506            this.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4507          return this.parameter;
4508        }
4509
4510        /**
4511         * @return Returns a reference to <code>this</code> for easy method chaining
4512         */
4513        public StructureMapGroupRuleTargetComponent setParameter(List<StructureMapGroupRuleTargetParameterComponent> theParameter) { 
4514          this.parameter = theParameter;
4515          return this;
4516        }
4517
4518        public boolean hasParameter() { 
4519          if (this.parameter == null)
4520            return false;
4521          for (StructureMapGroupRuleTargetParameterComponent item : this.parameter)
4522            if (!item.isEmpty())
4523              return true;
4524          return false;
4525        }
4526
4527        public StructureMapGroupRuleTargetParameterComponent addParameter() { //3
4528          StructureMapGroupRuleTargetParameterComponent t = new StructureMapGroupRuleTargetParameterComponent();
4529          if (this.parameter == null)
4530            this.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4531          this.parameter.add(t);
4532          return t;
4533        }
4534
4535        public StructureMapGroupRuleTargetComponent addParameter(StructureMapGroupRuleTargetParameterComponent t) { //3
4536          if (t == null)
4537            return this;
4538          if (this.parameter == null)
4539            this.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4540          this.parameter.add(t);
4541          return this;
4542        }
4543
4544        /**
4545         * @return The first repetition of repeating field {@link #parameter}, creating it if it does not already exist
4546         */
4547        public StructureMapGroupRuleTargetParameterComponent getParameterFirstRep() { 
4548          if (getParameter().isEmpty()) {
4549            addParameter();
4550          }
4551          return getParameter().get(0);
4552        }
4553
4554        protected void listChildren(List<Property> children) {
4555          super.listChildren(children);
4556          children.add(new Property("context", "id", "Type or variable this rule applies to.", 0, 1, context));
4557          children.add(new Property("contextType", "code", "How to interpret the context.", 0, 1, contextType));
4558          children.add(new Property("element", "string", "Field to create in the context.", 0, 1, element));
4559          children.add(new Property("variable", "id", "Named context for field, if desired, and a field is specified.", 0, 1, variable));
4560          children.add(new Property("listMode", "code", "If field is a list, how to manage the list.", 0, java.lang.Integer.MAX_VALUE, listMode));
4561          children.add(new Property("listRuleId", "id", "Internal rule reference for shared list items.", 0, 1, listRuleId));
4562          children.add(new Property("transform", "code", "How the data is copied / created.", 0, 1, transform));
4563          children.add(new Property("parameter", "", "Parameters to the transform.", 0, java.lang.Integer.MAX_VALUE, parameter));
4564        }
4565
4566        @Override
4567        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4568          switch (_hash) {
4569          case 951530927: /*context*/  return new Property("context", "id", "Type or variable this rule applies to.", 0, 1, context);
4570          case -102839927: /*contextType*/  return new Property("contextType", "code", "How to interpret the context.", 0, 1, contextType);
4571          case -1662836996: /*element*/  return new Property("element", "string", "Field to create in the context.", 0, 1, element);
4572          case -1249586564: /*variable*/  return new Property("variable", "id", "Named context for field, if desired, and a field is specified.", 0, 1, variable);
4573          case 1345445729: /*listMode*/  return new Property("listMode", "code", "If field is a list, how to manage the list.", 0, java.lang.Integer.MAX_VALUE, listMode);
4574          case 337117045: /*listRuleId*/  return new Property("listRuleId", "id", "Internal rule reference for shared list items.", 0, 1, listRuleId);
4575          case 1052666732: /*transform*/  return new Property("transform", "code", "How the data is copied / created.", 0, 1, transform);
4576          case 1954460585: /*parameter*/  return new Property("parameter", "", "Parameters to the transform.", 0, java.lang.Integer.MAX_VALUE, parameter);
4577          default: return super.getNamedProperty(_hash, _name, _checkValid);
4578          }
4579
4580        }
4581
4582      @Override
4583      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4584        switch (hash) {
4585        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // IdType
4586        case -102839927: /*contextType*/ return this.contextType == null ? new Base[0] : new Base[] {this.contextType}; // Enumeration<StructureMapContextType>
4587        case -1662836996: /*element*/ return this.element == null ? new Base[0] : new Base[] {this.element}; // StringType
4588        case -1249586564: /*variable*/ return this.variable == null ? new Base[0] : new Base[] {this.variable}; // IdType
4589        case 1345445729: /*listMode*/ return this.listMode == null ? new Base[0] : this.listMode.toArray(new Base[this.listMode.size()]); // Enumeration<StructureMapTargetListMode>
4590        case 337117045: /*listRuleId*/ return this.listRuleId == null ? new Base[0] : new Base[] {this.listRuleId}; // IdType
4591        case 1052666732: /*transform*/ return this.transform == null ? new Base[0] : new Base[] {this.transform}; // Enumeration<StructureMapTransform>
4592        case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // StructureMapGroupRuleTargetParameterComponent
4593        default: return super.getProperty(hash, name, checkValid);
4594        }
4595
4596      }
4597
4598      @Override
4599      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4600        switch (hash) {
4601        case 951530927: // context
4602          this.context = castToId(value); // IdType
4603          return value;
4604        case -102839927: // contextType
4605          value = new StructureMapContextTypeEnumFactory().fromType(castToCode(value));
4606          this.contextType = (Enumeration) value; // Enumeration<StructureMapContextType>
4607          return value;
4608        case -1662836996: // element
4609          this.element = castToString(value); // StringType
4610          return value;
4611        case -1249586564: // variable
4612          this.variable = castToId(value); // IdType
4613          return value;
4614        case 1345445729: // listMode
4615          value = new StructureMapTargetListModeEnumFactory().fromType(castToCode(value));
4616          this.getListMode().add((Enumeration) value); // Enumeration<StructureMapTargetListMode>
4617          return value;
4618        case 337117045: // listRuleId
4619          this.listRuleId = castToId(value); // IdType
4620          return value;
4621        case 1052666732: // transform
4622          value = new StructureMapTransformEnumFactory().fromType(castToCode(value));
4623          this.transform = (Enumeration) value; // Enumeration<StructureMapTransform>
4624          return value;
4625        case 1954460585: // parameter
4626          this.getParameter().add((StructureMapGroupRuleTargetParameterComponent) value); // StructureMapGroupRuleTargetParameterComponent
4627          return value;
4628        default: return super.setProperty(hash, name, value);
4629        }
4630
4631      }
4632
4633      @Override
4634      public Base setProperty(String name, Base value) throws FHIRException {
4635        if (name.equals("context")) {
4636          this.context = castToId(value); // IdType
4637        } else if (name.equals("contextType")) {
4638          value = new StructureMapContextTypeEnumFactory().fromType(castToCode(value));
4639          this.contextType = (Enumeration) value; // Enumeration<StructureMapContextType>
4640        } else if (name.equals("element")) {
4641          this.element = castToString(value); // StringType
4642        } else if (name.equals("variable")) {
4643          this.variable = castToId(value); // IdType
4644        } else if (name.equals("listMode")) {
4645          value = new StructureMapTargetListModeEnumFactory().fromType(castToCode(value));
4646          this.getListMode().add((Enumeration) value);
4647        } else if (name.equals("listRuleId")) {
4648          this.listRuleId = castToId(value); // IdType
4649        } else if (name.equals("transform")) {
4650          value = new StructureMapTransformEnumFactory().fromType(castToCode(value));
4651          this.transform = (Enumeration) value; // Enumeration<StructureMapTransform>
4652        } else if (name.equals("parameter")) {
4653          this.getParameter().add((StructureMapGroupRuleTargetParameterComponent) value);
4654        } else
4655          return super.setProperty(name, value);
4656        return value;
4657      }
4658
4659      @Override
4660      public Base makeProperty(int hash, String name) throws FHIRException {
4661        switch (hash) {
4662        case 951530927:  return getContextElement();
4663        case -102839927:  return getContextTypeElement();
4664        case -1662836996:  return getElementElement();
4665        case -1249586564:  return getVariableElement();
4666        case 1345445729:  return addListModeElement();
4667        case 337117045:  return getListRuleIdElement();
4668        case 1052666732:  return getTransformElement();
4669        case 1954460585:  return addParameter(); 
4670        default: return super.makeProperty(hash, name);
4671        }
4672
4673      }
4674
4675      @Override
4676      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4677        switch (hash) {
4678        case 951530927: /*context*/ return new String[] {"id"};
4679        case -102839927: /*contextType*/ return new String[] {"code"};
4680        case -1662836996: /*element*/ return new String[] {"string"};
4681        case -1249586564: /*variable*/ return new String[] {"id"};
4682        case 1345445729: /*listMode*/ return new String[] {"code"};
4683        case 337117045: /*listRuleId*/ return new String[] {"id"};
4684        case 1052666732: /*transform*/ return new String[] {"code"};
4685        case 1954460585: /*parameter*/ return new String[] {};
4686        default: return super.getTypesForProperty(hash, name);
4687        }
4688
4689      }
4690
4691      @Override
4692      public Base addChild(String name) throws FHIRException {
4693        if (name.equals("context")) {
4694          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.context");
4695        }
4696        else if (name.equals("contextType")) {
4697          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.contextType");
4698        }
4699        else if (name.equals("element")) {
4700          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.element");
4701        }
4702        else if (name.equals("variable")) {
4703          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.variable");
4704        }
4705        else if (name.equals("listMode")) {
4706          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.listMode");
4707        }
4708        else if (name.equals("listRuleId")) {
4709          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.listRuleId");
4710        }
4711        else if (name.equals("transform")) {
4712          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.transform");
4713        }
4714        else if (name.equals("parameter")) {
4715          return addParameter();
4716        }
4717        else
4718          return super.addChild(name);
4719      }
4720
4721      public StructureMapGroupRuleTargetComponent copy() {
4722        StructureMapGroupRuleTargetComponent dst = new StructureMapGroupRuleTargetComponent();
4723        copyValues(dst);
4724        dst.context = context == null ? null : context.copy();
4725        dst.contextType = contextType == null ? null : contextType.copy();
4726        dst.element = element == null ? null : element.copy();
4727        dst.variable = variable == null ? null : variable.copy();
4728        if (listMode != null) {
4729          dst.listMode = new ArrayList<Enumeration<StructureMapTargetListMode>>();
4730          for (Enumeration<StructureMapTargetListMode> i : listMode)
4731            dst.listMode.add(i.copy());
4732        };
4733        dst.listRuleId = listRuleId == null ? null : listRuleId.copy();
4734        dst.transform = transform == null ? null : transform.copy();
4735        if (parameter != null) {
4736          dst.parameter = new ArrayList<StructureMapGroupRuleTargetParameterComponent>();
4737          for (StructureMapGroupRuleTargetParameterComponent i : parameter)
4738            dst.parameter.add(i.copy());
4739        };
4740        return dst;
4741      }
4742
4743      @Override
4744      public boolean equalsDeep(Base other_) {
4745        if (!super.equalsDeep(other_))
4746          return false;
4747        if (!(other_ instanceof StructureMapGroupRuleTargetComponent))
4748          return false;
4749        StructureMapGroupRuleTargetComponent o = (StructureMapGroupRuleTargetComponent) other_;
4750        return compareDeep(context, o.context, true) && compareDeep(contextType, o.contextType, true) && compareDeep(element, o.element, true)
4751           && compareDeep(variable, o.variable, true) && compareDeep(listMode, o.listMode, true) && compareDeep(listRuleId, o.listRuleId, true)
4752           && compareDeep(transform, o.transform, true) && compareDeep(parameter, o.parameter, true);
4753      }
4754
4755      @Override
4756      public boolean equalsShallow(Base other_) {
4757        if (!super.equalsShallow(other_))
4758          return false;
4759        if (!(other_ instanceof StructureMapGroupRuleTargetComponent))
4760          return false;
4761        StructureMapGroupRuleTargetComponent o = (StructureMapGroupRuleTargetComponent) other_;
4762        return compareValues(context, o.context, true) && compareValues(contextType, o.contextType, true) && compareValues(element, o.element, true)
4763           && compareValues(variable, o.variable, true) && compareValues(listMode, o.listMode, true) && compareValues(listRuleId, o.listRuleId, true)
4764           && compareValues(transform, o.transform, true);
4765      }
4766
4767      public boolean isEmpty() {
4768        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(context, contextType, element
4769          , variable, listMode, listRuleId, transform, parameter);
4770      }
4771
4772  public String fhirType() {
4773    return "StructureMap.group.rule.target";
4774
4775  }
4776
4777// added from java-adornments.txt:
4778
4779  public String toString() {
4780    return StructureMapUtilities.targetToString(this);
4781  }
4782
4783
4784// end addition
4785  }
4786
4787    @Block()
4788    public static class StructureMapGroupRuleTargetParameterComponent extends BackboneElement implements IBaseBackboneElement {
4789        /**
4790         * Parameter value - variable or literal.
4791         */
4792        @Child(name = "value", type = {IdType.class, StringType.class, BooleanType.class, IntegerType.class, DecimalType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4793        @Description(shortDefinition="Parameter value - variable or literal", formalDefinition="Parameter value - variable or literal." )
4794        protected Type value;
4795
4796        private static final long serialVersionUID = -732981989L;
4797
4798    /**
4799     * Constructor
4800     */
4801      public StructureMapGroupRuleTargetParameterComponent() {
4802        super();
4803      }
4804
4805    /**
4806     * Constructor
4807     */
4808      public StructureMapGroupRuleTargetParameterComponent(Type value) {
4809        super();
4810        this.value = value;
4811      }
4812
4813        /**
4814         * @return {@link #value} (Parameter value - variable or literal.)
4815         */
4816        public Type getValue() { 
4817          return this.value;
4818        }
4819
4820        /**
4821         * @return {@link #value} (Parameter value - variable or literal.)
4822         */
4823        public IdType getValueIdType() throws FHIRException { 
4824          if (this.value == null)
4825            return null;
4826          if (!(this.value instanceof IdType))
4827            throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.value.getClass().getName()+" was encountered");
4828          return (IdType) this.value;
4829        }
4830
4831        public boolean hasValueIdType() { 
4832          return this != null && this.value instanceof IdType;
4833        }
4834
4835        /**
4836         * @return {@link #value} (Parameter value - variable or literal.)
4837         */
4838        public StringType getValueStringType() throws FHIRException { 
4839          if (this.value == null)
4840            return null;
4841          if (!(this.value instanceof StringType))
4842            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
4843          return (StringType) this.value;
4844        }
4845
4846        public boolean hasValueStringType() { 
4847          return this != null && this.value instanceof StringType;
4848        }
4849
4850        /**
4851         * @return {@link #value} (Parameter value - variable or literal.)
4852         */
4853        public BooleanType getValueBooleanType() throws FHIRException { 
4854          if (this.value == null)
4855            return null;
4856          if (!(this.value instanceof BooleanType))
4857            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
4858          return (BooleanType) this.value;
4859        }
4860
4861        public boolean hasValueBooleanType() { 
4862          return this != null && this.value instanceof BooleanType;
4863        }
4864
4865        /**
4866         * @return {@link #value} (Parameter value - variable or literal.)
4867         */
4868        public IntegerType getValueIntegerType() throws FHIRException { 
4869          if (this.value == null)
4870            return null;
4871          if (!(this.value instanceof IntegerType))
4872            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
4873          return (IntegerType) this.value;
4874        }
4875
4876        public boolean hasValueIntegerType() { 
4877          return this != null && this.value instanceof IntegerType;
4878        }
4879
4880        /**
4881         * @return {@link #value} (Parameter value - variable or literal.)
4882         */
4883        public DecimalType getValueDecimalType() throws FHIRException { 
4884          if (this.value == null)
4885            return null;
4886          if (!(this.value instanceof DecimalType))
4887            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
4888          return (DecimalType) this.value;
4889        }
4890
4891        public boolean hasValueDecimalType() { 
4892          return this != null && this.value instanceof DecimalType;
4893        }
4894
4895        public boolean hasValue() { 
4896          return this.value != null && !this.value.isEmpty();
4897        }
4898
4899        /**
4900         * @param value {@link #value} (Parameter value - variable or literal.)
4901         */
4902        public StructureMapGroupRuleTargetParameterComponent setValue(Type value) { 
4903          if (value != null && !(value instanceof IdType || value instanceof StringType || value instanceof BooleanType || value instanceof IntegerType || value instanceof DecimalType))
4904            throw new Error("Not the right type for StructureMap.group.rule.target.parameter.value[x]: "+value.fhirType());
4905          this.value = value;
4906          return this;
4907        }
4908
4909        protected void listChildren(List<Property> children) {
4910          super.listChildren(children);
4911          children.add(new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value));
4912        }
4913
4914        @Override
4915        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4916          switch (_hash) {
4917          case -1410166417: /*value[x]*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4918          case 111972721: /*value*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4919          case 231604844: /*valueId*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4920          case -1424603934: /*valueString*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4921          case 733421943: /*valueBoolean*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4922          case -1668204915: /*valueInteger*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4923          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "id|string|boolean|integer|decimal", "Parameter value - variable or literal.", 0, 1, value);
4924          default: return super.getNamedProperty(_hash, _name, _checkValid);
4925          }
4926
4927        }
4928
4929      @Override
4930      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4931        switch (hash) {
4932        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
4933        default: return super.getProperty(hash, name, checkValid);
4934        }
4935
4936      }
4937
4938      @Override
4939      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4940        switch (hash) {
4941        case 111972721: // value
4942          this.value = castToType(value); // Type
4943          return value;
4944        default: return super.setProperty(hash, name, value);
4945        }
4946
4947      }
4948
4949      @Override
4950      public Base setProperty(String name, Base value) throws FHIRException {
4951        if (name.equals("value[x]")) {
4952          this.value = castToType(value); // Type
4953        } else
4954          return super.setProperty(name, value);
4955        return value;
4956      }
4957
4958      @Override
4959      public Base makeProperty(int hash, String name) throws FHIRException {
4960        switch (hash) {
4961        case -1410166417:  return getValue(); 
4962        case 111972721:  return getValue(); 
4963        default: return super.makeProperty(hash, name);
4964        }
4965
4966      }
4967
4968      @Override
4969      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4970        switch (hash) {
4971        case 111972721: /*value*/ return new String[] {"id", "string", "boolean", "integer", "decimal"};
4972        default: return super.getTypesForProperty(hash, name);
4973        }
4974
4975      }
4976
4977      @Override
4978      public Base addChild(String name) throws FHIRException {
4979        if (name.equals("valueId")) {
4980          this.value = new IdType();
4981          return this.value;
4982        }
4983        else if (name.equals("valueString")) {
4984          this.value = new StringType();
4985          return this.value;
4986        }
4987        else if (name.equals("valueBoolean")) {
4988          this.value = new BooleanType();
4989          return this.value;
4990        }
4991        else if (name.equals("valueInteger")) {
4992          this.value = new IntegerType();
4993          return this.value;
4994        }
4995        else if (name.equals("valueDecimal")) {
4996          this.value = new DecimalType();
4997          return this.value;
4998        }
4999        else
5000          return super.addChild(name);
5001      }
5002
5003      public StructureMapGroupRuleTargetParameterComponent copy() {
5004        StructureMapGroupRuleTargetParameterComponent dst = new StructureMapGroupRuleTargetParameterComponent();
5005        copyValues(dst);
5006        dst.value = value == null ? null : value.copy();
5007        return dst;
5008      }
5009
5010      @Override
5011      public boolean equalsDeep(Base other_) {
5012        if (!super.equalsDeep(other_))
5013          return false;
5014        if (!(other_ instanceof StructureMapGroupRuleTargetParameterComponent))
5015          return false;
5016        StructureMapGroupRuleTargetParameterComponent o = (StructureMapGroupRuleTargetParameterComponent) other_;
5017        return compareDeep(value, o.value, true);
5018      }
5019
5020      @Override
5021      public boolean equalsShallow(Base other_) {
5022        if (!super.equalsShallow(other_))
5023          return false;
5024        if (!(other_ instanceof StructureMapGroupRuleTargetParameterComponent))
5025          return false;
5026        StructureMapGroupRuleTargetParameterComponent o = (StructureMapGroupRuleTargetParameterComponent) other_;
5027        return true;
5028      }
5029
5030      public boolean isEmpty() {
5031        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
5032      }
5033
5034  public String fhirType() {
5035    return "StructureMap.group.rule.target.parameter";
5036
5037  }
5038
5039// added from java-adornments.txt:
5040
5041      public String toString() {
5042        return value == null ? "null!" : value.toString();
5043      }
5044
5045
5046
5047// end addition
5048  }
5049
5050    @Block()
5051    public static class StructureMapGroupRuleDependentComponent extends BackboneElement implements IBaseBackboneElement {
5052        /**
5053         * Name of a rule or group to apply.
5054         */
5055        @Child(name = "name", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
5056        @Description(shortDefinition="Name of a rule or group to apply", formalDefinition="Name of a rule or group to apply." )
5057        protected IdType name;
5058
5059        /**
5060         * Variable to pass to the rule or group.
5061         */
5062        @Child(name = "variable", type = {StringType.class}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5063        @Description(shortDefinition="Variable to pass to the rule or group", formalDefinition="Variable to pass to the rule or group." )
5064        protected List<StringType> variable;
5065
5066        private static final long serialVersionUID = 1021661591L;
5067
5068    /**
5069     * Constructor
5070     */
5071      public StructureMapGroupRuleDependentComponent() {
5072        super();
5073      }
5074
5075    /**
5076     * Constructor
5077     */
5078      public StructureMapGroupRuleDependentComponent(IdType name) {
5079        super();
5080        this.name = name;
5081      }
5082
5083        /**
5084         * @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
5085         */
5086        public IdType getNameElement() { 
5087          if (this.name == null)
5088            if (Configuration.errorOnAutoCreate())
5089              throw new Error("Attempt to auto-create StructureMapGroupRuleDependentComponent.name");
5090            else if (Configuration.doAutoCreate())
5091              this.name = new IdType(); // bb
5092          return this.name;
5093        }
5094
5095        public boolean hasNameElement() { 
5096          return this.name != null && !this.name.isEmpty();
5097        }
5098
5099        public boolean hasName() { 
5100          return this.name != null && !this.name.isEmpty();
5101        }
5102
5103        /**
5104         * @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
5105         */
5106        public StructureMapGroupRuleDependentComponent setNameElement(IdType value) { 
5107          this.name = value;
5108          return this;
5109        }
5110
5111        /**
5112         * @return Name of a rule or group to apply.
5113         */
5114        public String getName() { 
5115          return this.name == null ? null : this.name.getValue();
5116        }
5117
5118        /**
5119         * @param value Name of a rule or group to apply.
5120         */
5121        public StructureMapGroupRuleDependentComponent setName(String value) { 
5122            if (this.name == null)
5123              this.name = new IdType();
5124            this.name.setValue(value);
5125          return this;
5126        }
5127
5128        /**
5129         * @return {@link #variable} (Variable to pass to the rule or group.)
5130         */
5131        public List<StringType> getVariable() { 
5132          if (this.variable == null)
5133            this.variable = new ArrayList<StringType>();
5134          return this.variable;
5135        }
5136
5137        /**
5138         * @return Returns a reference to <code>this</code> for easy method chaining
5139         */
5140        public StructureMapGroupRuleDependentComponent setVariable(List<StringType> theVariable) { 
5141          this.variable = theVariable;
5142          return this;
5143        }
5144
5145        public boolean hasVariable() { 
5146          if (this.variable == null)
5147            return false;
5148          for (StringType item : this.variable)
5149            if (!item.isEmpty())
5150              return true;
5151          return false;
5152        }
5153
5154        /**
5155         * @return {@link #variable} (Variable to pass to the rule or group.)
5156         */
5157        public StringType addVariableElement() {//2 
5158          StringType t = new StringType();
5159          if (this.variable == null)
5160            this.variable = new ArrayList<StringType>();
5161          this.variable.add(t);
5162          return t;
5163        }
5164
5165        /**
5166         * @param value {@link #variable} (Variable to pass to the rule or group.)
5167         */
5168        public StructureMapGroupRuleDependentComponent addVariable(String value) { //1
5169          StringType t = new StringType();
5170          t.setValue(value);
5171          if (this.variable == null)
5172            this.variable = new ArrayList<StringType>();
5173          this.variable.add(t);
5174          return this;
5175        }
5176
5177        /**
5178         * @param value {@link #variable} (Variable to pass to the rule or group.)
5179         */
5180        public boolean hasVariable(String value) { 
5181          if (this.variable == null)
5182            return false;
5183          for (StringType v : this.variable)
5184            if (v.getValue().equals(value)) // string
5185              return true;
5186          return false;
5187        }
5188
5189        protected void listChildren(List<Property> children) {
5190          super.listChildren(children);
5191          children.add(new Property("name", "id", "Name of a rule or group to apply.", 0, 1, name));
5192          children.add(new Property("variable", "string", "Variable to pass to the rule or group.", 0, java.lang.Integer.MAX_VALUE, variable));
5193        }
5194
5195        @Override
5196        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5197          switch (_hash) {
5198          case 3373707: /*name*/  return new Property("name", "id", "Name of a rule or group to apply.", 0, 1, name);
5199          case -1249586564: /*variable*/  return new Property("variable", "string", "Variable to pass to the rule or group.", 0, java.lang.Integer.MAX_VALUE, variable);
5200          default: return super.getNamedProperty(_hash, _name, _checkValid);
5201          }
5202
5203        }
5204
5205      @Override
5206      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5207        switch (hash) {
5208        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // IdType
5209        case -1249586564: /*variable*/ return this.variable == null ? new Base[0] : this.variable.toArray(new Base[this.variable.size()]); // StringType
5210        default: return super.getProperty(hash, name, checkValid);
5211        }
5212
5213      }
5214
5215      @Override
5216      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5217        switch (hash) {
5218        case 3373707: // name
5219          this.name = castToId(value); // IdType
5220          return value;
5221        case -1249586564: // variable
5222          this.getVariable().add(castToString(value)); // StringType
5223          return value;
5224        default: return super.setProperty(hash, name, value);
5225        }
5226
5227      }
5228
5229      @Override
5230      public Base setProperty(String name, Base value) throws FHIRException {
5231        if (name.equals("name")) {
5232          this.name = castToId(value); // IdType
5233        } else if (name.equals("variable")) {
5234          this.getVariable().add(castToString(value));
5235        } else
5236          return super.setProperty(name, value);
5237        return value;
5238      }
5239
5240      @Override
5241      public Base makeProperty(int hash, String name) throws FHIRException {
5242        switch (hash) {
5243        case 3373707:  return getNameElement();
5244        case -1249586564:  return addVariableElement();
5245        default: return super.makeProperty(hash, name);
5246        }
5247
5248      }
5249
5250      @Override
5251      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5252        switch (hash) {
5253        case 3373707: /*name*/ return new String[] {"id"};
5254        case -1249586564: /*variable*/ return new String[] {"string"};
5255        default: return super.getTypesForProperty(hash, name);
5256        }
5257
5258      }
5259
5260      @Override
5261      public Base addChild(String name) throws FHIRException {
5262        if (name.equals("name")) {
5263          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
5264        }
5265        else if (name.equals("variable")) {
5266          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.variable");
5267        }
5268        else
5269          return super.addChild(name);
5270      }
5271
5272      public StructureMapGroupRuleDependentComponent copy() {
5273        StructureMapGroupRuleDependentComponent dst = new StructureMapGroupRuleDependentComponent();
5274        copyValues(dst);
5275        dst.name = name == null ? null : name.copy();
5276        if (variable != null) {
5277          dst.variable = new ArrayList<StringType>();
5278          for (StringType i : variable)
5279            dst.variable.add(i.copy());
5280        };
5281        return dst;
5282      }
5283
5284      @Override
5285      public boolean equalsDeep(Base other_) {
5286        if (!super.equalsDeep(other_))
5287          return false;
5288        if (!(other_ instanceof StructureMapGroupRuleDependentComponent))
5289          return false;
5290        StructureMapGroupRuleDependentComponent o = (StructureMapGroupRuleDependentComponent) other_;
5291        return compareDeep(name, o.name, true) && compareDeep(variable, o.variable, true);
5292      }
5293
5294      @Override
5295      public boolean equalsShallow(Base other_) {
5296        if (!super.equalsShallow(other_))
5297          return false;
5298        if (!(other_ instanceof StructureMapGroupRuleDependentComponent))
5299          return false;
5300        StructureMapGroupRuleDependentComponent o = (StructureMapGroupRuleDependentComponent) other_;
5301        return compareValues(name, o.name, true) && compareValues(variable, o.variable, true);
5302      }
5303
5304      public boolean isEmpty() {
5305        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, variable);
5306      }
5307
5308  public String fhirType() {
5309    return "StructureMap.group.rule.dependent";
5310
5311  }
5312
5313  }
5314
5315    /**
5316     * 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.
5317     */
5318    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5319    @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." )
5320    protected List<Identifier> identifier;
5321
5322    /**
5323     * Explanation of why this structure map is needed and why it has been designed as it has.
5324     */
5325    @Child(name = "purpose", type = {MarkdownType.class}, order=1, min=0, max=1, modifier=false, summary=false)
5326    @Description(shortDefinition="Why this structure map is defined", formalDefinition="Explanation of why this structure map is needed and why it has been designed as it has." )
5327    protected MarkdownType purpose;
5328
5329    /**
5330     * 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.
5331     */
5332    @Child(name = "copyright", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
5333    @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." )
5334    protected MarkdownType copyright;
5335
5336    /**
5337     * A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced.
5338     */
5339    @Child(name = "structure", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5340    @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." )
5341    protected List<StructureMapStructureComponent> structure;
5342
5343    /**
5344     * Other maps used by this map (canonical URLs).
5345     */
5346    @Child(name = "import", type = {CanonicalType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5347    @Description(shortDefinition="Other maps used by this map (canonical URLs)", formalDefinition="Other maps used by this map (canonical URLs)." )
5348    protected List<CanonicalType> import_;
5349
5350    /**
5351     * Organizes the mapping into manageable chunks for human review/ease of maintenance.
5352     */
5353    @Child(name = "group", type = {}, order=5, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5354    @Description(shortDefinition="Named sections for reader convenience", formalDefinition="Organizes the mapping into manageable chunks for human review/ease of maintenance." )
5355    protected List<StructureMapGroupComponent> group;
5356
5357    private static final long serialVersionUID = 263060597L;
5358
5359  /**
5360   * Constructor
5361   */
5362    public StructureMap() {
5363      super();
5364    }
5365
5366  /**
5367   * Constructor
5368   */
5369    public StructureMap(UriType url, StringType name, Enumeration<PublicationStatus> status) {
5370      super();
5371      this.url = url;
5372      this.name = name;
5373      this.status = status;
5374    }
5375
5376    /**
5377     * @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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this structure map is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the structure map is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
5378     */
5379    public UriType getUrlElement() { 
5380      if (this.url == null)
5381        if (Configuration.errorOnAutoCreate())
5382          throw new Error("Attempt to auto-create StructureMap.url");
5383        else if (Configuration.doAutoCreate())
5384          this.url = new UriType(); // bb
5385      return this.url;
5386    }
5387
5388    public boolean hasUrlElement() { 
5389      return this.url != null && !this.url.isEmpty();
5390    }
5391
5392    public boolean hasUrl() { 
5393      return this.url != null && !this.url.isEmpty();
5394    }
5395
5396    /**
5397     * @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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this structure map is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the structure map is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
5398     */
5399    public StructureMap setUrlElement(UriType value) { 
5400      this.url = value;
5401      return this;
5402    }
5403
5404    /**
5405     * @return An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this structure map is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the structure map is stored on different servers.
5406     */
5407    public String getUrl() { 
5408      return this.url == null ? null : this.url.getValue();
5409    }
5410
5411    /**
5412     * @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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this structure map is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the structure map is stored on different servers.
5413     */
5414    public StructureMap setUrl(String value) { 
5415        if (this.url == null)
5416          this.url = new UriType();
5417        this.url.setValue(value);
5418      return this;
5419    }
5420
5421    /**
5422     * @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.)
5423     */
5424    public List<Identifier> getIdentifier() { 
5425      if (this.identifier == null)
5426        this.identifier = new ArrayList<Identifier>();
5427      return this.identifier;
5428    }
5429
5430    /**
5431     * @return Returns a reference to <code>this</code> for easy method chaining
5432     */
5433    public StructureMap setIdentifier(List<Identifier> theIdentifier) { 
5434      this.identifier = theIdentifier;
5435      return this;
5436    }
5437
5438    public boolean hasIdentifier() { 
5439      if (this.identifier == null)
5440        return false;
5441      for (Identifier item : this.identifier)
5442        if (!item.isEmpty())
5443          return true;
5444      return false;
5445    }
5446
5447    public Identifier addIdentifier() { //3
5448      Identifier t = new Identifier();
5449      if (this.identifier == null)
5450        this.identifier = new ArrayList<Identifier>();
5451      this.identifier.add(t);
5452      return t;
5453    }
5454
5455    public StructureMap addIdentifier(Identifier t) { //3
5456      if (t == null)
5457        return this;
5458      if (this.identifier == null)
5459        this.identifier = new ArrayList<Identifier>();
5460      this.identifier.add(t);
5461      return this;
5462    }
5463
5464    /**
5465     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
5466     */
5467    public Identifier getIdentifierFirstRep() { 
5468      if (getIdentifier().isEmpty()) {
5469        addIdentifier();
5470      }
5471      return getIdentifier().get(0);
5472    }
5473
5474    /**
5475     * @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
5476     */
5477    public StringType getVersionElement() { 
5478      if (this.version == null)
5479        if (Configuration.errorOnAutoCreate())
5480          throw new Error("Attempt to auto-create StructureMap.version");
5481        else if (Configuration.doAutoCreate())
5482          this.version = new StringType(); // bb
5483      return this.version;
5484    }
5485
5486    public boolean hasVersionElement() { 
5487      return this.version != null && !this.version.isEmpty();
5488    }
5489
5490    public boolean hasVersion() { 
5491      return this.version != null && !this.version.isEmpty();
5492    }
5493
5494    /**
5495     * @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
5496     */
5497    public StructureMap setVersionElement(StringType value) { 
5498      this.version = value;
5499      return this;
5500    }
5501
5502    /**
5503     * @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.
5504     */
5505    public String getVersion() { 
5506      return this.version == null ? null : this.version.getValue();
5507    }
5508
5509    /**
5510     * @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.
5511     */
5512    public StructureMap setVersion(String value) { 
5513      if (Utilities.noString(value))
5514        this.version = null;
5515      else {
5516        if (this.version == null)
5517          this.version = new StringType();
5518        this.version.setValue(value);
5519      }
5520      return this;
5521    }
5522
5523    /**
5524     * @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
5525     */
5526    public StringType getNameElement() { 
5527      if (this.name == null)
5528        if (Configuration.errorOnAutoCreate())
5529          throw new Error("Attempt to auto-create StructureMap.name");
5530        else if (Configuration.doAutoCreate())
5531          this.name = new StringType(); // bb
5532      return this.name;
5533    }
5534
5535    public boolean hasNameElement() { 
5536      return this.name != null && !this.name.isEmpty();
5537    }
5538
5539    public boolean hasName() { 
5540      return this.name != null && !this.name.isEmpty();
5541    }
5542
5543    /**
5544     * @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
5545     */
5546    public StructureMap setNameElement(StringType value) { 
5547      this.name = value;
5548      return this;
5549    }
5550
5551    /**
5552     * @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.
5553     */
5554    public String getName() { 
5555      return this.name == null ? null : this.name.getValue();
5556    }
5557
5558    /**
5559     * @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.
5560     */
5561    public StructureMap setName(String value) { 
5562        if (this.name == null)
5563          this.name = new StringType();
5564        this.name.setValue(value);
5565      return this;
5566    }
5567
5568    /**
5569     * @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
5570     */
5571    public StringType getTitleElement() { 
5572      if (this.title == null)
5573        if (Configuration.errorOnAutoCreate())
5574          throw new Error("Attempt to auto-create StructureMap.title");
5575        else if (Configuration.doAutoCreate())
5576          this.title = new StringType(); // bb
5577      return this.title;
5578    }
5579
5580    public boolean hasTitleElement() { 
5581      return this.title != null && !this.title.isEmpty();
5582    }
5583
5584    public boolean hasTitle() { 
5585      return this.title != null && !this.title.isEmpty();
5586    }
5587
5588    /**
5589     * @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
5590     */
5591    public StructureMap setTitleElement(StringType value) { 
5592      this.title = value;
5593      return this;
5594    }
5595
5596    /**
5597     * @return A short, descriptive, user-friendly title for the structure map.
5598     */
5599    public String getTitle() { 
5600      return this.title == null ? null : this.title.getValue();
5601    }
5602
5603    /**
5604     * @param value A short, descriptive, user-friendly title for the structure map.
5605     */
5606    public StructureMap setTitle(String value) { 
5607      if (Utilities.noString(value))
5608        this.title = null;
5609      else {
5610        if (this.title == null)
5611          this.title = new StringType();
5612        this.title.setValue(value);
5613      }
5614      return this;
5615    }
5616
5617    /**
5618     * @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
5619     */
5620    public Enumeration<PublicationStatus> getStatusElement() { 
5621      if (this.status == null)
5622        if (Configuration.errorOnAutoCreate())
5623          throw new Error("Attempt to auto-create StructureMap.status");
5624        else if (Configuration.doAutoCreate())
5625          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
5626      return this.status;
5627    }
5628
5629    public boolean hasStatusElement() { 
5630      return this.status != null && !this.status.isEmpty();
5631    }
5632
5633    public boolean hasStatus() { 
5634      return this.status != null && !this.status.isEmpty();
5635    }
5636
5637    /**
5638     * @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
5639     */
5640    public StructureMap setStatusElement(Enumeration<PublicationStatus> value) { 
5641      this.status = value;
5642      return this;
5643    }
5644
5645    /**
5646     * @return The status of this structure map. Enables tracking the life-cycle of the content.
5647     */
5648    public PublicationStatus getStatus() { 
5649      return this.status == null ? null : this.status.getValue();
5650    }
5651
5652    /**
5653     * @param value The status of this structure map. Enables tracking the life-cycle of the content.
5654     */
5655    public StructureMap setStatus(PublicationStatus value) { 
5656        if (this.status == null)
5657          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
5658        this.status.setValue(value);
5659      return this;
5660    }
5661
5662    /**
5663     * @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
5664     */
5665    public BooleanType getExperimentalElement() { 
5666      if (this.experimental == null)
5667        if (Configuration.errorOnAutoCreate())
5668          throw new Error("Attempt to auto-create StructureMap.experimental");
5669        else if (Configuration.doAutoCreate())
5670          this.experimental = new BooleanType(); // bb
5671      return this.experimental;
5672    }
5673
5674    public boolean hasExperimentalElement() { 
5675      return this.experimental != null && !this.experimental.isEmpty();
5676    }
5677
5678    public boolean hasExperimental() { 
5679      return this.experimental != null && !this.experimental.isEmpty();
5680    }
5681
5682    /**
5683     * @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
5684     */
5685    public StructureMap setExperimentalElement(BooleanType value) { 
5686      this.experimental = value;
5687      return this;
5688    }
5689
5690    /**
5691     * @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.
5692     */
5693    public boolean getExperimental() { 
5694      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
5695    }
5696
5697    /**
5698     * @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.
5699     */
5700    public StructureMap setExperimental(boolean value) { 
5701        if (this.experimental == null)
5702          this.experimental = new BooleanType();
5703        this.experimental.setValue(value);
5704      return this;
5705    }
5706
5707    /**
5708     * @return {@link #date} (The date  (and optionally time) when the structure map was published. The date must change 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
5709     */
5710    public DateTimeType getDateElement() { 
5711      if (this.date == null)
5712        if (Configuration.errorOnAutoCreate())
5713          throw new Error("Attempt to auto-create StructureMap.date");
5714        else if (Configuration.doAutoCreate())
5715          this.date = new DateTimeType(); // bb
5716      return this.date;
5717    }
5718
5719    public boolean hasDateElement() { 
5720      return this.date != null && !this.date.isEmpty();
5721    }
5722
5723    public boolean hasDate() { 
5724      return this.date != null && !this.date.isEmpty();
5725    }
5726
5727    /**
5728     * @param value {@link #date} (The date  (and optionally time) when the structure map was published. The date must change 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
5729     */
5730    public StructureMap setDateElement(DateTimeType value) { 
5731      this.date = value;
5732      return this;
5733    }
5734
5735    /**
5736     * @return The date  (and optionally time) when the structure map was published. The date must change 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.
5737     */
5738    public Date getDate() { 
5739      return this.date == null ? null : this.date.getValue();
5740    }
5741
5742    /**
5743     * @param value The date  (and optionally time) when the structure map was published. The date must change 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.
5744     */
5745    public StructureMap setDate(Date value) { 
5746      if (value == null)
5747        this.date = null;
5748      else {
5749        if (this.date == null)
5750          this.date = new DateTimeType();
5751        this.date.setValue(value);
5752      }
5753      return this;
5754    }
5755
5756    /**
5757     * @return {@link #publisher} (The name of the organization or individual that published the structure map.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
5758     */
5759    public StringType getPublisherElement() { 
5760      if (this.publisher == null)
5761        if (Configuration.errorOnAutoCreate())
5762          throw new Error("Attempt to auto-create StructureMap.publisher");
5763        else if (Configuration.doAutoCreate())
5764          this.publisher = new StringType(); // bb
5765      return this.publisher;
5766    }
5767
5768    public boolean hasPublisherElement() { 
5769      return this.publisher != null && !this.publisher.isEmpty();
5770    }
5771
5772    public boolean hasPublisher() { 
5773      return this.publisher != null && !this.publisher.isEmpty();
5774    }
5775
5776    /**
5777     * @param value {@link #publisher} (The name of the organization or individual that published the structure map.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
5778     */
5779    public StructureMap setPublisherElement(StringType value) { 
5780      this.publisher = value;
5781      return this;
5782    }
5783
5784    /**
5785     * @return The name of the organization or individual that published the structure map.
5786     */
5787    public String getPublisher() { 
5788      return this.publisher == null ? null : this.publisher.getValue();
5789    }
5790
5791    /**
5792     * @param value The name of the organization or individual that published the structure map.
5793     */
5794    public StructureMap setPublisher(String value) { 
5795      if (Utilities.noString(value))
5796        this.publisher = null;
5797      else {
5798        if (this.publisher == null)
5799          this.publisher = new StringType();
5800        this.publisher.setValue(value);
5801      }
5802      return this;
5803    }
5804
5805    /**
5806     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
5807     */
5808    public List<ContactDetail> getContact() { 
5809      if (this.contact == null)
5810        this.contact = new ArrayList<ContactDetail>();
5811      return this.contact;
5812    }
5813
5814    /**
5815     * @return Returns a reference to <code>this</code> for easy method chaining
5816     */
5817    public StructureMap setContact(List<ContactDetail> theContact) { 
5818      this.contact = theContact;
5819      return this;
5820    }
5821
5822    public boolean hasContact() { 
5823      if (this.contact == null)
5824        return false;
5825      for (ContactDetail item : this.contact)
5826        if (!item.isEmpty())
5827          return true;
5828      return false;
5829    }
5830
5831    public ContactDetail addContact() { //3
5832      ContactDetail t = new ContactDetail();
5833      if (this.contact == null)
5834        this.contact = new ArrayList<ContactDetail>();
5835      this.contact.add(t);
5836      return t;
5837    }
5838
5839    public StructureMap addContact(ContactDetail t) { //3
5840      if (t == null)
5841        return this;
5842      if (this.contact == null)
5843        this.contact = new ArrayList<ContactDetail>();
5844      this.contact.add(t);
5845      return this;
5846    }
5847
5848    /**
5849     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
5850     */
5851    public ContactDetail getContactFirstRep() { 
5852      if (getContact().isEmpty()) {
5853        addContact();
5854      }
5855      return getContact().get(0);
5856    }
5857
5858    /**
5859     * @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
5860     */
5861    public MarkdownType getDescriptionElement() { 
5862      if (this.description == null)
5863        if (Configuration.errorOnAutoCreate())
5864          throw new Error("Attempt to auto-create StructureMap.description");
5865        else if (Configuration.doAutoCreate())
5866          this.description = new MarkdownType(); // bb
5867      return this.description;
5868    }
5869
5870    public boolean hasDescriptionElement() { 
5871      return this.description != null && !this.description.isEmpty();
5872    }
5873
5874    public boolean hasDescription() { 
5875      return this.description != null && !this.description.isEmpty();
5876    }
5877
5878    /**
5879     * @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
5880     */
5881    public StructureMap setDescriptionElement(MarkdownType value) { 
5882      this.description = value;
5883      return this;
5884    }
5885
5886    /**
5887     * @return A free text natural language description of the structure map from a consumer's perspective.
5888     */
5889    public String getDescription() { 
5890      return this.description == null ? null : this.description.getValue();
5891    }
5892
5893    /**
5894     * @param value A free text natural language description of the structure map from a consumer's perspective.
5895     */
5896    public StructureMap setDescription(String value) { 
5897      if (value == null)
5898        this.description = null;
5899      else {
5900        if (this.description == null)
5901          this.description = new MarkdownType();
5902        this.description.setValue(value);
5903      }
5904      return this;
5905    }
5906
5907    /**
5908     * @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.)
5909     */
5910    public List<UsageContext> getUseContext() { 
5911      if (this.useContext == null)
5912        this.useContext = new ArrayList<UsageContext>();
5913      return this.useContext;
5914    }
5915
5916    /**
5917     * @return Returns a reference to <code>this</code> for easy method chaining
5918     */
5919    public StructureMap setUseContext(List<UsageContext> theUseContext) { 
5920      this.useContext = theUseContext;
5921      return this;
5922    }
5923
5924    public boolean hasUseContext() { 
5925      if (this.useContext == null)
5926        return false;
5927      for (UsageContext item : this.useContext)
5928        if (!item.isEmpty())
5929          return true;
5930      return false;
5931    }
5932
5933    public UsageContext addUseContext() { //3
5934      UsageContext t = new UsageContext();
5935      if (this.useContext == null)
5936        this.useContext = new ArrayList<UsageContext>();
5937      this.useContext.add(t);
5938      return t;
5939    }
5940
5941    public StructureMap addUseContext(UsageContext t) { //3
5942      if (t == null)
5943        return this;
5944      if (this.useContext == null)
5945        this.useContext = new ArrayList<UsageContext>();
5946      this.useContext.add(t);
5947      return this;
5948    }
5949
5950    /**
5951     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
5952     */
5953    public UsageContext getUseContextFirstRep() { 
5954      if (getUseContext().isEmpty()) {
5955        addUseContext();
5956      }
5957      return getUseContext().get(0);
5958    }
5959
5960    /**
5961     * @return {@link #jurisdiction} (A legal or geographic region in which the structure map is intended to be used.)
5962     */
5963    public List<CodeableConcept> getJurisdiction() { 
5964      if (this.jurisdiction == null)
5965        this.jurisdiction = new ArrayList<CodeableConcept>();
5966      return this.jurisdiction;
5967    }
5968
5969    /**
5970     * @return Returns a reference to <code>this</code> for easy method chaining
5971     */
5972    public StructureMap setJurisdiction(List<CodeableConcept> theJurisdiction) { 
5973      this.jurisdiction = theJurisdiction;
5974      return this;
5975    }
5976
5977    public boolean hasJurisdiction() { 
5978      if (this.jurisdiction == null)
5979        return false;
5980      for (CodeableConcept item : this.jurisdiction)
5981        if (!item.isEmpty())
5982          return true;
5983      return false;
5984    }
5985
5986    public CodeableConcept addJurisdiction() { //3
5987      CodeableConcept t = new CodeableConcept();
5988      if (this.jurisdiction == null)
5989        this.jurisdiction = new ArrayList<CodeableConcept>();
5990      this.jurisdiction.add(t);
5991      return t;
5992    }
5993
5994    public StructureMap addJurisdiction(CodeableConcept t) { //3
5995      if (t == null)
5996        return this;
5997      if (this.jurisdiction == null)
5998        this.jurisdiction = new ArrayList<CodeableConcept>();
5999      this.jurisdiction.add(t);
6000      return this;
6001    }
6002
6003    /**
6004     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
6005     */
6006    public CodeableConcept getJurisdictionFirstRep() { 
6007      if (getJurisdiction().isEmpty()) {
6008        addJurisdiction();
6009      }
6010      return getJurisdiction().get(0);
6011    }
6012
6013    /**
6014     * @return {@link #purpose} (Explanation 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
6015     */
6016    public MarkdownType getPurposeElement() { 
6017      if (this.purpose == null)
6018        if (Configuration.errorOnAutoCreate())
6019          throw new Error("Attempt to auto-create StructureMap.purpose");
6020        else if (Configuration.doAutoCreate())
6021          this.purpose = new MarkdownType(); // bb
6022      return this.purpose;
6023    }
6024
6025    public boolean hasPurposeElement() { 
6026      return this.purpose != null && !this.purpose.isEmpty();
6027    }
6028
6029    public boolean hasPurpose() { 
6030      return this.purpose != null && !this.purpose.isEmpty();
6031    }
6032
6033    /**
6034     * @param value {@link #purpose} (Explanation 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
6035     */
6036    public StructureMap setPurposeElement(MarkdownType value) { 
6037      this.purpose = value;
6038      return this;
6039    }
6040
6041    /**
6042     * @return Explanation of why this structure map is needed and why it has been designed as it has.
6043     */
6044    public String getPurpose() { 
6045      return this.purpose == null ? null : this.purpose.getValue();
6046    }
6047
6048    /**
6049     * @param value Explanation of why this structure map is needed and why it has been designed as it has.
6050     */
6051    public StructureMap setPurpose(String value) { 
6052      if (value == null)
6053        this.purpose = null;
6054      else {
6055        if (this.purpose == null)
6056          this.purpose = new MarkdownType();
6057        this.purpose.setValue(value);
6058      }
6059      return this;
6060    }
6061
6062    /**
6063     * @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
6064     */
6065    public MarkdownType getCopyrightElement() { 
6066      if (this.copyright == null)
6067        if (Configuration.errorOnAutoCreate())
6068          throw new Error("Attempt to auto-create StructureMap.copyright");
6069        else if (Configuration.doAutoCreate())
6070          this.copyright = new MarkdownType(); // bb
6071      return this.copyright;
6072    }
6073
6074    public boolean hasCopyrightElement() { 
6075      return this.copyright != null && !this.copyright.isEmpty();
6076    }
6077
6078    public boolean hasCopyright() { 
6079      return this.copyright != null && !this.copyright.isEmpty();
6080    }
6081
6082    /**
6083     * @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
6084     */
6085    public StructureMap setCopyrightElement(MarkdownType value) { 
6086      this.copyright = value;
6087      return this;
6088    }
6089
6090    /**
6091     * @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.
6092     */
6093    public String getCopyright() { 
6094      return this.copyright == null ? null : this.copyright.getValue();
6095    }
6096
6097    /**
6098     * @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.
6099     */
6100    public StructureMap setCopyright(String value) { 
6101      if (value == null)
6102        this.copyright = null;
6103      else {
6104        if (this.copyright == null)
6105          this.copyright = new MarkdownType();
6106        this.copyright.setValue(value);
6107      }
6108      return this;
6109    }
6110
6111    /**
6112     * @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.)
6113     */
6114    public List<StructureMapStructureComponent> getStructure() { 
6115      if (this.structure == null)
6116        this.structure = new ArrayList<StructureMapStructureComponent>();
6117      return this.structure;
6118    }
6119
6120    /**
6121     * @return Returns a reference to <code>this</code> for easy method chaining
6122     */
6123    public StructureMap setStructure(List<StructureMapStructureComponent> theStructure) { 
6124      this.structure = theStructure;
6125      return this;
6126    }
6127
6128    public boolean hasStructure() { 
6129      if (this.structure == null)
6130        return false;
6131      for (StructureMapStructureComponent item : this.structure)
6132        if (!item.isEmpty())
6133          return true;
6134      return false;
6135    }
6136
6137    public StructureMapStructureComponent addStructure() { //3
6138      StructureMapStructureComponent t = new StructureMapStructureComponent();
6139      if (this.structure == null)
6140        this.structure = new ArrayList<StructureMapStructureComponent>();
6141      this.structure.add(t);
6142      return t;
6143    }
6144
6145    public StructureMap addStructure(StructureMapStructureComponent t) { //3
6146      if (t == null)
6147        return this;
6148      if (this.structure == null)
6149        this.structure = new ArrayList<StructureMapStructureComponent>();
6150      this.structure.add(t);
6151      return this;
6152    }
6153
6154    /**
6155     * @return The first repetition of repeating field {@link #structure}, creating it if it does not already exist
6156     */
6157    public StructureMapStructureComponent getStructureFirstRep() { 
6158      if (getStructure().isEmpty()) {
6159        addStructure();
6160      }
6161      return getStructure().get(0);
6162    }
6163
6164    /**
6165     * @return {@link #import_} (Other maps used by this map (canonical URLs).)
6166     */
6167    public List<CanonicalType> getImport() { 
6168      if (this.import_ == null)
6169        this.import_ = new ArrayList<CanonicalType>();
6170      return this.import_;
6171    }
6172
6173    /**
6174     * @return Returns a reference to <code>this</code> for easy method chaining
6175     */
6176    public StructureMap setImport(List<CanonicalType> theImport) { 
6177      this.import_ = theImport;
6178      return this;
6179    }
6180
6181    public boolean hasImport() { 
6182      if (this.import_ == null)
6183        return false;
6184      for (CanonicalType item : this.import_)
6185        if (!item.isEmpty())
6186          return true;
6187      return false;
6188    }
6189
6190    /**
6191     * @return {@link #import_} (Other maps used by this map (canonical URLs).)
6192     */
6193    public CanonicalType addImportElement() {//2 
6194      CanonicalType t = new CanonicalType();
6195      if (this.import_ == null)
6196        this.import_ = new ArrayList<CanonicalType>();
6197      this.import_.add(t);
6198      return t;
6199    }
6200
6201    /**
6202     * @param value {@link #import_} (Other maps used by this map (canonical URLs).)
6203     */
6204    public StructureMap addImport(String value) { //1
6205      CanonicalType t = new CanonicalType();
6206      t.setValue(value);
6207      if (this.import_ == null)
6208        this.import_ = new ArrayList<CanonicalType>();
6209      this.import_.add(t);
6210      return this;
6211    }
6212
6213    /**
6214     * @param value {@link #import_} (Other maps used by this map (canonical URLs).)
6215     */
6216    public boolean hasImport(String value) { 
6217      if (this.import_ == null)
6218        return false;
6219      for (CanonicalType v : this.import_)
6220        if (v.getValue().equals(value)) // canonical(StructureMap)
6221          return true;
6222      return false;
6223    }
6224
6225    /**
6226     * @return {@link #group} (Organizes the mapping into manageable chunks for human review/ease of maintenance.)
6227     */
6228    public List<StructureMapGroupComponent> getGroup() { 
6229      if (this.group == null)
6230        this.group = new ArrayList<StructureMapGroupComponent>();
6231      return this.group;
6232    }
6233
6234    /**
6235     * @return Returns a reference to <code>this</code> for easy method chaining
6236     */
6237    public StructureMap setGroup(List<StructureMapGroupComponent> theGroup) { 
6238      this.group = theGroup;
6239      return this;
6240    }
6241
6242    public boolean hasGroup() { 
6243      if (this.group == null)
6244        return false;
6245      for (StructureMapGroupComponent item : this.group)
6246        if (!item.isEmpty())
6247          return true;
6248      return false;
6249    }
6250
6251    public StructureMapGroupComponent addGroup() { //3
6252      StructureMapGroupComponent t = new StructureMapGroupComponent();
6253      if (this.group == null)
6254        this.group = new ArrayList<StructureMapGroupComponent>();
6255      this.group.add(t);
6256      return t;
6257    }
6258
6259    public StructureMap addGroup(StructureMapGroupComponent t) { //3
6260      if (t == null)
6261        return this;
6262      if (this.group == null)
6263        this.group = new ArrayList<StructureMapGroupComponent>();
6264      this.group.add(t);
6265      return this;
6266    }
6267
6268    /**
6269     * @return The first repetition of repeating field {@link #group}, creating it if it does not already exist
6270     */
6271    public StructureMapGroupComponent getGroupFirstRep() { 
6272      if (getGroup().isEmpty()) {
6273        addGroup();
6274      }
6275      return getGroup().get(0);
6276    }
6277
6278      protected void listChildren(List<Property> children) {
6279        super.listChildren(children);
6280        children.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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this structure map is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the structure map is stored on different servers.", 0, 1, url));
6281        children.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));
6282        children.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, 1, version));
6283        children.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, 1, name));
6284        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the structure map.", 0, 1, title));
6285        children.add(new Property("status", "code", "The status of this structure map. Enables tracking the life-cycle of the content.", 0, 1, status));
6286        children.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, 1, experimental));
6287        children.add(new Property("date", "dateTime", "The date  (and optionally time) when the structure map was published. The date must change 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, 1, date));
6288        children.add(new Property("publisher", "string", "The name of the organization or individual that published the structure map.", 0, 1, publisher));
6289        children.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));
6290        children.add(new Property("description", "markdown", "A free text natural language description of the structure map from a consumer's perspective.", 0, 1, description));
6291        children.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));
6292        children.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));
6293        children.add(new Property("purpose", "markdown", "Explanation of why this structure map is needed and why it has been designed as it has.", 0, 1, purpose));
6294        children.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, 1, copyright));
6295        children.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));
6296        children.add(new Property("import", "canonical(StructureMap)", "Other maps used by this map (canonical URLs).", 0, java.lang.Integer.MAX_VALUE, import_));
6297        children.add(new Property("group", "", "Organizes the mapping into manageable chunks for human review/ease of maintenance.", 0, java.lang.Integer.MAX_VALUE, group));
6298      }
6299
6300      @Override
6301      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6302        switch (_hash) {
6303        case 116079: /*url*/  return 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; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this structure map is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the structure map is stored on different servers.", 0, 1, url);
6304        case -1618432855: /*identifier*/  return 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);
6305        case 351608024: /*version*/  return 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, 1, version);
6306        case 3373707: /*name*/  return 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, 1, name);
6307        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the structure map.", 0, 1, title);
6308        case -892481550: /*status*/  return new Property("status", "code", "The status of this structure map. Enables tracking the life-cycle of the content.", 0, 1, status);
6309        case -404562712: /*experimental*/  return 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, 1, experimental);
6310        case 3076014: /*date*/  return new Property("date", "dateTime", "The date  (and optionally time) when the structure map was published. The date must change 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, 1, date);
6311        case 1447404028: /*publisher*/  return new Property("publisher", "string", "The name of the organization or individual that published the structure map.", 0, 1, publisher);
6312        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact);
6313        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the structure map from a consumer's perspective.", 0, 1, description);
6314        case -669707736: /*useContext*/  return 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);
6315        case -507075711: /*jurisdiction*/  return 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);
6316        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explanation of why this structure map is needed and why it has been designed as it has.", 0, 1, purpose);
6317        case 1522889671: /*copyright*/  return 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, 1, copyright);
6318        case 144518515: /*structure*/  return 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);
6319        case -1184795739: /*import*/  return new Property("import", "canonical(StructureMap)", "Other maps used by this map (canonical URLs).", 0, java.lang.Integer.MAX_VALUE, import_);
6320        case 98629247: /*group*/  return new Property("group", "", "Organizes the mapping into manageable chunks for human review/ease of maintenance.", 0, java.lang.Integer.MAX_VALUE, group);
6321        default: return super.getNamedProperty(_hash, _name, _checkValid);
6322        }
6323
6324      }
6325
6326      @Override
6327      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6328        switch (hash) {
6329        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
6330        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
6331        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
6332        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
6333        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
6334        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
6335        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
6336        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
6337        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
6338        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
6339        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
6340        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
6341        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
6342        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
6343        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
6344        case 144518515: /*structure*/ return this.structure == null ? new Base[0] : this.structure.toArray(new Base[this.structure.size()]); // StructureMapStructureComponent
6345        case -1184795739: /*import*/ return this.import_ == null ? new Base[0] : this.import_.toArray(new Base[this.import_.size()]); // CanonicalType
6346        case 98629247: /*group*/ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // StructureMapGroupComponent
6347        default: return super.getProperty(hash, name, checkValid);
6348        }
6349
6350      }
6351
6352      @Override
6353      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6354        switch (hash) {
6355        case 116079: // url
6356          this.url = castToUri(value); // UriType
6357          return value;
6358        case -1618432855: // identifier
6359          this.getIdentifier().add(castToIdentifier(value)); // Identifier
6360          return value;
6361        case 351608024: // version
6362          this.version = castToString(value); // StringType
6363          return value;
6364        case 3373707: // name
6365          this.name = castToString(value); // StringType
6366          return value;
6367        case 110371416: // title
6368          this.title = castToString(value); // StringType
6369          return value;
6370        case -892481550: // status
6371          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
6372          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
6373          return value;
6374        case -404562712: // experimental
6375          this.experimental = castToBoolean(value); // BooleanType
6376          return value;
6377        case 3076014: // date
6378          this.date = castToDateTime(value); // DateTimeType
6379          return value;
6380        case 1447404028: // publisher
6381          this.publisher = castToString(value); // StringType
6382          return value;
6383        case 951526432: // contact
6384          this.getContact().add(castToContactDetail(value)); // ContactDetail
6385          return value;
6386        case -1724546052: // description
6387          this.description = castToMarkdown(value); // MarkdownType
6388          return value;
6389        case -669707736: // useContext
6390          this.getUseContext().add(castToUsageContext(value)); // UsageContext
6391          return value;
6392        case -507075711: // jurisdiction
6393          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
6394          return value;
6395        case -220463842: // purpose
6396          this.purpose = castToMarkdown(value); // MarkdownType
6397          return value;
6398        case 1522889671: // copyright
6399          this.copyright = castToMarkdown(value); // MarkdownType
6400          return value;
6401        case 144518515: // structure
6402          this.getStructure().add((StructureMapStructureComponent) value); // StructureMapStructureComponent
6403          return value;
6404        case -1184795739: // import
6405          this.getImport().add(castToCanonical(value)); // CanonicalType
6406          return value;
6407        case 98629247: // group
6408          this.getGroup().add((StructureMapGroupComponent) value); // StructureMapGroupComponent
6409          return value;
6410        default: return super.setProperty(hash, name, value);
6411        }
6412
6413      }
6414
6415      @Override
6416      public Base setProperty(String name, Base value) throws FHIRException {
6417        if (name.equals("url")) {
6418          this.url = castToUri(value); // UriType
6419        } else if (name.equals("identifier")) {
6420          this.getIdentifier().add(castToIdentifier(value));
6421        } else if (name.equals("version")) {
6422          this.version = castToString(value); // StringType
6423        } else if (name.equals("name")) {
6424          this.name = castToString(value); // StringType
6425        } else if (name.equals("title")) {
6426          this.title = castToString(value); // StringType
6427        } else if (name.equals("status")) {
6428          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
6429          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
6430        } else if (name.equals("experimental")) {
6431          this.experimental = castToBoolean(value); // BooleanType
6432        } else if (name.equals("date")) {
6433          this.date = castToDateTime(value); // DateTimeType
6434        } else if (name.equals("publisher")) {
6435          this.publisher = castToString(value); // StringType
6436        } else if (name.equals("contact")) {
6437          this.getContact().add(castToContactDetail(value));
6438        } else if (name.equals("description")) {
6439          this.description = castToMarkdown(value); // MarkdownType
6440        } else if (name.equals("useContext")) {
6441          this.getUseContext().add(castToUsageContext(value));
6442        } else if (name.equals("jurisdiction")) {
6443          this.getJurisdiction().add(castToCodeableConcept(value));
6444        } else if (name.equals("purpose")) {
6445          this.purpose = castToMarkdown(value); // MarkdownType
6446        } else if (name.equals("copyright")) {
6447          this.copyright = castToMarkdown(value); // MarkdownType
6448        } else if (name.equals("structure")) {
6449          this.getStructure().add((StructureMapStructureComponent) value);
6450        } else if (name.equals("import")) {
6451          this.getImport().add(castToCanonical(value));
6452        } else if (name.equals("group")) {
6453          this.getGroup().add((StructureMapGroupComponent) value);
6454        } else
6455          return super.setProperty(name, value);
6456        return value;
6457      }
6458
6459      @Override
6460      public Base makeProperty(int hash, String name) throws FHIRException {
6461        switch (hash) {
6462        case 116079:  return getUrlElement();
6463        case -1618432855:  return addIdentifier(); 
6464        case 351608024:  return getVersionElement();
6465        case 3373707:  return getNameElement();
6466        case 110371416:  return getTitleElement();
6467        case -892481550:  return getStatusElement();
6468        case -404562712:  return getExperimentalElement();
6469        case 3076014:  return getDateElement();
6470        case 1447404028:  return getPublisherElement();
6471        case 951526432:  return addContact(); 
6472        case -1724546052:  return getDescriptionElement();
6473        case -669707736:  return addUseContext(); 
6474        case -507075711:  return addJurisdiction(); 
6475        case -220463842:  return getPurposeElement();
6476        case 1522889671:  return getCopyrightElement();
6477        case 144518515:  return addStructure(); 
6478        case -1184795739:  return addImportElement();
6479        case 98629247:  return addGroup(); 
6480        default: return super.makeProperty(hash, name);
6481        }
6482
6483      }
6484
6485      @Override
6486      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6487        switch (hash) {
6488        case 116079: /*url*/ return new String[] {"uri"};
6489        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
6490        case 351608024: /*version*/ return new String[] {"string"};
6491        case 3373707: /*name*/ return new String[] {"string"};
6492        case 110371416: /*title*/ return new String[] {"string"};
6493        case -892481550: /*status*/ return new String[] {"code"};
6494        case -404562712: /*experimental*/ return new String[] {"boolean"};
6495        case 3076014: /*date*/ return new String[] {"dateTime"};
6496        case 1447404028: /*publisher*/ return new String[] {"string"};
6497        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
6498        case -1724546052: /*description*/ return new String[] {"markdown"};
6499        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
6500        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
6501        case -220463842: /*purpose*/ return new String[] {"markdown"};
6502        case 1522889671: /*copyright*/ return new String[] {"markdown"};
6503        case 144518515: /*structure*/ return new String[] {};
6504        case -1184795739: /*import*/ return new String[] {"canonical"};
6505        case 98629247: /*group*/ return new String[] {};
6506        default: return super.getTypesForProperty(hash, name);
6507        }
6508
6509      }
6510
6511      @Override
6512      public Base addChild(String name) throws FHIRException {
6513        if (name.equals("url")) {
6514          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.url");
6515        }
6516        else if (name.equals("identifier")) {
6517          return addIdentifier();
6518        }
6519        else if (name.equals("version")) {
6520          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.version");
6521        }
6522        else if (name.equals("name")) {
6523          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.name");
6524        }
6525        else if (name.equals("title")) {
6526          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.title");
6527        }
6528        else if (name.equals("status")) {
6529          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.status");
6530        }
6531        else if (name.equals("experimental")) {
6532          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.experimental");
6533        }
6534        else if (name.equals("date")) {
6535          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.date");
6536        }
6537        else if (name.equals("publisher")) {
6538          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.publisher");
6539        }
6540        else if (name.equals("contact")) {
6541          return addContact();
6542        }
6543        else if (name.equals("description")) {
6544          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.description");
6545        }
6546        else if (name.equals("useContext")) {
6547          return addUseContext();
6548        }
6549        else if (name.equals("jurisdiction")) {
6550          return addJurisdiction();
6551        }
6552        else if (name.equals("purpose")) {
6553          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.purpose");
6554        }
6555        else if (name.equals("copyright")) {
6556          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.copyright");
6557        }
6558        else if (name.equals("structure")) {
6559          return addStructure();
6560        }
6561        else if (name.equals("import")) {
6562          throw new FHIRException("Cannot call addChild on a primitive type StructureMap.import");
6563        }
6564        else if (name.equals("group")) {
6565          return addGroup();
6566        }
6567        else
6568          return super.addChild(name);
6569      }
6570
6571  public String fhirType() {
6572    return "StructureMap";
6573
6574  }
6575
6576      public StructureMap copy() {
6577        StructureMap dst = new StructureMap();
6578        copyValues(dst);
6579        dst.url = url == null ? null : url.copy();
6580        if (identifier != null) {
6581          dst.identifier = new ArrayList<Identifier>();
6582          for (Identifier i : identifier)
6583            dst.identifier.add(i.copy());
6584        };
6585        dst.version = version == null ? null : version.copy();
6586        dst.name = name == null ? null : name.copy();
6587        dst.title = title == null ? null : title.copy();
6588        dst.status = status == null ? null : status.copy();
6589        dst.experimental = experimental == null ? null : experimental.copy();
6590        dst.date = date == null ? null : date.copy();
6591        dst.publisher = publisher == null ? null : publisher.copy();
6592        if (contact != null) {
6593          dst.contact = new ArrayList<ContactDetail>();
6594          for (ContactDetail i : contact)
6595            dst.contact.add(i.copy());
6596        };
6597        dst.description = description == null ? null : description.copy();
6598        if (useContext != null) {
6599          dst.useContext = new ArrayList<UsageContext>();
6600          for (UsageContext i : useContext)
6601            dst.useContext.add(i.copy());
6602        };
6603        if (jurisdiction != null) {
6604          dst.jurisdiction = new ArrayList<CodeableConcept>();
6605          for (CodeableConcept i : jurisdiction)
6606            dst.jurisdiction.add(i.copy());
6607        };
6608        dst.purpose = purpose == null ? null : purpose.copy();
6609        dst.copyright = copyright == null ? null : copyright.copy();
6610        if (structure != null) {
6611          dst.structure = new ArrayList<StructureMapStructureComponent>();
6612          for (StructureMapStructureComponent i : structure)
6613            dst.structure.add(i.copy());
6614        };
6615        if (import_ != null) {
6616          dst.import_ = new ArrayList<CanonicalType>();
6617          for (CanonicalType i : import_)
6618            dst.import_.add(i.copy());
6619        };
6620        if (group != null) {
6621          dst.group = new ArrayList<StructureMapGroupComponent>();
6622          for (StructureMapGroupComponent i : group)
6623            dst.group.add(i.copy());
6624        };
6625        return dst;
6626      }
6627
6628      protected StructureMap typedCopy() {
6629        return copy();
6630      }
6631
6632      @Override
6633      public boolean equalsDeep(Base other_) {
6634        if (!super.equalsDeep(other_))
6635          return false;
6636        if (!(other_ instanceof StructureMap))
6637          return false;
6638        StructureMap o = (StructureMap) other_;
6639        return compareDeep(identifier, o.identifier, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
6640           && compareDeep(structure, o.structure, true) && compareDeep(import_, o.import_, true) && compareDeep(group, o.group, true)
6641          ;
6642      }
6643
6644      @Override
6645      public boolean equalsShallow(Base other_) {
6646        if (!super.equalsShallow(other_))
6647          return false;
6648        if (!(other_ instanceof StructureMap))
6649          return false;
6650        StructureMap o = (StructureMap) other_;
6651        return compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true);
6652      }
6653
6654      public boolean isEmpty() {
6655        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, purpose, copyright
6656          , structure, import_, group);
6657      }
6658
6659  @Override
6660  public ResourceType getResourceType() {
6661    return ResourceType.StructureMap;
6662   }
6663
6664 /**
6665   * Search parameter: <b>date</b>
6666   * <p>
6667   * Description: <b>The structure map publication date</b><br>
6668   * Type: <b>date</b><br>
6669   * Path: <b>StructureMap.date</b><br>
6670   * </p>
6671   */
6672  @SearchParamDefinition(name="date", path="StructureMap.date", description="The structure map publication date", type="date" )
6673  public static final String SP_DATE = "date";
6674 /**
6675   * <b>Fluent Client</b> search parameter constant for <b>date</b>
6676   * <p>
6677   * Description: <b>The structure map publication date</b><br>
6678   * Type: <b>date</b><br>
6679   * Path: <b>StructureMap.date</b><br>
6680   * </p>
6681   */
6682  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
6683
6684 /**
6685   * Search parameter: <b>identifier</b>
6686   * <p>
6687   * Description: <b>External identifier for the structure map</b><br>
6688   * Type: <b>token</b><br>
6689   * Path: <b>StructureMap.identifier</b><br>
6690   * </p>
6691   */
6692  @SearchParamDefinition(name="identifier", path="StructureMap.identifier", description="External identifier for the structure map", type="token" )
6693  public static final String SP_IDENTIFIER = "identifier";
6694 /**
6695   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
6696   * <p>
6697   * Description: <b>External identifier for the structure map</b><br>
6698   * Type: <b>token</b><br>
6699   * Path: <b>StructureMap.identifier</b><br>
6700   * </p>
6701   */
6702  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
6703
6704 /**
6705   * Search parameter: <b>context-type-value</b>
6706   * <p>
6707   * Description: <b>A use context type and value assigned to the structure map</b><br>
6708   * Type: <b>composite</b><br>
6709   * Path: <b></b><br>
6710   * </p>
6711   */
6712  @SearchParamDefinition(name="context-type-value", path="StructureMap.useContext", description="A use context type and value assigned to the structure map", type="composite", compositeOf={"context-type", "context"} )
6713  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
6714 /**
6715   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
6716   * <p>
6717   * Description: <b>A use context type and value assigned to the structure map</b><br>
6718   * Type: <b>composite</b><br>
6719   * Path: <b></b><br>
6720   * </p>
6721   */
6722  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> CONTEXT_TYPE_VALUE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(SP_CONTEXT_TYPE_VALUE);
6723
6724 /**
6725   * Search parameter: <b>jurisdiction</b>
6726   * <p>
6727   * Description: <b>Intended jurisdiction for the structure map</b><br>
6728   * Type: <b>token</b><br>
6729   * Path: <b>StructureMap.jurisdiction</b><br>
6730   * </p>
6731   */
6732  @SearchParamDefinition(name="jurisdiction", path="StructureMap.jurisdiction", description="Intended jurisdiction for the structure map", type="token" )
6733  public static final String SP_JURISDICTION = "jurisdiction";
6734 /**
6735   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
6736   * <p>
6737   * Description: <b>Intended jurisdiction for the structure map</b><br>
6738   * Type: <b>token</b><br>
6739   * Path: <b>StructureMap.jurisdiction</b><br>
6740   * </p>
6741   */
6742  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
6743
6744 /**
6745   * Search parameter: <b>description</b>
6746   * <p>
6747   * Description: <b>The description of the structure map</b><br>
6748   * Type: <b>string</b><br>
6749   * Path: <b>StructureMap.description</b><br>
6750   * </p>
6751   */
6752  @SearchParamDefinition(name="description", path="StructureMap.description", description="The description of the structure map", type="string" )
6753  public static final String SP_DESCRIPTION = "description";
6754 /**
6755   * <b>Fluent Client</b> search parameter constant for <b>description</b>
6756   * <p>
6757   * Description: <b>The description of the structure map</b><br>
6758   * Type: <b>string</b><br>
6759   * Path: <b>StructureMap.description</b><br>
6760   * </p>
6761   */
6762  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
6763
6764 /**
6765   * Search parameter: <b>context-type</b>
6766   * <p>
6767   * Description: <b>A type of use context assigned to the structure map</b><br>
6768   * Type: <b>token</b><br>
6769   * Path: <b>StructureMap.useContext.code</b><br>
6770   * </p>
6771   */
6772  @SearchParamDefinition(name="context-type", path="StructureMap.useContext.code", description="A type of use context assigned to the structure map", type="token" )
6773  public static final String SP_CONTEXT_TYPE = "context-type";
6774 /**
6775   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
6776   * <p>
6777   * Description: <b>A type of use context assigned to the structure map</b><br>
6778   * Type: <b>token</b><br>
6779   * Path: <b>StructureMap.useContext.code</b><br>
6780   * </p>
6781   */
6782  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT_TYPE);
6783
6784 /**
6785   * Search parameter: <b>title</b>
6786   * <p>
6787   * Description: <b>The human-friendly name of the structure map</b><br>
6788   * Type: <b>string</b><br>
6789   * Path: <b>StructureMap.title</b><br>
6790   * </p>
6791   */
6792  @SearchParamDefinition(name="title", path="StructureMap.title", description="The human-friendly name of the structure map", type="string" )
6793  public static final String SP_TITLE = "title";
6794 /**
6795   * <b>Fluent Client</b> search parameter constant for <b>title</b>
6796   * <p>
6797   * Description: <b>The human-friendly name of the structure map</b><br>
6798   * Type: <b>string</b><br>
6799   * Path: <b>StructureMap.title</b><br>
6800   * </p>
6801   */
6802  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
6803
6804 /**
6805   * Search parameter: <b>version</b>
6806   * <p>
6807   * Description: <b>The business version of the structure map</b><br>
6808   * Type: <b>token</b><br>
6809   * Path: <b>StructureMap.version</b><br>
6810   * </p>
6811   */
6812  @SearchParamDefinition(name="version", path="StructureMap.version", description="The business version of the structure map", type="token" )
6813  public static final String SP_VERSION = "version";
6814 /**
6815   * <b>Fluent Client</b> search parameter constant for <b>version</b>
6816   * <p>
6817   * Description: <b>The business version of the structure map</b><br>
6818   * Type: <b>token</b><br>
6819   * Path: <b>StructureMap.version</b><br>
6820   * </p>
6821   */
6822  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
6823
6824 /**
6825   * Search parameter: <b>url</b>
6826   * <p>
6827   * Description: <b>The uri that identifies the structure map</b><br>
6828   * Type: <b>uri</b><br>
6829   * Path: <b>StructureMap.url</b><br>
6830   * </p>
6831   */
6832  @SearchParamDefinition(name="url", path="StructureMap.url", description="The uri that identifies the structure map", type="uri" )
6833  public static final String SP_URL = "url";
6834 /**
6835   * <b>Fluent Client</b> search parameter constant for <b>url</b>
6836   * <p>
6837   * Description: <b>The uri that identifies the structure map</b><br>
6838   * Type: <b>uri</b><br>
6839   * Path: <b>StructureMap.url</b><br>
6840   * </p>
6841   */
6842  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
6843
6844 /**
6845   * Search parameter: <b>context-quantity</b>
6846   * <p>
6847   * Description: <b>A quantity- or range-valued use context assigned to the structure map</b><br>
6848   * Type: <b>quantity</b><br>
6849   * Path: <b>StructureMap.useContext.valueQuantity, StructureMap.useContext.valueRange</b><br>
6850   * </p>
6851   */
6852  @SearchParamDefinition(name="context-quantity", path="(StructureMap.useContext.value as Quantity) | (StructureMap.useContext.value as Range)", description="A quantity- or range-valued use context assigned to the structure map", type="quantity" )
6853  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
6854 /**
6855   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
6856   * <p>
6857   * Description: <b>A quantity- or range-valued use context assigned to the structure map</b><br>
6858   * Type: <b>quantity</b><br>
6859   * Path: <b>StructureMap.useContext.valueQuantity, StructureMap.useContext.valueRange</b><br>
6860   * </p>
6861   */
6862  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_CONTEXT_QUANTITY);
6863
6864 /**
6865   * Search parameter: <b>name</b>
6866   * <p>
6867   * Description: <b>Computationally friendly name of the structure map</b><br>
6868   * Type: <b>string</b><br>
6869   * Path: <b>StructureMap.name</b><br>
6870   * </p>
6871   */
6872  @SearchParamDefinition(name="name", path="StructureMap.name", description="Computationally friendly name of the structure map", type="string" )
6873  public static final String SP_NAME = "name";
6874 /**
6875   * <b>Fluent Client</b> search parameter constant for <b>name</b>
6876   * <p>
6877   * Description: <b>Computationally friendly name of the structure map</b><br>
6878   * Type: <b>string</b><br>
6879   * Path: <b>StructureMap.name</b><br>
6880   * </p>
6881   */
6882  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
6883
6884 /**
6885   * Search parameter: <b>context</b>
6886   * <p>
6887   * Description: <b>A use context assigned to the structure map</b><br>
6888   * Type: <b>token</b><br>
6889   * Path: <b>StructureMap.useContext.valueCodeableConcept</b><br>
6890   * </p>
6891   */
6892  @SearchParamDefinition(name="context", path="(StructureMap.useContext.value as CodeableConcept)", description="A use context assigned to the structure map", type="token" )
6893  public static final String SP_CONTEXT = "context";
6894 /**
6895   * <b>Fluent Client</b> search parameter constant for <b>context</b>
6896   * <p>
6897   * Description: <b>A use context assigned to the structure map</b><br>
6898   * Type: <b>token</b><br>
6899   * Path: <b>StructureMap.useContext.valueCodeableConcept</b><br>
6900   * </p>
6901   */
6902  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
6903
6904 /**
6905   * Search parameter: <b>publisher</b>
6906   * <p>
6907   * Description: <b>Name of the publisher of the structure map</b><br>
6908   * Type: <b>string</b><br>
6909   * Path: <b>StructureMap.publisher</b><br>
6910   * </p>
6911   */
6912  @SearchParamDefinition(name="publisher", path="StructureMap.publisher", description="Name of the publisher of the structure map", type="string" )
6913  public static final String SP_PUBLISHER = "publisher";
6914 /**
6915   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
6916   * <p>
6917   * Description: <b>Name of the publisher of the structure map</b><br>
6918   * Type: <b>string</b><br>
6919   * Path: <b>StructureMap.publisher</b><br>
6920   * </p>
6921   */
6922  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
6923
6924 /**
6925   * Search parameter: <b>context-type-quantity</b>
6926   * <p>
6927   * Description: <b>A use context type and quantity- or range-based value assigned to the structure map</b><br>
6928   * Type: <b>composite</b><br>
6929   * Path: <b></b><br>
6930   * </p>
6931   */
6932  @SearchParamDefinition(name="context-type-quantity", path="StructureMap.useContext", description="A use context type and quantity- or range-based value assigned to the structure map", type="composite", compositeOf={"context-type", "context-quantity"} )
6933  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
6934 /**
6935   * <b>Fluent Client</b> search parameter constant for <b>context-type-quantity</b>
6936   * <p>
6937   * Description: <b>A use context type and quantity- or range-based value assigned to the structure map</b><br>
6938   * Type: <b>composite</b><br>
6939   * Path: <b></b><br>
6940   * </p>
6941   */
6942  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam> CONTEXT_TYPE_QUANTITY = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam>(SP_CONTEXT_TYPE_QUANTITY);
6943
6944 /**
6945   * Search parameter: <b>status</b>
6946   * <p>
6947   * Description: <b>The current status of the structure map</b><br>
6948   * Type: <b>token</b><br>
6949   * Path: <b>StructureMap.status</b><br>
6950   * </p>
6951   */
6952  @SearchParamDefinition(name="status", path="StructureMap.status", description="The current status of the structure map", type="token" )
6953  public static final String SP_STATUS = "status";
6954 /**
6955   * <b>Fluent Client</b> search parameter constant for <b>status</b>
6956   * <p>
6957   * Description: <b>The current status of the structure map</b><br>
6958   * Type: <b>token</b><br>
6959   * Path: <b>StructureMap.status</b><br>
6960   * </p>
6961   */
6962  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
6963
6964// added from java-adornments.txt:
6965
6966  public String toString() {
6967    return StructureMapUtilities.render(this);
6968  }
6969
6970
6971// end addition
6972
6973}
6974