Class: ParserRegistry

ParserRegistry(parsersopt)

Implementation of registry holding ContentParser instances and providing interface for registration and access. If this registry is not provided with a list with parsers then it is initialized empty. Otherwise provided parsers are validated if they are compatible with the ContentParser interface and an error is thrown if there are invalid parsers.

Constructor

new ParserRegistry(parsersopt)

Parameters:
Name Type Attributes Description
parsers Array.<ContentParser> <optional>

initialized list with valid parser instances.

Author:
  • Mihail Radkov
  • Svilen Velikov
Source:

Methods

get(type) → {ContentParser}

Getter for parser of given type.

Parameters:
Name Type Description
type string

of the parser for get.

Source:
Returns:

if parser of requested type is found or null otherwise.

Type
ContentParser

initLogger()

Initializes a console logger.

Source:

register(parser)

Register provided ContentParser under given key as returned by parser.getSupportedType(). If the type of the provided parser is already registered, then this method will override the registered parser with the provided instance.

Parameters:
Name Type Description
parser ContentParser

implementation wrapper.

Source: