Documentation Language: Swift

Class

SetCommand

Command to set a property value on an EObject.

@MainActor final class SetCommand

Overview

SetCommand modifies a single-valued structural feature on an EObject, storing the previous value to enable undo operations. This command works with both attributes and single-valued references.

Example Usage

let command = SetCommand(
    object: person,
    feature: nameAttribute,
    value: "John Doe"
)

let previousValue = try await command.execute()
try await command.undo() // Restores previous value

Topics

Initializers

?
init(object:feature:value:)

Creates a new set command.

Instance Properties

V
canRedo

Indicates whether the command can be redone after being undone.

V
canUndo

Indicates whether the command can be undone.

V
description

A human-readable description of the command.

V
feature

The feature to set.

V
newValue

The new value to set.

V
objectId

The object to modify.

Instance Methods

F
execute()

Execute the command, applying its changes to the model.

F
redo()

Redo the command, re-applying its changes after undo.

F
undo()

Undo the command, reversing its changes to the model.

Relationships

Inherits From