Class SettingDescriptorList
Wraps a collection of SettingDescriptor and provides typed getters (GetValueAsString(string), GetValueAsInt(string), GetValueAsBool(string), GetValueAsTable(string)) that read from a bound user-provided dictionary and fall back to the descriptors' default values. Plugins declare descriptors once, the host renders the UI, and the plugin consumes the values without manual parsing or default-value handling.
Inherited Members
Namespace: Zaya.Primitives
Assembly: Zaya.Primitives.dll
Syntax
public sealed class SettingDescriptorList
Constructors
| Edit this page View SourceSettingDescriptorList(IReadOnlyList<SettingDescriptor>)
Initializes a new instance of the SettingDescriptorList class with the specified descriptor list. Builds an internal index for O(1) key lookup.
Declaration
public SettingDescriptorList(IReadOnlyList<SettingDescriptor> descriptors)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<SettingDescriptor> | descriptors | The list of setting descriptors. Duplicate keys cause an ArgumentException. |
Properties
| Edit this page View SourceDescriptors
Gets the original descriptor list in declaration order, used for UI rendering.
Declaration
public IReadOnlyList<SettingDescriptor> Descriptors { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<SettingDescriptor> |
Methods
| Edit this page View SourceBind(IReadOnlyDictionary<string, object>)
Binds the user-provided settings values to this list. After calling this method, the typed getters read from the provided dictionary and fall back to the descriptors' default values when a key is missing or cannot be parsed.
Declaration
public void Bind(IReadOnlyDictionary<string, object> values)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyDictionary<string, object> | values | User-provided settings (keyed by the same keys as the descriptors). |
GetValueAsBool(string)
Gets the boolean value for the specified setting key. If the key is not present in the bound dictionary, returns the descriptor's DefaultValue.
Declaration
public bool GetValueAsBool(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The setting key. |
Returns
| Type | Description |
|---|---|
| bool | The boolean value, or default fallback ( |
GetValueAsInt(string)
Gets the integer value for the specified setting key. If the key is not present in the bound dictionary, returns the descriptor's DefaultValue.
Declaration
public int GetValueAsInt(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The setting key. |
Returns
| Type | Description |
|---|---|
| int | The integer value, or default fallback ( |
GetValueAsString(string)
Gets the string value for the specified setting key. If the key is not present in the bound dictionary, returns the descriptor's DefaultValue. Handles all string-based descriptor types: StringSettingDescriptor, FilePathSettingDescriptor, DirectoryPathSettingDescriptor, UrlSettingDescriptor, PasswordSettingDescriptor, and EnumSettingDescriptor.
Declaration
public string GetValueAsString(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The setting key. |
Returns
| Type | Description |
|---|---|
| string | The string value, or default fallback ( |
GetValueAsTable(string)
Gets the table rows for the specified TableSettingDescriptor key. Each row is a SettingDescriptorList bound to that row's cell dictionary, using the table's Columns as descriptors (missing cells fall back to column defaults).
Declaration
public IReadOnlyList<SettingDescriptorList> GetValueAsTable(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The setting key. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<SettingDescriptorList> | Row list; empty when the key is missing, null, or not a recognizable table value. |