Package com.ibm.fhir.model.parser
Interface FHIRParser
- 
- All Known Implementing Classes:
 FHIRAbstractParser,FHIRJsonParser,FHIRXMLParser
public interface FHIRParserParse FHIR resource representations into fhir-model objects 
- 
- 
Field Summary
Fields Modifier and Type Field Description static StringPROPERTY_IGNORE_UNRECOGNIZED_ELEMENTSProperty name for a property that controls whether the parser will ignore or throw an exception on unrecognized elements 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends FHIRParser>
Tas(Class<T> parserClass)Attempt to cast the FHIRParser to a specific subclassObjectgetProperty(String name)<T> TgetProperty(String name, Class<T> type)ObjectgetPropertyOrDefault(String name, Object defaultValue)<T> TgetPropertyOrDefault(String name, T defaultValue, Class<T> type)booleanisPropertySupported(String name)Whether the generator supports the property with the passed name<T extends Resource>
Tparse(InputStream in)Read a resource from the passed InputStream.<T extends Resource>
Tparse(Reader reader)Read a resource using the passed Reader.static FHIRParserparser(Format format)Create a FHIRParser for the given format.voidsetProperty(String name, Object value)Set the property with the given name to the passed value 
 - 
 
- 
- 
Field Detail
- 
PROPERTY_IGNORE_UNRECOGNIZED_ELEMENTS
static final String PROPERTY_IGNORE_UNRECOGNIZED_ELEMENTS
Property name for a property that controls whether the parser will ignore or throw an exception on unrecognized elements- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
parse
<T extends Resource> T parse(InputStream in) throws FHIRParserException
Read a resource from the passed InputStream. This method does not close the passed InputStream.- Type Parameters:
 T- The resource type to read- Parameters:
 in-- Returns:
 - Throws:
 FHIRParserExceptionClassCastException- If the InputStream contains a FHIR resource type that cannot be cast to the requested type
 
- 
parse
<T extends Resource> T parse(Reader reader) throws FHIRParserException
Read a resource using the passed Reader. This method does not close the passed Reader.- Type Parameters:
 T- The resource type to read- Parameters:
 reader-- Returns:
 - Throws:
 FHIRParserExceptionClassCastException- If the InputStream contains a FHIR resource type that cannot be cast to the requested type
 
- 
setProperty
void setProperty(String name, Object value)
Set the property with the given name to the passed value- Throws:
 IllegalArgumentException- if the propertynameis unknown or unsupported
 
- 
getProperty
Object getProperty(String name)
- Returns:
 - the property value or 
nullif the property has no value 
 
- 
getPropertyOrDefault
Object getPropertyOrDefault(String name, Object defaultValue)
- Returns:
 - the property value or 
defaultValueif the property has no value 
 
- 
getProperty
<T> T getProperty(String name, Class<T> type)
- Returns:
 - the property value or 
nullif the property has no value 
 
- 
getPropertyOrDefault
<T> T getPropertyOrDefault(String name, T defaultValue, Class<T> type)
- Returns:
 - the property value or 
defaultValueif the property has no value 
 
- 
isPropertySupported
boolean isPropertySupported(String name)
Whether the generator supports the property with the passed name 
- 
as
<T extends FHIRParser> T as(Class<T> parserClass)
Attempt to cast the FHIRParser to a specific subclass- Type Parameters:
 T- The FHIRParser subclass to cast to- Returns:
 - Throws:
 ClassCastException- If the InputStream contains a FHIR resource type that cannot be cast to the requested type
 
- 
parser
static FHIRParser parser(Format format)
Create a FHIRParser for the given format.- Parameters:
 format-- Returns:
 - Throws:
 IllegalArgumentException- ifformatis not supported
 
 - 
 
 -