private String simpleElement ( StructureDefinition sd , ElementDefinition ed , String typ ) { String addldef = "" ; ElementDefinition . ElementDefinitionBindingComponent binding = ed . getBinding ( ) ; if ( binding . hasStrength ( ) && binding . getStrength ( ) == Enumerations . BindingStrength . REQUIRED && "code" . equals ( typ ) ) { ValueSet vs = resolveBindingReference ( sd , binding . getValueSet ( ) ) ; if ( vs != null ) { addldef = tmplt ( VALUESET_DEFN_TEMPLATE ) . add ( "vsn" , vsprefix ( vs . getUrl ( ) ) ) . render ( ) ; required_value_sets . add ( vs ) ; } } // TODO: check whether value sets and fixed are mutually exclusive if ( ed . hasFixed ( ) ) { addldef = tmplt ( FIXED_VALUE_TEMPLATE ) . add ( "val" , ed . getFixed ( ) . primitiveValue ( ) ) . render ( ) ; } return tmplt ( SIMPLE_ELEMENT_DEFN_TEMPLATE ) . add ( "typ" , typ ) . add ( "vsdef" , addldef ) . render ( ) ; }
Generate a type reference and optional value set definition