Class CommandInterpreter.Builder
Represents builder of the interpreter.
Inherited Members
Namespace: DotNext.Net.Cluster.Consensus.Raft.Commands
Assembly: DotNext.Net.Cluster.dll
Syntax
public sealed class CommandInterpreter.Builder : ISupplier<CommandInterpreter>, IFunctional<Func<CommandInterpreter>>, IResettable
Methods
| Edit this page View SourceAdd<TCommand>(Func<TCommand, object?, CancellationToken, ValueTask>)
Registers command handler.
Declaration
public CommandInterpreter.Builder Add<TCommand>(Func<TCommand, object?, CancellationToken, ValueTask> handler) where TCommand : ICommand<TCommand>
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TCommand, object, CancellationToken, ValueTask> | handler | The command handler. |
Returns
| Type | Description |
|---|---|
| CommandInterpreter.Builder | This builder. |
Type Parameters
| Name | Description |
|---|---|
| TCommand | The type of the command supported by the handler. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Add<TCommand>(Func<TCommand, CancellationToken, ValueTask>)
Registers command handler.
Declaration
public CommandInterpreter.Builder Add<TCommand>(Func<TCommand, CancellationToken, ValueTask> handler) where TCommand : ICommand<TCommand>
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TCommand, CancellationToken, ValueTask> | handler | The command handler. |
Returns
| Type | Description |
|---|---|
| CommandInterpreter.Builder | This builder. |
Type Parameters
| Name | Description |
|---|---|
| TCommand | The type of the command supported by the handler. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Build()
Constructs an instance of CommandInterpreter.
Declaration
public CommandInterpreter Build()
Returns
| Type | Description |
|---|---|
| CommandInterpreter | A new instance of the interpreter. |
Reset()
Clears this builder so it can be reused.
Declaration
public void Reset()