public interface IParser
Thread safety: Parsers are not guaranteed to be thread safe. Create a new parser instance for every thread or every message being parsed/encoded.
| Modifier and Type | Method and Description |
|---|---|
String |
encodeBundleToString(Bundle theBundle) |
void |
encodeBundleToWriter(Bundle theBundle,
Writer theWriter) |
String |
encodeResourceToString(IBaseResource theResource) |
void |
encodeResourceToWriter(IBaseResource theResource,
Writer theWriter) |
String |
encodeTagListToString(TagList theTagList)
Encodes a tag list, as defined in the FHIR
Specification.
|
void |
encodeTagListToWriter(TagList theTagList,
Writer theWriter)
Encodes a tag list, as defined in the FHIR
Specification.
|
Set<String> |
getEncodeElements()
|
Set<String> |
getEncodeElementsAppliesToResourceTypes()
|
EncodingEnum |
getEncoding()
Which encoding does this parser instance produce?
|
boolean |
isOmitResourceId()
Returns true if resource IDs should be omitted
|
boolean |
isStripVersionsFromReferences()
If set to
true |
boolean |
isSummaryMode()
Is the parser in "summary mode"? See
setSummaryMode(boolean) for information |
<T extends IBaseResource> |
parseBundle(Class<T> theResourceType,
Reader theReader)
Parse a DSTU1 style Atom Bundle.
|
Bundle |
parseBundle(Reader theReader)
Parse a DSTU1 style Atom Bundle.
|
Bundle |
parseBundle(String theMessageString)
Parse a DSTU1 style Atom Bundle.
|
<T extends IBaseResource> |
parseResource(Class<T> theResourceType,
Reader theReader)
Parses a resource
|
<T extends IBaseResource> |
parseResource(Class<T> theResourceType,
String theString)
Parses a resource
|
IBaseResource |
parseResource(Reader theReader)
Parses a resource
|
IBaseResource |
parseResource(String theMessageString)
Parses a resource
|
TagList |
parseTagList(Reader theReader)
Parses a tag list, as defined in the FHIR
Specification.
|
TagList |
parseTagList(String theString)
Parses a tag list, as defined in the FHIR
Specification.
|
void |
setEncodeElements(Set<String> theEncodeElements)
If provided, specifies the elements which should be encoded, to the exclusion of all others.
|
void |
setEncodeElementsAppliesToResourceTypes(Set<String> theEncodeElementsAppliesToResourceTypes)
If provided, tells the parse which resource types to apply
encode elements to. |
IParser |
setOmitResourceId(boolean theOmitResourceId)
If set to
true (default is false) the ID of any resources being encoded will not be
included in the output. |
IParser |
setParserErrorHandler(IParserErrorHandler theErrorHandler)
Registers an error handler which will be invoked when any parse errors are found
|
IParser |
setPrettyPrint(boolean thePrettyPrint)
Sets the "pretty print" flag, meaning that the parser will encode resources with human-readable spacing and
newlines between elements instead of condensing output as much as possible.
|
IParser |
setServerBaseUrl(String theUrl)
Sets the server's base URL used by this parser.
|
IParser |
setStripVersionsFromReferences(boolean theStripVersionsFromReferences)
If set to
true |
IParser |
setSummaryMode(boolean theSummaryMode)
If set to
true (default is false) only elements marked by the FHIR specification as
being "summary elements" will be included. |
IParser |
setSuppressNarratives(boolean theSuppressNarratives)
If set to
true (default is false), narratives will not be included in the encoded
values. |
String encodeBundleToString(Bundle theBundle) throws DataFormatException
DataFormatExceptionvoid encodeBundleToWriter(Bundle theBundle, Writer theWriter) throws IOException, DataFormatException
IOExceptionDataFormatExceptionString encodeResourceToString(IBaseResource theResource) throws DataFormatException
DataFormatExceptionvoid encodeResourceToWriter(IBaseResource theResource, Writer theWriter) throws IOException, DataFormatException
IOExceptionDataFormatExceptionString encodeTagListToString(TagList theTagList)
theTagList - The tag list to encode. Must not be null.void encodeTagListToWriter(TagList theTagList, Writer theWriter) throws IOException
theTagList - The tag list to encode. Must not be null.theWriter - The writer to encode toIOExceptionSet<String> getEncodeElements()
Set<String> getEncodeElementsAppliesToResourceTypes()
boolean isOmitResourceId()
setOmitResourceId(boolean)boolean isStripVersionsFromReferences()
true (which is the default), resource references containing a version
will have the version removed when the resource is encoded. This is generally good behaviour because
in most situations, references from one resource to another should be to the resource by ID, not
by ID and version. In some cases though, it may be desirable to preserve the version in resource
links. In that case, this value should be set to false.true.boolean isSummaryMode()
setSummaryMode(boolean) for information#setSummaryMode(boolean)} for information<T extends IBaseResource> Bundle parseBundle(Class<T> theResourceType, Reader theReader)
parseResource(Class, Reader) with the Bundle class found in the
ca.uhn.hapi.fhir.model.[version].resource package instead.Bundle parseBundle(Reader theReader)
parseResource(Class, Reader) with the Bundle class found in the
ca.uhn.hapi.fhir.model.[version].resource package instead.Bundle parseBundle(String theMessageString) throws ConfigurationException, DataFormatException
parseResource(Class, String) with the Bundle class found in the
ca.uhn.hapi.fhir.model.[version].resource package instead.<T extends IBaseResource> T parseResource(Class<T> theResourceType, Reader theReader) throws DataFormatException
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)theReader - The reader to parse input from. Note that the Reader will not be closed by the parser upon completion.DataFormatException - If the resource can not be parsed because the data is not recognized or invalid for any reason<T extends IBaseResource> T parseResource(Class<T> theResourceType, String theString) throws DataFormatException
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)theString - The string to parseDataFormatException - If the resource can not be parsed because the data is not recognized or invalid for any reasonIBaseResource parseResource(Reader theReader) throws ConfigurationException, DataFormatException
theReader - The reader to parse input from. Note that the Reader will not be closed by the parser upon completion.IResource or
IAnyResource depending on the specific FhirContext which created this parser.DataFormatException - If the resource can not be parsed because the data is not recognized or invalid for any reasonConfigurationExceptionIBaseResource parseResource(String theMessageString) throws ConfigurationException, DataFormatException
theMessageString - The string to parseIResource or
IAnyResource depending on the specific FhirContext which created this parser.DataFormatException - If the resource can not be parsed because the data is not recognized or invalid for any reasonConfigurationExceptionTagList parseTagList(Reader theReader)
theReader - A reader which will supply a tag listTagList parseTagList(String theString)
theString - A string containing a tag listvoid setEncodeElements(Set<String> theEncodeElements)
theEncodeElements - The elements to encodevoid setEncodeElementsAppliesToResourceTypes(Set<String> theEncodeElementsAppliesToResourceTypes)
encode elements to. Any
resource types not specified here will be encoded completely, with no elements excluded.theEncodeElementsAppliesToResourceTypes - IParser setOmitResourceId(boolean theOmitResourceId)
true (default is false) the ID of any resources being encoded will not be
included in the output. Note that this does not apply to contained resources, only to root resources. In other
words, if this is set to true, contained resources will still have local IDs but the outer/containing
ID will not have an ID.theOmitResourceId - Should resource IDs be omittedthis parser so that method calls can be chained togetherIParser setParserErrorHandler(IParserErrorHandler theErrorHandler)
theErrorHandler - The error handler to set. Must not be null.IParser setPrettyPrint(boolean thePrettyPrint)
thePrettyPrint - The flagthis parser so that method calls can be chained togetherIParser setServerBaseUrl(String theUrl)
theUrl - The base URL, e.g. "http://example.com/base"this parser so that method calls can be chained togetherIParser setStripVersionsFromReferences(boolean theStripVersionsFromReferences)
true (which is the default), resource references containing a version
will have the version removed when the resource is encoded. This is generally good behaviour because
in most situations, references from one resource to another should be to the resource by ID, not
by ID and version. In some cases though, it may be desirable to preserve the version in resource
links. In that case, this value should be set to false.theStripVersionsFromReferences - Set this to false to prevent the parser from removing
resource versions from references.this parser so that method calls can be chained togetherIParser setSummaryMode(boolean theSummaryMode)
true (default is false) only elements marked by the FHIR specification as
being "summary elements" will be included.this parser so that method calls can be chained togetherIParser setSuppressNarratives(boolean theSuppressNarratives)
true (default is false), narratives will not be included in the encoded
values.EncodingEnum getEncoding()
Copyright © 2014–2016 University Health Network. All rights reserved.