Package com.ibm.fhir.model.parser
Class FHIRAbstractParser
- java.lang.Object
-
- com.ibm.fhir.model.parser.FHIRAbstractParser
-
- All Implemented Interfaces:
FHIRParser
- Direct Known Subclasses:
FHIRJsonParser
,FHIRXMLParser
public abstract class FHIRAbstractParser extends Object implements FHIRParser
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Object>
properties
-
Fields inherited from interface com.ibm.fhir.model.parser.FHIRParser
PROPERTY_IGNORE_UNRECOGNIZED_ELEMENTS
-
-
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(Class<T> parserClass)
Attempt to cast the FHIRParser to a specific subclassObject
getProperty(String name)
<T> T
getProperty(String name, Class<T> type)
Object
getPropertyOrDefault(String name, Object defaultValue)
<T> T
getPropertyOrDefault(String name, T defaultValue, Class<T> type)
boolean
isPropertySupported(String name)
Whether the generator supports the property with the passed nameabstract <T extends Resource>
Tparse(InputStream in)
Read a resource from the passed InputStream.abstract <T extends Resource>
Tparse(Reader reader)
Read a resource using the passed Reader.void
setProperty(String name, Object value)
Set the property with the given name to the passed value
-
-
-
Method Detail
-
parse
public abstract <T extends Resource> T parse(InputStream in) throws FHIRParserException
Description copied from interface:FHIRParser
Read a resource from the passed InputStream. This method does not close the passed InputStream.- Specified by:
parse
in interfaceFHIRParser
- Type Parameters:
T
- The resource type to read- Returns:
- Throws:
FHIRParserException
-
parse
public abstract <T extends Resource> T parse(Reader reader) throws FHIRParserException
Description copied from interface:FHIRParser
Read a resource using the passed Reader. This method does not close the passed Reader.- Specified by:
parse
in interfaceFHIRParser
- Type Parameters:
T
- The resource type to read- Returns:
- Throws:
FHIRParserException
-
setProperty
public void setProperty(String name, Object value)
Description copied from interface:FHIRParser
Set the property with the given name to the passed value- Specified by:
setProperty
in interfaceFHIRParser
-
getProperty
public Object getProperty(String name)
- Specified by:
getProperty
in interfaceFHIRParser
- Returns:
- the property value or
null
if the property has no value
-
getProperty
public <T> T getProperty(String name, Class<T> type)
- Specified by:
getProperty
in interfaceFHIRParser
- Returns:
- the property value or
null
if the property has no value
-
getPropertyOrDefault
public Object getPropertyOrDefault(String name, Object defaultValue)
- Specified by:
getPropertyOrDefault
in interfaceFHIRParser
- Returns:
- the property value or
defaultValue
if the property has no value
-
getPropertyOrDefault
public <T> T getPropertyOrDefault(String name, T defaultValue, Class<T> type)
- Specified by:
getPropertyOrDefault
in interfaceFHIRParser
- Returns:
- the property value or
defaultValue
if the property has no value
-
isPropertySupported
public boolean isPropertySupported(String name)
Description copied from interface:FHIRParser
Whether the generator supports the property with the passed name- Specified by:
isPropertySupported
in interfaceFHIRParser
-
as
public <T extends FHIRParser> T as(Class<T> parserClass)
Description copied from interface:FHIRParser
Attempt to cast the FHIRParser to a specific subclass- Specified by:
as
in interfaceFHIRParser
- Type Parameters:
T
- The FHIRParser subclass to cast to- Returns:
-
-