Class SetExecutor
java.lang.Object
ai.nervemind.app.executor.SetExecutor
- All Implemented Interfaces:
NodeExecutor
Executor for the "set" node type - sets or transforms data values.
Provides data manipulation capabilities including setting new values, transforming existing data, and referencing values from previous node outputs. Commonly used to prepare data for subsequent nodes or restructure output.
Node Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| values | Map or JSON String | {} | Key-value pairs to set |
| keepOnlySet | Boolean | false | If true, output only contains set values (no input passthrough) |
Expression Syntax
Values can reference input fields using expression syntax:
$input.fieldName- Reference a field from input data$input.nested.path- Reference nested fields
Example Configuration
{
"values": {
"userName": "$input.user.name",
"status": "processed",
"timestamp": "$input.createdAt"
},
"keepOnlySet": false
}
Output Behavior
- When
keepOnlySet=false(default): Input data is merged with new values - When
keepOnlySet=true: Output contains only the explicitly set values
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute(ai.nervemind.common.domain.Node node, Map<String, Object> input, ExecutionService.ExecutionContext context) Executes the business logic for this node type.Unique identifier for the node type this executor handles.
-
Constructor Details
-
SetExecutor
public SetExecutor()Default constructor.
-
-
Method Details
-
execute
public Map<String,Object> execute(ai.nervemind.common.domain.Node node, Map<String, Object> input, ExecutionService.ExecutionContext context) Description copied from interface:NodeExecutorExecutes the business logic for this node type.- Specified by:
executein interfaceNodeExecutor- Parameters:
node- The node definition containing parameters and configuration. UseNode.parameters()to access user settings.input- Combined output from all upstream nodes that connected to this node. For simple flows, this contains the direct predecessor's output. For merge nodes, it contains combined data.context- Verification context providing access to workflow-scoped services, logger, and execution metadata.- Returns:
- A Map containing the results of this node's execution.
Keys in this map become available variables for downstream nodes.
Note: Returningnullis treated as an empty map.
-
getNodeType
Description copied from interface:NodeExecutorUnique identifier for the node type this executor handles. This must match the 'type' field in the JSON definition of the node.- Specified by:
getNodeTypein interfaceNodeExecutor- Returns:
- The unique type string (e.g., "httpRequest", "llmChat").
-