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 Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Defines a service registration property used for recognition of which file format is supported by the parser.
    static final String
    Defines the possible value of property FORMAT.
    static final String
    Defines one of the possible values of property PARSER_TYPE.
    static final String
    Defines one of the possible values of property PARSER_TYPE.
    static final String
    Defines one of the possible values of property PARSER_TYPE.
    static final String
    Specifies the type of the parser whose is the type of the parsed automation objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    Loads a file with some particular format and parse it to the corresponding automation objects.
    void
    serialize(Set<T> dataObjects, OutputStreamWriter writer)
    Records the automation objects in a file with some particular format.
  • 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 the possible value of property FORMAT. It means that the parser supports json 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.