Class DefaultCodecFactory
LUCENENET specific class that implements the default functionality for the ICodecFactory.
The most common use cases are:
- subclass DefaultCodecFactory and override GetCodec(Type) so an external dependency injection container can be used to supply the instances (lifetime should be singleton). Note that you could alternately use the "named type" feature that many DI containers have to supply the type based on name by overriding GetCodec(String).
- subclass DefaultCodecFactory and override GetCodecType(String) so a type new type can be supplied that is not in the Lucene.Net.Codecs.DefaultCodecFactory.codecNameToTypeMap.
- subclass DefaultCodecFactory to add new or override the default Codec types by overriding Initialize() and calling PutCodecType(Type).
- subclass DefaultCodecFactory to scan additional assemblies for Codec subclasses in by overriding Initialize() and calling ScanForCodecs(Assembly). For performance reasons, the default behavior only loads Lucene.Net codecs.
To set the ICodecFactory, call SetCodecFactory(ICodecFactory).
Inherited Members
Assembly: DistributedLucene.Net.dll
Syntax
public class DefaultCodecFactory : NamedServiceFactory<Codec>, ICodecFactory, IServiceListable
Methods
Name | Description |
---|---|
AvailableServices() | Gets a list of the available Codecs (by name). |
GetCodec(String) | Gets the Codec instance from the provided |
GetCodec(Type) | Gets the Codec instance from the provided |
GetCodecType(String) | Gets the Codec |
Initialize() | Initializes the codec type cache with the known Codec types.
Override this method (and optionally call If two types have the same name by using the CodecNameAttribute, the last one registered wins. |
PutCodecType(Type) | Adds a Codec type to the Lucene.Net.Codecs.DefaultCodecFactory.codecNameToTypeMap, using the name provided in the CodecNameAttribute, if present, or the name of the codec class minus the "Codec" suffix as the name by default. Note that if a Codec with the same name already exists in the map, calling this method will update it to the new type. |
ScanForCodecs(Assembly) | Scans the given |
ScanForCodecs(IEnumerable<Assembly>) | Scans the given |