Class TypedActionLoader
An IActionLoader implementation for multiple IAction types.
Inheritance
Implements
Namespace: Libplanet.Action.Loader
Assembly: Libplanet.Action.dll
Syntax
public class TypedActionLoader : object, IActionLoader
Constructors
| Improve this Doc View SourceTypedActionLoader(IDictionary<IValue, Type>)
Creates a new TypedActionLoader instance with an explicit
The mapping can be generated semi-automatically using Create(Nullable<Assembly>, Nullable<Type>).
Declaration
public TypedActionLoader(IDictionary<IValue, Type> types)
Parameters
Type | Name | Description |
---|---|---|
IDictionary<IValue, Type> | types | The |
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<IValue, Type> |
Methods
| Improve this Doc View SourceCreate(Nullable<Assembly>, Nullable<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
-
The
to search is assembly
if given, or theof baseType
if not. -
From the
determined above, all IActions with ActionTypeAttribute attached are collected. -
If
baseType
is provided, only those IAction types that are assignable tobaseType
are selected.
Then a dictionary mapping from
Declaration
public static TypedActionLoader Create(Assembly? assembly = null, Type? baseType = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<Assembly> | assembly | The |
System.Nullable<Type> | baseType | The type of IAction to filter. |
Returns
Type | Description |
---|---|
TypedActionLoader | A TypedActionLoader created from provided
|
Exceptions
Type | Condition |
---|---|
InvalidActionException | Thrown when an IAction cannot be
instantiated with given |
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 |
---|---|---|
System.Int64 | index | |
IValue | value |
Returns
Type | Description |
---|---|
IAction |