All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.commonmark.internal.InlineParserContextImpl Maven / Gradle / Ivy

package org.commonmark.internal;

import org.commonmark.node.LinkReferenceDefinition;
import org.commonmark.parser.InlineParserContext;
import org.commonmark.parser.beta.LinkProcessor;
import org.commonmark.parser.beta.InlineContentParserFactory;
import org.commonmark.parser.delimiter.DelimiterProcessor;

import java.util.List;
import java.util.Set;

public class InlineParserContextImpl implements InlineParserContext {

    private final List inlineContentParserFactories;
    private final List delimiterProcessors;
    private final List linkProcessors;
    private final Set linkMarkers;
    private final Definitions definitions;

    public InlineParserContextImpl(List inlineContentParserFactories,
                                   List delimiterProcessors,
                                   List linkProcessors,
                                   Set linkMarkers,
                                   Definitions definitions) {
        this.inlineContentParserFactories = inlineContentParserFactories;
        this.delimiterProcessors = delimiterProcessors;
        this.linkProcessors = linkProcessors;
        this.linkMarkers = linkMarkers;
        this.definitions = definitions;
    }

    @Override
    public List getCustomInlineContentParserFactories() {
        return inlineContentParserFactories;
    }

    @Override
    public List getCustomDelimiterProcessors() {
        return delimiterProcessors;
    }

    @Override
    public List getCustomLinkProcessors() {
        return linkProcessors;
    }

    @Override
    public Set getCustomLinkMarkers() {
        return linkMarkers;
    }

    @Override
    public LinkReferenceDefinition getLinkReferenceDefinition(String label) {
        return definitions.getDefinition(LinkReferenceDefinition.class, label);
    }

    @Override
    public  D getDefinition(Class type, String label) {
        return definitions.getDefinition(type, label);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy