Property Setters
When using the Execution Flows fy tool, writing a property setter manually involves defining a property and then adding a @<property_name>.setter
method to manage how the property value is assigned. Alternatively, the fy tool simplifies this process by generating the necessary boilerplate code. You can declare an abstract property and include property <property_name> using setter
in the flow mixins, allowing the tool to automatically handle the setter implementation. This approach streamlines property management in your code.
Automatically Generated Setter Implementation
When a flow declares a setter, the fy tool checks if a setter implementation for the defined property exists. If it does not find an implementation, it generates one. Additionally, the fy tool generates an __init__
method for the encapsulating flow to initialize the setters.
Below is an example of the generated code for a setter for the property greeting: str
.
Example
Abstract property definition:
Property setter defined as a flow mixin:
A Python file generated by the fy tool