
Package ca.uhn.fhir.parser
Interface IJsonLikeParser
-
- All Superinterfaces:
IParser
- All Known Implementing Classes:
JsonParser
public interface IJsonLikeParser extends IParser
An extension to the parser interface that is implemented by parsers that understand a generalized form of JSON data. This generalized form uses Map-like, List-like, and scalar elements to construct resources.Thread safety: Parsers are not guaranteed to be thread safe. Create a new parser instance for every thread or every message being parsed/encoded.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
encodeResourceToJsonLikeWriter(IBaseResource theResource, JsonLikeWriter theJsonLikeWriter)
IBaseResource
parseResource(JsonLikeStructure theJsonLikeStructure)
Parses a resource from a JSON-like data structure<T extends IBaseResource>
TparseResource(Class<T> theResourceType, JsonLikeStructure theJsonLikeStructure)
Parses a resource from a JSON-like data structure-
Methods inherited from interface ca.uhn.fhir.parser.IParser
encodeResourceToString, encodeResourceToWriter, getDontStripVersionsFromReferencesAtPaths, getEncodeForceResourceId, getEncoding, getPreferTypes, getStripVersionsFromReferences, isEncodeElementsAppliesToChildResourcesOnly, isOmitResourceId, isSummaryMode, parseResource, parseResource, parseResource, parseResource, parseResource, parseResource, setDontEncodeElements, setDontStripVersionsFromReferencesAtPaths, setDontStripVersionsFromReferencesAtPaths, setEncodeElements, setEncodeElementsAppliesToChildResourcesOnly, setEncodeForceResourceId, setOmitResourceId, setOverrideResourceIdWithBundleEntryFullUrl, setParserErrorHandler, setPreferTypes, setPrettyPrint, setServerBaseUrl, setStripVersionsFromReferences, setSummaryMode, setSuppressNarratives
-
-
-
-
Method Detail
-
encodeResourceToJsonLikeWriter
void encodeResourceToJsonLikeWriter(IBaseResource theResource, JsonLikeWriter theJsonLikeWriter) throws IOException, DataFormatException
- Throws:
IOException
DataFormatException
-
parseResource
<T extends IBaseResource> T parseResource(Class<T> theResourceType, JsonLikeStructure theJsonLikeStructure) throws DataFormatException
Parses a resource from a JSON-like data structure- Parameters:
theResourceType
- The resource type to use. This can be used to explicitly specify a class which extends a built-in type (e.g. a custom type extending the default Patient class)theJsonLikeStructure
- The JSON-like structure to parse- Returns:
- A parsed resource
- Throws:
DataFormatException
- If the resource can not be parsed because the data is not recognized or invalid for any reason
-
parseResource
IBaseResource parseResource(JsonLikeStructure theJsonLikeStructure) throws DataFormatException
Parses a resource from a JSON-like data structure- Parameters:
theJsonLikeStructure
- The JSON-like structure to parse- Returns:
- A parsed resource. Note that the returned object will be an instance of
IResource
orIAnyResource
depending on the specific FhirContext which created this parser. - Throws:
DataFormatException
- If the resource can not be parsed because the data is not recognized or invalid for any reason
-
-