Colibrio Reader Framework API - Cloud license
    Preparing search index...

    Used for implementing parsers to support different Selector formats. An implementation of ISelectorDataParser takes a JSON object and parses it into a specific Selector instance if the format is recognized.

    A SelectorDataParser implementations are typically focused on a single selector type. Add SelectorDataParser implementations to SelectorFactory to add support for a specific selector format.

    See SelectorFactory for how configure its SelectorDataParsers, and how to parse JSON data and fragment selectors into Selector instances.

    interface ISelectorDataParser {
        canParseSelectorData(selectorData: ISelectorData): boolean;
        parseSelectorData(
            selectorData: ISelectorData,
            selectorFactory: ISelectorFactory,
        ): ISelector;
    }

    Implemented by

    Methods

    • Should return true if this instance is able to parse the selector data into a Selector implementation. If this method returns true, parseSelectorData() will be called with the selectorData by the SelectorFactory.

      Parameters

      Returns boolean

    • Should parse the given selector data into a Selector implementation. This method must only be called if canParseSelectorData() returns true for the specified selectorData.

      Parameters

      • selectorData: ISelectorData

        The JSON data to parse into a Selector.

      • selectorFactory: ISelectorFactory

        The SelectorFactory instance that is calling this method. This factory should be used to parse refinement selectors.

      Returns ISelector

      The Selector instance if the parsing was successful, null otherwise.