Projbook.Core.Snippet.SnippetExtractorFactory.CreateExtractor C# (CSharp) Метод

CreateExtractor() публичный Метод

Creates a new instance of ISnippetExtractor according to the snippet extraction rule.
public CreateExtractor ( SnippetExtractionRule snippetExtractionRule ) : ISnippetExtractor
snippetExtractionRule SnippetExtractionRule The snippet extraction rule.
Результат ISnippetExtractor
        public ISnippetExtractor CreateExtractor(SnippetExtractionRule snippetExtractionRule)
        {
            // Return null if the extraction rule is null
            if (null == snippetExtractionRule)
            {
                return null;
            }

            // Lookup factory in loaded extractor factories
            Func<ISnippetExtractor> matchingExtractorFactory;
            if (loadedExtractorFactories.TryGetValue(snippetExtractionRule.Language, out matchingExtractorFactory))
            {
                // Create instance from the matching extractor factory
                return matchingExtractorFactory();
            }

            // Create instance from default extractor factory
            return this.defaultExtractorFactory();
        }