docs
Systems
Contracts
ParamsSystem
Key Components

Overview

The ParamsSystem has three public types. It has no managers, coordinators, events, handler interfaces, or listener interfaces.

Params

The main container class. It is the only type that holds values.

Responsibilities:

  • Store values under keys, with one value per key.
  • Return values as the type declared by the key.
  • Report presence with Has and TryGet, and throw for missing required values with Get, Require, and RequireObject.
  • Produce a name-keyed copy of its contents with ToDictionary.

Internally, Params holds a private dictionary keyed by IParamKey. This field is not part of the public surface.

Typical interaction: a caller creates a Params, sets values with Set, and the populated instance is carried by a message. The receiver reads values from it.

ParamKey<T>

A typed, named key. Keys are normally declared as static readonly fields in a domain's keys class, so that the same key instance is used by both the sender and the receiver.

Responsibilities:

  • Hold the unique name used to identify a value.
  • Declare the value type through its generic argument.

Because ParamKey<T> does not override equality, a key instance is identified by reference. Sharing key instances through static fields is what makes the sender and receiver agree on a key.

IParamKey

The untyped interface implemented by ParamKey<T>. It exposes KeyName and lets Params store keys of different value types in one dictionary. Code outside this folder should refer to keys through ParamKey<T>, which is the documented way to create them.