UNPKG

graphdb

Version:

Javascript client library supporting GraphDB and RDF4J REST API.

65 lines (64 loc) 2.11 kB
export = ParserRegistry; /** * Implementation of registry holding {@link 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 {@link ContentParser} interface and an error is * thrown if there are invalid parsers. * * @class * @author Mihail Radkov * @author Svilen Velikov */ declare class ParserRegistry { /** * @private * @param {ContentParser} parser to be validated * @throws {Error} if the provided parser is not implementing * {@link ContentParser} or has not supported type */ private static validateParser; /** * @param {ContentParser[]} [parsers] initialized list with valid parser * instances. */ constructor(parsers?: ContentParser[]); parsers: {}; /** * Initializes a console logger. */ initLogger(): void; logger: ConsoleLogger; /** * Register provided {@link ContentParser} under given key as returned by * <code>parser.getSupportedType()</code>. * If the type of the provided parser is already registered, then this method * will override the registered parser with the provided instance. * * @param {ContentParser} parser implementation wrapper. */ register(parser: ContentParser): void; /** * Getter for parser of given type. * * @param {string} type of the parser for get. * @return {ContentParser} if parser of requested type is found or * <code>null</code> otherwise. */ get(type: string): ContentParser; /** * Maps provided parsers by their supported content type. * * @private * @param {ContentParser[]} parsers provided with the constructor. */ private init; /** * @private * @param {ContentParser[]} parsers */ private validateParsers; } import ConsoleLogger = require("../logging/console-logger"); import ContentParser = require("../parser/content-parser");