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
Modifier and TypeFieldDescriptionstatic 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 propertyFORMAT
.static final String
Defines one of the possible values of propertyPARSER_TYPE
.static final String
Defines one of the possible values of propertyPARSER_TYPE
.static final String
Defines one of the possible values of propertyPARSER_TYPE
.static final String
Specifies the type of the parser whose is the type of the parsed automation objects. -
Method Summary
Modifier and TypeMethodDescriptionparse
(InputStreamReader reader) 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
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
Defines one of the possible values of propertyPARSER_TYPE
.- See Also:
-
PARSER_TEMPLATE
Defines one of the possible values of propertyPARSER_TYPE
.- See Also:
-
PARSER_RULE
Defines one of the possible values of propertyPARSER_TYPE
.- See Also:
-
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
Defines the possible value of propertyFORMAT
. It means that the parser supports json format.- See Also:
-
-
Method Details
-
parse
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
Records the automation objects in a file with some particular format.- Parameters:
dataObjects
- provides an objects for export.writer
- isOutputStreamWriter
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.
-