Class FHIRAbstractParser
- java.lang.Object
-
- org.linuxforhealth.fhir.model.parser.FHIRAbstractParser
-
- All Implemented Interfaces:
FHIRParser
- Direct Known Subclasses:
FHIRJsonParser,FHIRXMLParser
public abstract class FHIRAbstractParser extends java.lang.Object implements FHIRParser
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanignoringUnrecognizedElementsprotected java.util.Map<java.lang.String,java.lang.Object>propertiesprotected booleanvalidating
-
Constructor Summary
Constructors Constructor Description FHIRAbstractParser()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T extends FHIRParser>
Tas(java.lang.Class<T> parserClass)Attempt to cast the FHIRParser to a specific subclassjava.lang.ObjectgetProperty(java.lang.String name)<T> TgetProperty(java.lang.String name, java.lang.Class<T> type)java.lang.ObjectgetPropertyOrDefault(java.lang.String name, java.lang.Object defaultValue)<T> TgetPropertyOrDefault(java.lang.String name, T defaultValue, java.lang.Class<T> type)booleanisIgnoringUnrecognizedElements()Indicates whether this parser is ignoring unrecognized elementsbooleanisPropertySupported(java.lang.String name)Whether the generator supports the property with the passed namebooleanisValidating()Indicates whether this parser is a validating parserabstract <T extends Resource>
Tparse(java.io.InputStream in)Read a resource from the passed InputStream.abstract <T extends Resource>
Tparse(java.io.Reader reader)Read a resource using the passed Reader.voidsetIgnoringUnrecognizedElements(boolean ignoringUnrecognizedElements)Set the ignoring unrecognized elements indicator for this parservoidsetProperty(java.lang.String name, java.lang.Object value)Set the property with the given name to the passed valuevoidsetValidating(boolean validating)Set the validating parser indicator for this parser
-
-
-
Method Detail
-
parse
public abstract <T extends Resource> T parse(java.io.InputStream in) throws FHIRParserException
Description copied from interface:FHIRParserRead a resource from the passed InputStream. This method does not close the passed InputStream.- Specified by:
parsein interfaceFHIRParser- Type Parameters:
T- The resource type to read- Returns:
- Throws:
FHIRParserException- if the resource could not be parsed for any reason
-
parse
public abstract <T extends Resource> T parse(java.io.Reader reader) throws FHIRParserException
Description copied from interface:FHIRParserRead a resource using the passed Reader. This method does not close the passed Reader.- Specified by:
parsein interfaceFHIRParser- Type Parameters:
T- The resource type to read- Returns:
- Throws:
FHIRParserException- if the resource could not be parsed for any reason
-
setValidating
public void setValidating(boolean validating)
Description copied from interface:FHIRParserSet the validating parser indicator for this parserA validating parser performs basic validation during parsing / deserialization of the input format including:
- element cardinality checking
- element type checking
- element value checking
- Specified by:
setValidatingin interfaceFHIRParser- Parameters:
validating- the validating parser indicator- See Also:
ValidationSupport
-
isValidating
public boolean isValidating()
Description copied from interface:FHIRParserIndicates whether this parser is a validating parser- Specified by:
isValidatingin interfaceFHIRParser- Returns:
- true if this parser is a validating parser, false otherwise
-
setIgnoringUnrecognizedElements
public void setIgnoringUnrecognizedElements(boolean ignoringUnrecognizedElements)
Description copied from interface:FHIRParserSet the ignoring unrecognized elements indicator for this parser- Specified by:
setIgnoringUnrecognizedElementsin interfaceFHIRParser- Parameters:
ignoringUnrecognizedElements- the ignoring unrecognized elements indicator
-
isIgnoringUnrecognizedElements
public boolean isIgnoringUnrecognizedElements()
Description copied from interface:FHIRParserIndicates whether this parser is ignoring unrecognized elements- Specified by:
isIgnoringUnrecognizedElementsin interfaceFHIRParser- Returns:
- true if this parser is ignoring unrecognized elements, false otherwise
-
setProperty
public void setProperty(java.lang.String name, java.lang.Object value)Description copied from interface:FHIRParserSet the property with the given name to the passed value- Specified by:
setPropertyin interfaceFHIRParser
-
getProperty
public java.lang.Object getProperty(java.lang.String name)
- Specified by:
getPropertyin interfaceFHIRParser- Returns:
- the property value or
nullif the property has no value
-
getProperty
public <T> T getProperty(java.lang.String name, java.lang.Class<T> type)- Specified by:
getPropertyin interfaceFHIRParser- Returns:
- the property value or
nullif the property has no value
-
getPropertyOrDefault
public java.lang.Object getPropertyOrDefault(java.lang.String name, java.lang.Object defaultValue)- Specified by:
getPropertyOrDefaultin interfaceFHIRParser- Returns:
- the property value or
defaultValueif the property has no value
-
getPropertyOrDefault
public <T> T getPropertyOrDefault(java.lang.String name, T defaultValue, java.lang.Class<T> type)- Specified by:
getPropertyOrDefaultin interfaceFHIRParser- Returns:
- the property value or
defaultValueif the property has no value
-
isPropertySupported
public boolean isPropertySupported(java.lang.String name)
Description copied from interface:FHIRParserWhether the generator supports the property with the passed name- Specified by:
isPropertySupportedin interfaceFHIRParser
-
as
public <T extends FHIRParser> T as(java.lang.Class<T> parserClass)
Description copied from interface:FHIRParserAttempt to cast the FHIRParser to a specific subclass- Specified by:
asin interfaceFHIRParser- Type Parameters:
T- The FHIRParser subclass to cast to- Returns:
-
-