Class FHIRAbstractGenerator

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected FHIRAbstractGenerator​(boolean prettyPrinting)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends FHIRGenerator>
      T
      as​(java.lang.Class<T> generatorClass)  
      abstract void generate​(Visitable visitable, java.io.OutputStream out)
      Write visitable to the passed OutputStream.
      abstract void generate​(Visitable visitable, java.io.Writer writer)
      Write visitable using the passed Writer.
      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 name
      void setProperty​(java.lang.String name, java.lang.Object value)
      Set the property with the given name to the passed value
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • properties

        protected java.util.Map<java.lang.String,​java.lang.Object> properties
      • prettyPrinting

        protected final boolean prettyPrinting
    • Constructor Detail

      • FHIRAbstractGenerator

        protected FHIRAbstractGenerator​(boolean prettyPrinting)
    • Method Detail

      • generate

        public abstract void generate​(Visitable visitable,
                                      java.io.OutputStream out)
                               throws FHIRGeneratorException
        Description copied from interface: FHIRGenerator
        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.
        Specified by:
        generate in interface FHIRGenerator
        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: FHIRGenerator
        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.
        Specified by:
        generate in interface FHIRGenerator
        Parameters:
        visitable - The visitable Resource or Element to serialize
        Throws:
        FHIRGeneratorException
      • isPrettyPrinting

        public boolean isPrettyPrinting()
        Specified by:
        isPrettyPrinting in interface FHIRGenerator
        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: FHIRGenerator
        Set the property with the given name to the passed value
        Specified by:
        setProperty in interface FHIRGenerator
      • getProperty

        public java.lang.Object getProperty​(java.lang.String name)
        Specified by:
        getProperty in interface FHIRGenerator
        Returns:
        the property value or null if the property has no value
      • getProperty

        public <T> T getProperty​(java.lang.String name,
                                 java.lang.Class<T> type)
        Specified by:
        getProperty in interface FHIRGenerator
        Returns:
        the property value or null if the property has no value
      • getPropertyOrDefault

        public java.lang.Object getPropertyOrDefault​(java.lang.String name,
                                                     java.lang.Object defaultValue)
        Specified by:
        getPropertyOrDefault in interface FHIRGenerator
        Returns:
        the property value or defaultValue if the property has no value
      • getPropertyOrDefault

        public <T> T getPropertyOrDefault​(java.lang.String name,
                                          T defaultValue,
                                          java.lang.Class<T> type)
        Specified by:
        getPropertyOrDefault in interface FHIRGenerator
        Returns:
        the property value or defaultValue if the property has no value
      • isPropertySupported

        public boolean isPropertySupported​(java.lang.String name)
        Description copied from interface: FHIRGenerator
        Whether the generator supports the property with the passed name
        Specified by:
        isPropertySupported in interface FHIRGenerator