public class AvroConverter extends Object
Modifier and Type | Method and Description |
---|---|
org.hl7.fhir.instance.model.api.IBaseResource |
avroToResource(org.apache.avro.generic.IndexedRecord record)
Converts a given Avro
IndexedRecord to a FHIR resource. |
static AvroConverter |
forResource(ca.uhn.fhir.context.FhirContext context,
String resourceTypeUrl)
Returns an Avro converter for the given resource type.
|
static AvroConverter |
forResource(ca.uhn.fhir.context.FhirContext context,
String resourceTypeUrl,
List<String> containedResourceTypeUrls)
Returns an Avro converter for the given resource type.
|
static List<org.apache.avro.Schema> |
generateSchemas(ca.uhn.fhir.context.FhirContext context,
Map<String,List<String>> resourceTypeUrls)
Returns a list of Avro schemas to support the given FHIR resource types.
|
String |
getResourceType()
Returns the FHIR type of the resource being converted.
|
org.apache.avro.Schema |
getSchema()
Returns the Avro schema equivalent for the FHIR resource.
|
org.apache.avro.generic.IndexedRecord |
resourceToAvro(org.hl7.fhir.instance.model.api.IBaseResource resource)
Converts a given FHIR resource to an Avro
IndexedRecord . |
public static List<org.apache.avro.Schema> generateSchemas(ca.uhn.fhir.context.FhirContext context, Map<String,List<String>> resourceTypeUrls)
context
- the FHIR contextresourceTypeUrls
- the URLs of the resource types and any resources URLs contained to thempublic static AvroConverter forResource(ca.uhn.fhir.context.FhirContext context, String resourceTypeUrl)
context
- the FHIR contextresourceTypeUrl
- the URL of the resource typepublic static AvroConverter forResource(ca.uhn.fhir.context.FhirContext context, String resourceTypeUrl, List<String> containedResourceTypeUrls)
Resources that would be contained must be statically declared through this method via similar URLs.
context
- the FHIR contextresourceTypeUrl
- the URL of the resource typecontainedResourceTypeUrls
- the list of URLs of contained resource typespublic org.apache.avro.generic.IndexedRecord resourceToAvro(org.hl7.fhir.instance.model.api.IBaseResource resource)
IndexedRecord
.resource
- the FHIR resourcepublic org.hl7.fhir.instance.model.api.IBaseResource avroToResource(org.apache.avro.generic.IndexedRecord record)
IndexedRecord
to a FHIR resource.record
- the recordpublic org.apache.avro.Schema getSchema()
public String getResourceType()
Copyright © 2020. All rights reserved.