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