NightOwl888 commented on code in PR #809:
URL: https://github.com/apache/lucenenet/pull/809#discussion_r1161194502
##########
src/Lucene.Net/Util/RollingBuffer.cs:
##########
@@ -23,17 +22,32 @@ namespace Lucene.Net.Util
*/
/// <summary>
- /// LUCENENET specific class to allow referencing static members of
- /// <see cref="RollingBuffer{T}"/> without referencing its generic closing
type.
+ /// Implement to reset an instance
/// </summary>
- public static class RollingBuffer
+ public interface IResettable
{
- /// <summary>
- /// Implement to reset an instance
- /// </summary>
- public interface IResettable
+ void Reset();
+ }
+
+ /// <summary>
+ /// LUCENENET specific interface to allow overriding rolling buffer item
creation
+ /// without having to call virtual methods from the constructor
+ /// </summary>
+ public interface IRollingBufferItemFactory<out T>
+ {
+ T Create(object rollingBuffer);
+ }
+
+ /// <summary>
+ /// LUCENENET specific class that provides default implementation for
+ /// <see cref="IRollingBufferItemFactory{T}"/>.
+ /// </summary>
+ public class RollingBufferItemFactory<T> : IRollingBufferItemFactory<T>
where T : new()
+ {
+ public static readonly RollingBufferItemFactory<T> Default = new
RollingBufferItemFactory<T>();
Review Comment:
Since this is public, let's make it a property. That is the way Microsoft
declares these.
```c#
public static RollingBufferItemFactory<T> Default { get; } = new
RollingBufferItemFactory<T>();
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]