Package com.ibm.fhir.model.generator
Class FHIRAbstractGenerator
- java.lang.Object
-
- com.ibm.fhir.model.generator.FHIRAbstractGenerator
-
- All Implemented Interfaces:
FHIRGenerator
- Direct Known Subclasses:
FHIRJsonGenerator,FHIRXMLGenerator
public abstract class FHIRAbstractGenerator extends java.lang.Object implements FHIRGenerator
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanprettyPrintingprotected java.util.Map<java.lang.String,java.lang.Object>properties-
Fields inherited from interface com.ibm.fhir.model.generator.FHIRGenerator
PROPERTY_INDENT_AMOUNT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFHIRAbstractGenerator(boolean prettyPrinting)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T extends FHIRGenerator>
Tas(java.lang.Class<T> generatorClass)abstract voidgenerate(Visitable visitable, java.io.OutputStream out)Writevisitableto the passed OutputStream.abstract voidgenerate(Visitable visitable, java.io.Writer writer)Writevisitableusing the passed Writer.java.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)booleanisPrettyPrinting()booleanisPropertySupported(java.lang.String name)Whether the generator supports the property with the passed namevoidsetProperty(java.lang.String name, java.lang.Object value)Set the property with the given name to the passed value
-
-
-
Method Detail
-
generate
public abstract void generate(Visitable visitable, java.io.OutputStream out) throws FHIRGeneratorException
Description copied from interface:FHIRGeneratorWritevisitableto the passed OutputStream. This method does not close the passed OutputStream. Forvisitableof type Resource, this serializes the resource in accordance with the specification. Forvisitableof type Element, this serializes the element content using a suitable wrapper for the configured format.- Specified by:
generatein interfaceFHIRGenerator- Parameters:
visitable- The visitable Resource or Element to serialize- Throws:
FHIRGeneratorException
-
generate
public abstract void generate(Visitable visitable, java.io.Writer writer) throws FHIRGeneratorException
Description copied from interface:FHIRGeneratorWritevisitableusing the passed Writer. This method does not close the passed Writer. Forvisitableof type Resource, this serializes the resource in accordance with the specification. Forvisitableof type Element, this serializes the element content using a suitable wrapper for the configured format.- Specified by:
generatein interfaceFHIRGenerator- Parameters:
visitable- The visitable Resource or Element to serialize- Throws:
FHIRGeneratorException
-
isPrettyPrinting
public boolean isPrettyPrinting()
- Specified by:
isPrettyPrintingin interfaceFHIRGenerator- Returns:
- whether this FHIRGenerator is configured to pretty-print its output
-
setProperty
public void setProperty(java.lang.String name, java.lang.Object value)Description copied from interface:FHIRGeneratorSet the property with the given name to the passed value- Specified by:
setPropertyin interfaceFHIRGenerator
-
getProperty
public java.lang.Object getProperty(java.lang.String name)
- Specified by:
getPropertyin interfaceFHIRGenerator- 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 interfaceFHIRGenerator- 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 interfaceFHIRGenerator- 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 interfaceFHIRGenerator- Returns:
- the property value or
defaultValueif the property has no value
-
isPropertySupported
public boolean isPropertySupported(java.lang.String name)
Description copied from interface:FHIRGeneratorWhether the generator supports the property with the passed name- Specified by:
isPropertySupportedin interfaceFHIRGenerator
-
as
public <T extends FHIRGenerator> T as(java.lang.Class<T> generatorClass)
- Specified by:
asin interfaceFHIRGenerator
-
-