Class StateChange
Represents a single change in the state. Tracks old and new values, type, timestamp, priority, and optional metadata.
Inherited Members
Namespace: ModularityKit.Mutator.Abstractions.Changes
Assembly: ModularityKit.Mutator.dll
Syntax
public sealed class StateChange
Properties
| Edit this page View SourceMetadata
Optional additional metadata related to the change.
Declaration
public IReadOnlyDictionary<string, object>? Metadata { get; init; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> |
NewValue
Value after the change.
Declaration
public object? NewValue { get; }
Property Value
| Type | Description |
|---|---|
| object |
OldValue
Value before the change.
Declaration
public object? OldValue { get; }
Property Value
| Type | Description |
|---|---|
| object |
Path
Path to the changed value (e.g., "Email", "Address.City").
Declaration
public string Path { get; }
Property Value
| Type | Description |
|---|---|
| string |
Priority
Priority of the change (used for conflict resolution).
Declaration
public int Priority { get; init; }
Property Value
| Type | Description |
|---|---|
| int |
Timestamp
Timestamp when the change occurred.
Declaration
public DateTimeOffset Timestamp { get; init; }
Property Value
| Type | Description |
|---|---|
| DateTimeOffset |
Methods
| Edit this page View SourceAdded(string, object?)
Creates a StateChange representing an added value.
Declaration
public static StateChange Added(string path, object? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | Path of the added value. |
| object | value | Newly added value. |
Returns
| Type | Description |
|---|---|
| StateChange | A StateChange instance. |
Modified(string, object?, object?)
Creates a StateChange representing a modified value.
Declaration
public static StateChange Modified(string path, object? oldValue, object? newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | Path of the modified value. |
| object | oldValue | Previous value. |
| object | newValue | New value. |
Returns
| Type | Description |
|---|---|
| StateChange | A StateChange instance. |
Removed(string, object?)
Creates a StateChange representing a removed value.
Declaration
public static StateChange Removed(string path, object? oldValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | Path of the removed value. |
| object | oldValue | Value before removal. |
Returns
| Type | Description |
|---|---|
| StateChange | A StateChange instance. |
Replaced(string, object?, object?)
Creates a StateChange representing a replacement (old value replaced by new value).
Declaration
public static StateChange Replaced(string path, object? oldValue, object? newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | Path of the replaced value. |
| object | oldValue | Previous value. |
| object | newValue | New value. |
Returns
| Type | Description |
|---|---|
| StateChange | A StateChange instance. |