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); }
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); }
public TOutValue MergeValue(FhirValueType template, TInValue inValue, TOutValue existingValue) { return(MergeValueImpl(CastTemplate(template), inValue, existingValue)); }
public TOutValue CreateValue(FhirValueType template, TInValue inValue) { return(CreateValueImpl(CastTemplate(template), inValue)); }
public TOutValue MergeValue(FhirValueType template, TInValue inValue, TOutValue existingValue) { return(ProcessorLookup(template).MergeValue(template, inValue, existingValue)); }
public TOutValue CreateValue(FhirValueType template, TInValue inValue) { return(ProcessorLookup(template).CreateValue(template, inValue)); }