Package org.hl7.fhir.r4.formats
Class ParserBase
java.lang.Object
org.hl7.fhir.r4.formats.FormatUtilities
org.hl7.fhir.r4.formats.ParserBase
- All Implemented Interfaces:
IParser
- Direct Known Subclasses:
JsonParserBase
,RdfParserBase
,XmlParserBase
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hl7.fhir.r4.formats.IParser
IParser.OutputStyle
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
whether to allow comments in the json (special case for IG publisher source)protected boolean
Whether to throw an exception if unknown content is found (or just skip it)protected boolean
protected IParser.OutputStyle
protected String
Fields inherited from class org.hl7.fhir.r4.formats.FormatUtilities
FHIR_NS, ID_REGEX, NS_XSI, XHTML_NS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
composeBytes
(Resource resource) Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)byte[]
composeBytes
(Type type, String typeName) Compose a type to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production) Not supported by all implementations.composeString
(Resource resource) Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)composeString
(Type type, String typeName) Compose a type to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production) Not supported by all implementations.boolean
Whether to parse or ignore comments - either reading or writingWriting:boolean
boolean
parse
(byte[] bytes) parse content that is known to be a resourceparse content that is known to be a resourceparseAnyType
(byte[] bytes, String typeName) parseAnyType
(String input, String typeName) protected byte[]
parseBase64BinaryPrimitive
(String value) protected Boolean
parseBooleanPrimitive
(Boolean value) protected Boolean
parseBooleanPrimitive
(String value) protected String
parseCodePrimitive
(String value) protected BigDecimal
parseDecimalPrimitive
(String value) protected BigDecimal
parseDecimalPrimitive
(BigDecimal value) protected String
parseIdPrimitive
(String value) protected int
parseIntegerPrimitive
(Long value) protected int
parseIntegerPrimitive
(String value) protected String
parseOidPrimitive
(String value) protected String
parseStringPrimitive
(String value) protected String
parseTimePrimitive
(String value) This is used to parse a type - a fragment of a resource.This is used to parse a type - a fragment of a resource.protected String
parseUriPrimitive
(String value) protected String
parseUuidPrimitive
(String value) void
setAllowComments
(boolean allowComments) setAllowUnknownContent
(boolean allowUnknownContent) setHandleComments
(boolean value) setSuppressXhtml
(String message) This method is used by the publication tooling to stop the xhrtml narrative being generated.Methods inherited from class org.hl7.fhir.r4.formats.FormatUtilities
determineFormat, determineFormat, isValidId, loadFile, loadFile, loadFileTight, loadFileTight, makeId, makeParser, makeParser, toString, toString, toString, toString, toString, toString
-
Field Details
-
xhtmlMessage
-
handleComments
-
allowUnknownContent
Whether to throw an exception if unknown content is found (or just skip it) -
allowComments
whether to allow comments in the json (special case for IG publisher source) -
style
-
idMap
-
-
Constructor Details
-
ParserBase
public ParserBase()
-
-
Method Details
-
parse
Description copied from interface:IParser
parse content that is known to be a resource- Specified by:
parse
in interfaceIParser
- Throws:
org.hl7.fhir.exceptions.FHIRFormatError
IOException
-
parse
Description copied from interface:IParser
parse content that is known to be a resource- Specified by:
parse
in interfaceIParser
- Throws:
org.hl7.fhir.exceptions.FHIRFormatError
IOException
-
parseType
public Type parseType(String input, String typeName) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException Description copied from interface:IParser
This is used to parse a type - a fragment of a resource. There's no reason to use this in production - it's used in the build tools Not supported by all implementations- Specified by:
parseType
in interfaceIParser
- Parameters:
input
-typeName
- . if this is blank, the parser may try to infer the type (xml only)- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRFormatError
IOException
-
parseAnyType
public Type parseAnyType(String input, String typeName) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException - Throws:
org.hl7.fhir.exceptions.FHIRFormatError
IOException
-
parseType
public Type parseType(byte[] bytes, String typeName) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException Description copied from interface:IParser
This is used to parse a type - a fragment of a resource. There's no reason to use this in production - it's used in the build tools Not supported by all implementations- Specified by:
parseType
in interfaceIParser
- Parameters:
typeName
- . if this is blank, the parser may try to infer the type (xml only)- Returns:
- Throws:
org.hl7.fhir.exceptions.FHIRFormatError
IOException
-
parseAnyType
public Type parseAnyType(byte[] bytes, String typeName) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException - Throws:
org.hl7.fhir.exceptions.FHIRFormatError
IOException
-
composeString
Description copied from interface:IParser
Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)- Specified by:
composeString
in interfaceIParser
- Throws:
IOException
-
composeBytes
Description copied from interface:IParser
Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)- Specified by:
composeBytes
in interfaceIParser
- Throws:
IOException
-
composeString
Description copied from interface:IParser
Compose a type to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production) Not supported by all implementations. rootName is ignored in the JSON format- Specified by:
composeString
in interfaceIParser
- Throws:
IOException
-
composeBytes
Description copied from interface:IParser
Compose a type to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production) Not supported by all implementations. rootName is ignored in the JSON format- Specified by:
composeBytes
in interfaceIParser
- Throws:
IOException
-
setSuppressXhtml
Description copied from interface:IParser
This method is used by the publication tooling to stop the xhrtml narrative being generated. It is not valid to use in production use. The tooling uses it to generate json/xml representations in html that are not cluttered by escaped html representations of the html representation- Specified by:
setSuppressXhtml
in interfaceIParser
-
getHandleComments
Description copied from interface:IParser
Whether to parse or ignore comments - either reading or writing- Specified by:
getHandleComments
in interfaceIParser
-
setHandleComments
- Specified by:
setHandleComments
in interfaceIParser
-
isAllowUnknownContent
- Specified by:
isAllowUnknownContent
in interfaceIParser
- Returns:
- Whether to throw an exception if unknown content is found (or just skip it)
-
setAllowUnknownContent
- Specified by:
setAllowUnknownContent
in interfaceIParser
- Parameters:
allowUnknownContent
- Whether to throw an exception if unknown content is found (or just skip it)
-
isAllowComments
-
setAllowComments
-
getOutputStyle
Description copied from interface:IParser
Writing:- Specified by:
getOutputStyle
in interfaceIParser
-
setOutputStyle
- Specified by:
setOutputStyle
in interfaceIParser
-
parseIntegerPrimitive
-
parseIntegerPrimitive
-
parseCodePrimitive
-
parseTimePrimitive
- Throws:
ParseException
-
parseDecimalPrimitive
-
parseDecimalPrimitive
-
parseUriPrimitive
-
parseBase64BinaryPrimitive
-
parseOidPrimitive
-
parseBooleanPrimitive
-
parseBooleanPrimitive
-
parseIdPrimitive
-
parseStringPrimitive
-
parseUuidPrimitive
-