Example #1
0
        protected TValueType CastTemplate(FhirValueType template)
        {
            EnsureArg.IsNotNull(template, nameof(template));

            if (!(template is TValueType castTemplate))
            {
                throw new NotSupportedException($"Template type {template.GetType()} does not match supported type {SupportedValueType}.");
            }

            return(castTemplate);
        }
Example #2
0
        private IFhirValueProcessor <TInValue, TOutValue> ProcessorLookup(FhirValueType template)
        {
            EnsureArg.IsNotNull(template);
            var type = template.GetType();

            if (!_registeredValueProcessors.TryGetValue(type, out var processor))
            {
                throw new NotSupportedException($"Value processor for FhirValueType {type} not supported.");
            }

            return(processor);
        }
Example #3
0
 public TOutValue MergeValue(FhirValueType template, TInValue inValue, TOutValue existingValue)
 {
     return(MergeValueImpl(CastTemplate(template), inValue, existingValue));
 }
Example #4
0
 public TOutValue CreateValue(FhirValueType template, TInValue inValue)
 {
     return(CreateValueImpl(CastTemplate(template), inValue));
 }
Example #5
0
 public TOutValue MergeValue(FhirValueType template, TInValue inValue, TOutValue existingValue)
 {
     return(ProcessorLookup(template).MergeValue(template, inValue, existingValue));
 }
Example #6
0
 public TOutValue CreateValue(FhirValueType template, TInValue inValue)
 {
     return(ProcessorLookup(template).CreateValue(template, inValue));
 }