Package org.hl7.fhir.dstu2.formats
Class JsonParserBase
java.lang.Object
org.hl7.fhir.dstu2.formats.FormatUtilities
org.hl7.fhir.dstu2.formats.ParserBase
org.hl7.fhir.dstu2.formats.JsonParserBase
- All Implemented Interfaces:
IParser
- Direct Known Subclasses:
JsonParser
General parser for JSON content. You instantiate an JsonParser of these, but
you actually use parse or parseGeneral defined on this class
The two classes are separated to keep generated and manually maintained code
apart.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hl7.fhir.dstu2.formats.IParser
IParser.OutputStyle
-
Field Summary
Fields inherited from class org.hl7.fhir.dstu2.formats.ParserBase
allowUnknownContent, handleComments, idMap, style, xhtmlMessage
Fields inherited from class org.hl7.fhir.dstu2.formats.FormatUtilities
FHIR_NS, ID_REGEX, XHTML_NS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
anyHasExtras
(List<? extends Element> list) protected void
close()
protected void
protected void
void
compose
(OutputStream stream, 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)void
compose
(OutputStream stream, Type type, String rootName) 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.void
compose
(JsonCreator writer, Resource resource) Compose a resource using a pre-existing JsonWriterprotected void
composeDomainResource
(String name, DomainResource e) protected abstract void
composeResource
(Resource resource) protected void
composeStringCore
(String name, org.hl7.fhir.instance.model.api.IIdType value, boolean inArray) protected void
composeStringExtras
(String name, org.hl7.fhir.instance.model.api.IIdType value, boolean inArray) protected abstract void
composeType
(String prefix, Type type) protected abstract void
composeTypeInner
(Type type) protected void
composeXhtml
(String name, org.hl7.fhir.utilities.xhtml.XhtmlNode html) getType()
check what kind of parser this isprotected abstract boolean
hasTypeName
(com.google.gson.JsonObject json, String prefix) protected boolean
makeComments
(Element element) protected void
protected void
protected void
openObject
(String name) parse
(com.google.gson.JsonObject json) Parse JSON that is known to be a resource, and that has already been read into a JSON objectparse
(InputStream input) parse content that is known to be a resourceprotected DomainResource
parseDomainResource
(com.google.gson.JsonObject json) protected void
parseElementProperties
(com.google.gson.JsonObject json, Element e) protected void
parseElementProperties
(com.google.gson.JsonObject theAsJsonObject, IdType theReferenceElement) protected void
parseElementProperties
(com.google.gson.JsonObject theAsJsonObject, org.hl7.fhir.instance.model.api.IIdType theReferenceElement) protected abstract Resource
parseResource
(com.google.gson.JsonObject json) protected abstract Type
parseType
(InputStream input, String type) This is used to parse a type - a fragment of a resource.protected abstract Type
protected org.hl7.fhir.utilities.xhtml.XhtmlNode
parseXhtml
(String value) protected void
protected void
protected void
protected void
prop
(String name, BigDecimal value) protected void
Methods inherited from class org.hl7.fhir.dstu2.formats.ParserBase
composeBytes, composeBytes, composeString, composeString, getHandleComments, getOutputStyle, isAllowUnknownContent, parse, parse, parseBase64BinaryPrimitive, parseBooleanPrimitive, parseBooleanPrimitive, parseCodePrimitive, parseDecimalPrimitive, parseDecimalPrimitive, parseIdPrimitive, parseIntegerPrimitive, parseIntegerPrimitive, parseOidPrimitive, parseStringPrimitive, parseTimePrimitive, parseType, parseType, parseUriPrimitive, parseUuidPrimitive, setAllowUnknownContent, setHandleComments, setOutputStyle, setSuppressXhtml
Methods inherited from class org.hl7.fhir.dstu2.formats.FormatUtilities
isValidId, makeId, makeParser, makeParser, toString, toString, toString, toString, toString, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hl7.fhir.dstu2.formats.IParser
composeBytes, composeBytes, composeString, composeString, getHandleComments, getOutputStyle, isAllowUnknownContent, parse, parse, parseType, parseType, setAllowUnknownContent, setHandleComments, setOutputStyle, setSuppressXhtml
-
Field Details
-
json
-
-
Constructor Details
-
JsonParserBase
public JsonParserBase()
-
-
Method Details
-
getType
Description copied from interface:IParser
check what kind of parser this is -
parseResource
protected abstract Resource parseResource(com.google.gson.JsonObject json) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
IOException
org.hl7.fhir.exceptions.FHIRFormatError
-
parseType
protected abstract Type parseType(com.google.gson.JsonObject json, String type) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
IOException
org.hl7.fhir.exceptions.FHIRFormatError
-
parseType
protected abstract Type parseType(String prefix, com.google.gson.JsonObject json) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
IOException
org.hl7.fhir.exceptions.FHIRFormatError
-
hasTypeName
-
composeResource
- Throws:
IOException
-
composeTypeInner
- Throws:
IOException
-
parse
public Resource parse(InputStream input) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError 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
- Parse content that is known to be a resourceIOException
-
parse
public Resource parse(com.google.gson.JsonObject json) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException Parse JSON that is known to be a resource, and that has already been read into a JSON object- Throws:
IOException
org.hl7.fhir.exceptions.FHIRFormatError
-
parseType
public Type parseType(InputStream input, String type) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError 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
-type
- . if this is blank, the parser may try to infer the type (xml only)- Returns:
- Throws:
IOException
org.hl7.fhir.exceptions.FHIRFormatError
-
compose
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:
compose
in interfaceIParser
- Throws:
IOException
-
compose
Compose a resource using a pre-existing JsonWriter- Throws:
IOException
-
compose
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:
compose
in interfaceIParser
- Throws:
IOException
-
parseElementProperties
protected void parseElementProperties(com.google.gson.JsonObject json, Element e) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
IOException
org.hl7.fhir.exceptions.FHIRFormatError
-
parseXhtml
protected org.hl7.fhir.utilities.xhtml.XhtmlNode parseXhtml(String value) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
IOException
org.hl7.fhir.exceptions.FHIRFormatError
-
parseDomainResource
protected DomainResource parseDomainResource(com.google.gson.JsonObject json) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException - Throws:
org.hl7.fhir.exceptions.FHIRFormatError
IOException
-
writeNull
- Throws:
IOException
-
prop
- Throws:
IOException
-
prop
- Throws:
IOException
-
prop
- Throws:
IOException
-
prop
- Throws:
IOException
-
composeXhtml
protected void composeXhtml(String name, org.hl7.fhir.utilities.xhtml.XhtmlNode html) throws IOException - Throws:
IOException
-
open
- Throws:
IOException
-
close
- Throws:
IOException
-
openArray
- Throws:
IOException
-
closeArray
- Throws:
IOException
-
openObject
- Throws:
IOException
-
closeObject
- Throws:
IOException
-
anyHasExtras
-
makeComments
-
composeDomainResource
- Throws:
IOException
-
composeType
- Throws:
IOException
-
composeStringCore
protected void composeStringCore(String name, org.hl7.fhir.instance.model.api.IIdType value, boolean inArray) throws IOException - Throws:
IOException
-
composeStringExtras
protected void composeStringExtras(String name, org.hl7.fhir.instance.model.api.IIdType value, boolean inArray) throws IOException - Throws:
IOException
-
parseElementProperties
protected void parseElementProperties(com.google.gson.JsonObject theAsJsonObject, org.hl7.fhir.instance.model.api.IIdType theReferenceElement) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException - Throws:
org.hl7.fhir.exceptions.FHIRFormatError
IOException
-
parseElementProperties
protected void parseElementProperties(com.google.gson.JsonObject theAsJsonObject, IdType theReferenceElement) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException - Throws:
org.hl7.fhir.exceptions.FHIRFormatError
IOException
-