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