Class TypedActionLoader
An IActionLoader implementation for multiple IAction types.
Implements
Inherited Members
Namespace: Libplanet.Action.Loader
Assembly: Libplanet.Action.dll
Syntax
public class TypedActionLoader : IActionLoader
Constructors
| Improve this Doc View SourceTypedActionLoader(IDictionary<IValue, Type>)
Creates a new TypedActionLoader instance with an explicit Bencodex.Types.IValues to Types mapping.
The mapping can be generated semi-automatically using Create(Assembly, Type).
Declaration
public TypedActionLoader(IDictionary<IValue, Type> types)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionary<Bencodex.Types.IValue, Type> | types | The Bencodex.Types.IValues to Types mapping to use. |
See Also
Properties
| Improve this Doc View SourceTypes
An IActionLoader implementation for multiple IAction types.
Declaration
public IDictionary<IValue, Type> Types { get; }
Property Value
| Type | Description |
|---|---|
| IDictionary<Bencodex.Types.IValue, Type> |
Methods
| Improve this Doc View SourceCreate(Assembly, Type)
Creates a new TypedActionLoader instance.
The IAction type to load is restricted to given
assembly and baseType,
except for those handled by Registry for system IActions.
This automatically searches an Assembly with all IActions according to the following rule:
-
The Assembly to search is
assemblyif given, or the Assembly ofbaseTypeif not. - From the Assembly determined above, all IActions with ActionTypeAttribute attached are collected.
-
If
baseTypeis provided, only those IAction types that are assignable tobaseTypeare selected.
Then a dictionary mapping from Bencodex.Types.IValues to Types created from searched IActions and the explicit loader is created by passing the map to TypedActionLoader(IDictionary<IValue, Type>).
Declaration
public static TypedActionLoader Create(Assembly assembly = null, Type baseType = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Assembly | assembly | |
| Type | baseType | The type of IAction to filter. |
Returns
| Type | Description |
|---|---|
| TypedActionLoader | A TypedActionLoader created from provided
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when both |
See Also
| Improve this Doc View SourceLoadAction(Int64, IValue)
An IActionLoader implementation for multiple IAction types.
Declaration
public IAction LoadAction(long index, IValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| Int64 | index | |
| Bencodex.Types.IValue | value |
Returns
| Type | Description |
|---|---|
| IAction |