Show / Hide Table of Contents

Class TypedActionLoader

An IActionLoader implementation for multiple IAction types.

Inheritance
System.Object
TypedActionLoader
Implements
IActionLoader
Namespace: Libplanet.Action.Loader
Assembly: Libplanet.Action.dll
Syntax
public class TypedActionLoader : object, IActionLoader

Constructors

| Improve this Doc View Source

TypedActionLoader(IDictionary<IValue, Type>)

Creates a new TypedActionLoader instance with an explicit s to s mapping.

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 s to s mapping to use.

See Also
Create(Nullable<Assembly>, Nullable<Type>)

Properties

| Improve this Doc View Source

Types

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 Source

Create(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 with all IActions according to the following rule:

  • The to search is assembly if given, or the of 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 to baseType are selected.

Then a dictionary mapping from s to s 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
System.Nullable<Assembly> assembly

The to search IAction types.

System.Nullable<Type> baseType

The type of IAction to filter.

Returns
Type Description
TypedActionLoader

A TypedActionLoader created from provided assembly and baseType.

Exceptions
Type Condition
InvalidActionException

Thrown when an IAction cannot be instantiated with given index and value.

See Also
TypedActionLoader(IDictionary<IValue, Type>)
| Improve this Doc View Source

LoadAction(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

Implements

IActionLoader
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium