
Package org.hl7.fhir.dstu3.formats
Class JsonParserBase
java.lang.Object
org.hl7.fhir.dstu3.formats.FormatUtilities
org.hl7.fhir.dstu3.formats.ParserBase
org.hl7.fhir.dstu3.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.dstu3.formats.IParser
IParser.OutputStyle -
Field Summary
FieldsFields inherited from class org.hl7.fhir.dstu3.formats.ParserBase
allowUnknownContent, handleComments, idMap, style, xhtmlMessageFields inherited from class org.hl7.fhir.dstu3.formats.FormatUtilities
FHIR_NS, ID_REGEX, NS_XSI, XHTML_NS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleananyHasExtras(List<? extends Element> list) protected voidclose()protected voidprotected voidvoidcompose(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)voidcompose(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. rootName is ignored in the JSON formatvoidcompose(JsonCreator writer, Resource resource) Compose a resource using a pre-existing JsonWriterprotected voidcomposeDomainResource(String name, DomainResource e) protected abstract voidcomposeResource(Resource resource) protected voidcomposeStringCore(String name, org.hl7.fhir.instance.model.api.IIdType value, boolean inArray) protected voidcomposeStringExtras(String name, org.hl7.fhir.instance.model.api.IIdType value, boolean inArray) protected abstract voidcomposeType(String prefix, Type type) protected abstract voidcomposeTypeInner(Type type) protected voidcomposeXhtml(String name, org.hl7.fhir.utilities.xhtml.XhtmlNode html) protected com.google.gson.JsonObjectgetJObject(com.google.gson.JsonObject parent, String name) getType()check what kind of parser this isprotected abstract booleanhasTypeName(com.google.gson.JsonObject json, String prefix) protected booleanmakeComments(Element element) protected voidprotected voidprotected voidopenObject(String name) parse(com.google.gson.JsonObject json) parse xml 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 DomainResourceparseDomainResource(com.google.gson.JsonObject json) protected voidparseElementProperties(com.google.gson.JsonObject json, Element e) protected voidparseElementProperties(com.google.gson.JsonObject theAsJsonObject, IdType theReferenceElement) protected voidparseElementProperties(com.google.gson.JsonObject theAsJsonObject, org.hl7.fhir.instance.model.api.IIdType theReferenceElement) protected abstract ResourceparseResource(com.google.gson.JsonObject json) protected abstract TypeparseType(InputStream input, String type) This is used to parse a type - a fragment of a resource.protected abstract Typeprotected org.hl7.fhir.utilities.xhtml.XhtmlNodeparseXhtml(String value) protected voidprotected voidprotected voidprotected voidprop(String name, BigDecimal value) protected voidMethods inherited from class org.hl7.fhir.dstu3.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, setSuppressXhtmlMethods inherited from class org.hl7.fhir.dstu3.formats.FormatUtilities
isValidId, makeId, makeParser, makeParser, toString, toString, toString, toString, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hl7.fhir.dstu3.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:IParsercheck what kind of parser this is -
parseResource
protected abstract Resource parseResource(com.google.gson.JsonObject json) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
parseType
protected abstract Type parseType(com.google.gson.JsonObject json, String type) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
parseType
protected abstract Type parseType(String prefix, com.google.gson.JsonObject json) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
IOExceptionorg.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:IParserparse content that is known to be a resource- Specified by:
parsein 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 xml that is known to be a resource, and that has already been read into a JSON object- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
parseType
public Type parseType(InputStream input, String type) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError Description copied from interface:IParserThis 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:
parseTypein interfaceIParser- Parameters:
input-type- . if this is blank, the parser may try to infer the type (xml only)- Returns:
- Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
getJObject
protected com.google.gson.JsonObject getJObject(com.google.gson.JsonObject parent, String name) throws IOException - Throws:
IOException
-
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:
composein interfaceIParser- Throws:
IOException
-
compose
Compose a resource using a pre-existing JsonWriter- Throws:
IOException
-
compose
Description copied from interface:IParserCompose 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:
composein interfaceIParser- Throws:
IOException
-
parseElementProperties
protected void parseElementProperties(com.google.gson.JsonObject json, Element e) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
IOExceptionorg.hl7.fhir.exceptions.FHIRFormatError
-
parseXhtml
protected org.hl7.fhir.utilities.xhtml.XhtmlNode parseXhtml(String value) throws IOException, org.hl7.fhir.exceptions.FHIRFormatError - Throws:
IOExceptionorg.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.FHIRFormatErrorIOException
-
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.FHIRFormatErrorIOException
-
parseElementProperties
protected void parseElementProperties(com.google.gson.JsonObject theAsJsonObject, IdType theReferenceElement) throws org.hl7.fhir.exceptions.FHIRFormatError, IOException - Throws:
org.hl7.fhir.exceptions.FHIRFormatErrorIOException
-