Interface FHIRParser

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T extends FHIRParser>
      T
      as​(java.lang.Class<T> parserClass)
      Attempt to cast the FHIRParser to a specific subclass
      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 isIgnoringUnrecognizedElements()
      Indicates whether this parser is ignoring unrecognized elements
      boolean isPropertySupported​(java.lang.String name)
      Whether the generator supports the property with the passed name
      boolean isValidating()
      Indicates whether this parser is a validating parser
      <T extends Resource>
      T
      parse​(java.io.InputStream in)
      Read a resource from the passed InputStream.
      <T extends Resource>
      T
      parse​(java.io.Reader reader)
      Read a resource using the passed Reader.
      static FHIRParser parser​(Format format)
      Create a FHIRParser for the given format.
      void setIgnoringUnrecognizedElements​(boolean ignoringUnrecognizedElements)
      Set the ignoring unrecognized elements indicator for this parser
      void setProperty​(java.lang.String name, java.lang.Object value)
      Set the property with the given name to the passed value
      void setValidating​(boolean validating)
      Set the validating parser indicator for this parser
    • Method Detail

      • parse

        <T extends Resource> T parse​(java.io.InputStream in)
                              throws FHIRParserException
        Read a resource from the passed InputStream. This method does not close the passed InputStream.
        Type Parameters:
        T - The resource type to read
        Parameters:
        in -
        Returns:
        Throws:
        FHIRParserException - if the resource could not be parsed for any reason
      • parse

        <T extends Resource> T parse​(java.io.Reader reader)
                              throws FHIRParserException
        Read a resource using the passed Reader. This method does not close the passed Reader.
        Type Parameters:
        T - The resource type to read
        Parameters:
        reader -
        Returns:
        Throws:
        FHIRParserException - if the resource could not be parsed for any reason
      • setValidating

        void setValidating​(boolean validating)
        Set the validating parser indicator for this parser

        A validating parser performs basic validation during parsing / deserialization of the input format including:

        • element cardinality checking
        • element type checking
        • element value checking
        Parameters:
        validating - the validating parser indicator
        See Also:
        ValidationSupport
      • isValidating

        boolean isValidating()
        Indicates whether this parser is a validating parser
        Returns:
        true if this parser is a validating parser, false otherwise
      • setIgnoringUnrecognizedElements

        void setIgnoringUnrecognizedElements​(boolean ignoringUnrecognizedElements)
        Set the ignoring unrecognized elements indicator for this parser
        Parameters:
        ignoringUnrecognizedElements - the ignoring unrecognized elements indicator
      • isIgnoringUnrecognizedElements

        boolean isIgnoringUnrecognizedElements()
        Indicates whether this parser is ignoring unrecognized elements
        Returns:
        true if this parser is ignoring unrecognized elements, false otherwise
      • 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 FHIRParser> T as​(java.lang.Class<T> parserClass)
        Attempt to cast the FHIRParser to a specific subclass
        Type Parameters:
        T - The FHIRParser subclass to cast to
        Returns:
        Throws:
        java.lang.ClassCastException - If the InputStream contains a FHIR resource type that cannot be cast to the requested type
      • parser

        static FHIRParser parser​(Format format)
        Create a FHIRParser for the given format.
        Parameters:
        format -
        Returns:
        Throws:
        java.lang.IllegalArgumentException - if format is not supported