Class ParserOptions
parser instances
created by a given FhirContext. It is accessed using FhirContext.getParserOptions()
and FhirContext.setParserOptions(ParserOptions).
It is fine to share a ParserOptions instances across multiple context instances.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value supplied toIParser.setDontStripVersionsFromReferencesAtPaths(String...)booleanIf set totrue(which is the default), the Bundle.entry.fullUrl will override the Bundle.entry.resource's resource id if the fullUrl is defined.booleanIf set totrue(which is the default), resource references containing a version will have the version removed when the resource is encoded.setDontStripVersionsFromReferencesAtPaths(String... thePaths)If supplied value(s), any resource references at the specified paths will have their resource versions encoded instead of being automatically stripped during the encoding process.If supplied value(s), any resource references at the specified paths will have their resource versions encoded instead of being automatically stripped during the encoding process.setOverrideResourceIdWithBundleEntryFullUrl(boolean theOverrideResourceIdWithBundleEntryFullUrl)If set totrue(which is the default), the Bundle.entry.fullUrl will override the Bundle.entry.resource's resource id if the fullUrl is defined.setStripVersionsFromReferences(boolean theStripVersionsFromReferences)If set totrue(which is the default), resource references containing a version will have the version removed when the resource is encoded.
-
Constructor Details
-
ParserOptions
public ParserOptions()
-
-
Method Details
-
setDontStripVersionsFromReferencesAtPaths
If supplied value(s), any resource references at the specified paths will have their resource versions encoded instead of being automatically stripped during the encoding process. This setting has no effect on the parsing process.This method provides a finer-grained level of control than
setStripVersionsFromReferences(boolean)and any paths specified by this method will be encoded even ifsetStripVersionsFromReferences(boolean)has been set totrue(which is the default)- Parameters:
thePaths- A collection of paths for which the resource versions will not be removed automatically when serializing, e.g. "Patient.managingOrganization" or "AuditEvent.object.reference". Note that only resource name and field names with dots separating is allowed here (no repetition indicators, FluentPath expressions, etc.)- Returns:
- Returns a reference to
thisparser so that method calls can be chained together - See Also:
setStripVersionsFromReferences(boolean)
-
isStripVersionsFromReferences
If set totrue(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 tofalse.- Returns:
- Returns the parser instance's configuration setting for stripping versions from resource references when
encoding. Default is
true.
-
setStripVersionsFromReferences
If set totrue(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 tofalse.This method provides the ability to globally disable reference encoding. If finer-grained control is needed, use
setDontStripVersionsFromReferencesAtPaths(String...)- Parameters:
theStripVersionsFromReferences- Set this tofalseto prevent the parser from removing resource versions from references.- Returns:
- Returns a reference to
thisparser so that method calls can be chained together - See Also:
setDontStripVersionsFromReferencesAtPaths(String...)
-
getDontStripVersionsFromReferencesAtPaths
Returns the value supplied toIParser.setDontStripVersionsFromReferencesAtPaths(String...) -
setDontStripVersionsFromReferencesAtPaths
If supplied value(s), any resource references at the specified paths will have their resource versions encoded instead of being automatically stripped during the encoding process. This setting has no effect on the parsing process.This method provides a finer-grained level of control than
setStripVersionsFromReferences(boolean)and any paths specified by this method will be encoded even ifsetStripVersionsFromReferences(boolean)has been set totrue(which is the default)- Parameters:
thePaths- A collection of paths for which the resource versions will not be removed automatically when serializing, e.g. "Patient.managingOrganization" or "AuditEvent.object.reference". Note that only resource name and field names with dots separating is allowed here (no repetition indicators, FluentPath expressions, etc.)- Returns:
- Returns a reference to
thisparser so that method calls can be chained together - See Also:
setStripVersionsFromReferences(boolean)
-
isOverrideResourceIdWithBundleEntryFullUrl
If set totrue(which is the default), the Bundle.entry.fullUrl will override the Bundle.entry.resource's resource id if the fullUrl is defined. This behavior happens when parsing the source data into a Bundle object. Set this tofalseif this is not the desired behavior (e.g. the client code wishes to perform additional validation checks between the fullUrl and the resource id).- Returns:
- Returns the parser instance's configuration setting for overriding resource ids with Bundle.entry.fullUrl when
parsing the source data into a Bundle object. Default is
true.
-
setOverrideResourceIdWithBundleEntryFullUrl
public ParserOptions setOverrideResourceIdWithBundleEntryFullUrl(boolean theOverrideResourceIdWithBundleEntryFullUrl)If set totrue(which is the default), the Bundle.entry.fullUrl will override the Bundle.entry.resource's resource id if the fullUrl is defined. This behavior happens when parsing the source data into a Bundle object. Set this tofalseif this is not the desired behavior (e.g. the client code wishes to perform additional validation checks between the fullUrl and the resource id).- Parameters:
theOverrideResourceIdWithBundleEntryFullUrl- Set this tofalseto prevent the parser from overriding resource ids with the Bundle.entry.fullUrl- Returns:
- Returns a reference to
thisparser so that method calls can be chained together
-