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();
}