
Class ParserOptions
- java.lang.Object
-
- ca.uhn.fhir.context.ParserOptions
-
public class ParserOptions extends Object
This object supplies default configuration to allparser
instances created by a givenFhirContext
. It is accessed usingFhirContext.getParserOptions()
andFhirContext.setParserOptions(ParserOptions)
.It is fine to share a ParserOptions instances across multiple context instances.
-
-
Constructor Summary
Constructors Constructor Description ParserOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
getDontStripVersionsFromReferencesAtPaths()
Returns the value supplied toIParser.setDontStripVersionsFromReferencesAtPaths(String...)
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.boolean
isStripVersionsFromReferences()
If set totrue
(which is the default), resource references containing a version will have the version removed when the resource is encoded.
ParserOptions
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.ParserOptions
setDontStripVersionsFromReferencesAtPaths(Collection<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.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.ParserOptions
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 Detail
-
ParserOptions
public ParserOptions()
-
-
Method Detail
-
setDontStripVersionsFromReferencesAtPaths
public ParserOptions 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. 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
this
parser so that method calls can be chained together - See Also:
setStripVersionsFromReferences(boolean)
-
isStripVersionsFromReferences
public 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 to
false
.- Returns:
- Returns the parser instance's configuration setting for stripping versions from resource references when
encoding. Default is
true
.
-
setStripVersionsFromReferences
public ParserOptions 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. 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
.This method provides the ability to globally disable reference encoding. If finer-grained control is needed, use
setDontStripVersionsFromReferencesAtPaths(String...)
- Parameters:
theStripVersionsFromReferences
- Set this tofalse
to prevent the parser from removing resource versions from references.
- Returns:
- Returns a reference to
this
parser so that method calls can be chained together - See Also:
setDontStripVersionsFromReferencesAtPaths(String...)
-
getDontStripVersionsFromReferencesAtPaths
public Set<String> getDontStripVersionsFromReferencesAtPaths()
Returns the value supplied toIParser.setDontStripVersionsFromReferencesAtPaths(String...)
-
setDontStripVersionsFromReferencesAtPaths
public ParserOptions setDontStripVersionsFromReferencesAtPaths(Collection<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. 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
this
parser so that method calls can be chained together - See Also:
setStripVersionsFromReferences(boolean)
-
isOverrideResourceIdWithBundleEntryFullUrl
public 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 tofalse
if 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 tofalse
if 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 tofalse
to prevent the parser from overriding resource ids with the Bundle.entry.fullUrl- Returns:
- Returns a reference to
this
parser so that method calls can be chained together
-
-