lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] Shazwazza commented on a change in pull request #291: Fully document Codec Factories and include usage samples (addresses #266)
Date Tue, 23 Jun 2020 03:34:50 GMT

Shazwazza commented on a change in pull request #291:
URL: https://github.com/apache/lucenenet/pull/291#discussion_r443942112



##########
File path: src/Lucene.Net/Support/Codecs/DefaultCodecFactory.cs
##########
@@ -23,29 +23,86 @@ namespace Lucene.Net.Codecs
      */
 
     /// <summary>
-    /// LUCENENET specific class that implements the default functionality for the 
-    /// <see cref="ICodecFactory"/>.
+    /// Implements the default functionality of <see cref="ICodecFactory"/>.
     /// <para/>
-    /// The most common use cases are:
-    /// <list type="bullet">
-    ///     <item><description>Initialize <see cref="DefaultCodecFactory"/>
with a set of <see cref="CustomCodecTypes"/>.</description></item>
-    ///     <item><description>Subclass <see cref="DefaultCodecFactory"/>
and override
-    ///         <see cref="DefaultCodecFactory.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 <see cref="GetCodec(string)"/>.</description></item>
-    ///     <item><description>Subclass <see cref="DefaultCodecFactory"/>
and override
-    ///         <see cref="DefaultCodecFactory.GetCodecType(string)"/> so a type new
type can be
-    ///         supplied that is not in the <see cref="DefaultCodecFactory.codecNameToTypeMap"/>.</description></item>
-    ///     <item><description>Subclass <see cref="DefaultCodecFactory"/>
to add new or override the default <see cref="Codec"/> 
-    ///         types by overriding <see cref="Initialize()"/> and calling <see
cref="PutCodecType(Type)"/>.</description></item>
-    ///     <item><description>Subclass <see cref="DefaultCodecFactory"/>
to scan additional assemblies for <see cref="Codec"/>
-    ///         subclasses in by overriding <see cref="Initialize()"/> and calling
<see cref="ScanForCodecs(Assembly)"/>. 
-    ///         For performance reasons, the default behavior only loads Lucene.Net codecs.</description></item>
-    /// </list>
+    /// To replace the <see cref="DefaultCodecFactory"/> instance, call
+    /// <see cref="Codec.SetCodecFactory(ICodecFactory)"/> at application start up.
+    /// <see cref="DefaultCodecFactory"/> can be subclassed or passed additional parameters
to register
+    /// additional codecs, inject dependencies, or change caching behavior, as shown in the
following examples.
+    /// Alternatively, <see cref="ICodecFactory"/> can be implemented to provide complete
control over
+    /// codec creation and lifetimes.
     /// <para/>
-    /// To set the <see cref="ICodecFactory"/>, call <see cref="Codec.SetCodecFactory(ICodecFactory)"/>.
+    /// <h4>Register Additional Codecs</h4>
+    /// <para/>
+    /// Additional codecs can be added by initializing the instance of <see cref="DefaultCodecFactory"/>
and
+    /// passing an array of <see cref="Codec"/>-derived types.
+    /// <code>
+    /// // Register the factory at application start up.
+    /// Codec.SetCodecFactory(new DefaultCodecFactory {
+    ///     CustomCodecTypes = new Type[] { typeof(MyCodec), typeof(AnotherCodec) }
+    /// });
+    /// </code>
+    /// <para/>
+    /// <h4>Only Use Explicitly Defined Codecs</h4>

Review comment:
       Seems to work! :) 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message