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