Package com.ibm.fhir.model.generator
Interface FHIRGenerator
-
- All Known Implementing Classes:
FHIRAbstractGenerator
,FHIRJsonGenerator
,FHIRXMLGenerator
public interface FHIRGenerator
Generate FHIR resource representations from fhir-model objects
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROPERTY_INDENT_AMOUNT
Property name for a property that controls the amount of indentation to use for each indentation "level"
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends FHIRGenerator>
Tas(java.lang.Class<T> generatorClass)
void
generate(Visitable visitable, java.io.OutputStream out)
Writevisitable
to the passed OutputStream.void
generate(Visitable visitable, java.io.Writer writer)
Writevisitable
using the passed Writer.static FHIRGenerator
generator(Format format)
Create a FHIRGenerator (without pretty-printing) for the given format.static FHIRGenerator
generator(Format format, boolean prettyPrinting)
Create a FHIRGenerator for the given format.java.lang.Object
getProperty(java.lang.String name)
<T> T
getProperty(java.lang.String name, java.lang.Class<T> type)
java.lang.Object
getPropertyOrDefault(java.lang.String name, java.lang.Object defaultValue)
<T> T
getPropertyOrDefault(java.lang.String name, T defaultValue, java.lang.Class<T> type)
boolean
isPrettyPrinting()
boolean
isPropertySupported(java.lang.String name)
Whether the generator supports the property with the passed namevoid
setProperty(java.lang.String name, java.lang.Object value)
Set the property with the given name to the passed value
-
-
-
Field Detail
-
PROPERTY_INDENT_AMOUNT
static final java.lang.String PROPERTY_INDENT_AMOUNT
Property name for a property that controls the amount of indentation to use for each indentation "level"- See Also:
- Constant Field Values
-
-
Method Detail
-
generate
void generate(Visitable visitable, java.io.OutputStream out) throws FHIRGeneratorException
Writevisitable
to the passed OutputStream. This method does not close the passed OutputStream. Forvisitable
of type Resource, this serializes the resource in accordance with the specification. Forvisitable
of type Element, this serializes the element content using a suitable wrapper for the configured format.- Parameters:
visitable
- The visitable Resource or Element to serializeout
-- Throws:
FHIRGeneratorException
-
generate
void generate(Visitable visitable, java.io.Writer writer) throws FHIRGeneratorException
Writevisitable
using the passed Writer. This method does not close the passed Writer. Forvisitable
of type Resource, this serializes the resource in accordance with the specification. Forvisitable
of type Element, this serializes the element content using a suitable wrapper for the configured format.- Parameters:
visitable
- The visitable Resource or Element to serializewriter
-- Throws:
FHIRGeneratorException
-
isPrettyPrinting
boolean isPrettyPrinting()
- Returns:
- whether this FHIRGenerator is configured to pretty-print its output
-
setProperty
void setProperty(java.lang.String name, java.lang.Object value)
Set the property with the given name to the passed value- Throws:
java.lang.IllegalArgumentException
- if the propertyname
is unknown or unsupported
-
getProperty
java.lang.Object getProperty(java.lang.String name)
- Returns:
- the property value or
null
if the property has no value
-
getPropertyOrDefault
java.lang.Object getPropertyOrDefault(java.lang.String name, java.lang.Object defaultValue)
- Returns:
- the property value or
defaultValue
if the property has no value
-
getProperty
<T> T getProperty(java.lang.String name, java.lang.Class<T> type)
- Returns:
- the property value or
null
if the property has no value
-
getPropertyOrDefault
<T> T getPropertyOrDefault(java.lang.String name, T defaultValue, java.lang.Class<T> type)
- Returns:
- the property value or
defaultValue
if the property has no value
-
isPropertySupported
boolean isPropertySupported(java.lang.String name)
Whether the generator supports the property with the passed name
-
as
<T extends FHIRGenerator> T as(java.lang.Class<T> generatorClass)
-
generator
static FHIRGenerator generator(Format format)
Create a FHIRGenerator (without pretty-printing) for the given format.- Parameters:
format
-- Returns:
- Throws:
java.lang.IllegalArgumentException
- ifformat
is not supported
-
generator
static FHIRGenerator generator(Format format, boolean prettyPrinting)
Create a FHIRGenerator for the given format.- Parameters:
format
-prettyPrinting
- whether the returned FHIRGenerator should pretty-print its output- Returns:
- Throws:
java.lang.IllegalArgumentException
- ifformat
is not supported
-
-