Interface Parser<T>


  • @NonNullByDefault
    public interface Parser<T>
    This interface provides opportunity to plug different parsers, for example JSON, GSON or other.
    Author:
    Ana Dimova - Initial contribution
    • Field Detail

      • PARSER_TYPE

        static final String PARSER_TYPE
        Specifies the type of the parser whose is the type of the parsed automation objects.

        Example : "parser.type" = "parser.module.type"; It is used as registration property of the corresponding service.

        See Also:
        Constant Field Values
      • FORMAT

        static final String FORMAT
        Defines a service registration property used for recognition of which file format is supported by the parser.

        Example : "format" = "json"; It is used as registration property of the corresponding service.

        See Also:
        Constant Field Values
      • FORMAT_JSON

        static final String FORMAT_JSON
        Defines the possible value of property FORMAT. It means that the parser supports json format.
        See Also:
        Constant Field Values
    • Method Detail

      • parse

        Set<T> parse​(InputStreamReader reader)
              throws ParsingException
        Loads a file with some particular format and parse it to the corresponding automation objects.
        Parameters:
        reader - InputStreamReader which reads from a file containing automation object representations.
        Returns:
        a set of automation objects. Each object represents the result of parsing of one object.
        Throws:
        ParsingException - is thrown when json format is wrong or there is a semantic error in description of the automation objects.
      • serialize

        void serialize​(Set<T> dataObjects,
                       OutputStreamWriter writer)
                throws Exception
        Records the automation objects in a file with some particular format.
        Parameters:
        dataObjects - provides an objects for export.
        writer - is OutputStreamWriter used to write the automation objects in a file.
        Throws:
        Exception - is thrown when I/O operation has failed or has been interrupted or generating of the text fails for some reasons.