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 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 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.voidsetProperty(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: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
-
parse
public abstract <T extends Resource> T parse(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
-
setProperty
public void setProperty(String name, Object value)
Description copied from interface:FHIRParserSet the property with the given name to the passed value- Specified by:
setPropertyin interfaceFHIRParser
-
getProperty
public Object getProperty(String name)
- Specified by:
getPropertyin interfaceFHIRParser- Returns:
- the property value or
nullif the property has no value
-
getProperty
public <T> T getProperty(String name, Class<T> type)
- Specified by:
getPropertyin interfaceFHIRParser- Returns:
- the property value or
nullif the property has no value
-
getPropertyOrDefault
public Object getPropertyOrDefault(String name, Object defaultValue)
- Specified by:
getPropertyOrDefaultin interfaceFHIRParser- Returns:
- the property value or
defaultValueif the property has no value
-
getPropertyOrDefault
public <T> T getPropertyOrDefault(String name, T defaultValue, Class<T> type)
- Specified by:
getPropertyOrDefaultin interfaceFHIRParser- Returns:
- the property value or
defaultValueif the property has no value
-
isPropertySupported
public boolean isPropertySupported(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(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:
-
-