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 Details

    • 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:
    • PARSER_MODULE_TYPE

      static final String PARSER_MODULE_TYPE
      Defines one of the possible values of property PARSER_TYPE.
      See Also:
    • PARSER_TEMPLATE

      static final String PARSER_TEMPLATE
      Defines one of the possible values of property PARSER_TYPE.
      See Also:
    • PARSER_RULE

      static final String PARSER_RULE
      Defines one of the possible values of property PARSER_TYPE.
      See Also:
    • 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:
    • FORMAT_JSON

      static final String FORMAT_JSON
      Defines a possible value of property FORMAT. It means that the parser supports JSON format.
      See Also:
    • FORMAT_YAML

      static final String FORMAT_YAML
      Defines a possible value of property FORMAT. It means that the parser supports YAML format.
      See Also:
  • Method Details

    • 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.