Interface FHIRGenerator

    • 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"
    • 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
        Write visitable to the passed OutputStream. This method does not close the passed OutputStream. For visitable of type Resource, this serializes the resource in accordance with the specification. For visitable of type Element, this serializes the element content using a suitable wrapper for the configured format.
        Parameters:
        visitable - The visitable Resource or Element to serialize
        out -
        Throws:
        FHIRGeneratorException
      • generate

        void generate​(Visitable visitable,
                      java.io.Writer writer)
               throws FHIRGeneratorException
        Write visitable using the passed Writer. This method does not close the passed Writer. For visitable of type Resource, this serializes the resource in accordance with the specification. For visitable of type Element, this serializes the element content using a suitable wrapper for the configured format.
        Parameters:
        visitable - The visitable Resource or Element to serialize
        writer -
        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 property name 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 - if format 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 - if format is not supported