Package ca.uhn.fhir.parser
Interface IJsonLikeParser
- All Superinterfaces:
IParser
- All Known Implementing Classes:
JsonParser
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
Modifier and TypeMethodDescriptionvoid
encodeResourceToJsonLikeWriter
(IBaseResource theResource, BaseJsonLikeWriter theJsonLikeWriter) 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 structureMethods inherited from interface ca.uhn.fhir.parser.IParser
encodeResourceToString, encodeResourceToWriter, encodeToString, encodeToWriter, getDontStripVersionsFromReferencesAtPaths, getEncodeForceResourceId, getEncoding, getPreferTypes, getStripVersionsFromReferences, isEncodeElementsAppliesToChildResourcesOnly, isOmitResourceId, isSummaryMode, parseResource, parseResource, parseResource, parseResource, parseResource, parseResource, setDontEncodeElements, setDontEncodeElements, setDontStripVersionsFromReferencesAtPaths, setDontStripVersionsFromReferencesAtPaths, setEncodeElements, setEncodeElements, setEncodeElementsAppliesToChildResourcesOnly, setEncodeForceResourceId, setOmitResourceId, setOverrideResourceIdWithBundleEntryFullUrl, setParserErrorHandler, setPreferTypes, setPrettyPrint, setServerBaseUrl, setStripVersionsFromReferences, setSummaryMode, setSuppressNarratives
-
Method Details
-
encodeResourceToJsonLikeWriter
void encodeResourceToJsonLikeWriter(IBaseResource theResource, BaseJsonLikeWriter 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
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
-