Class RepeatUntilConfig.Builder
- Enclosing class:
RepeatUntilConfig
This builder ensures that DoUntilActionObject instances are created with all necessary configuration before use. It provides a fluent interface for setting the various components needed for do-until operations, with sensible defaults where appropriate.
The builder separates concerns between:
- Action configuration (what to do repeatedly)
- Condition configuration (when to stop)
- Execution limits (maximum repetitions)
Default values:
- maxActions: 3 (prevents infinite loops while allowing reasonable retries)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates a configured DoUntilActionObject instance.setActionObjectCollection
(ObjectCollection objectCollection) Sets the objects to be acted upon by the primary action.setConditionObjectCollection
(ObjectCollection objectCollection) Sets the objects to monitor for the termination condition.setDoAction
(ActionConfig actionConfig) Configures the primary action to be performed repeatedly.setMaxActions
(int maxActions) Sets the maximum number of times the primary action can be performed.setUntilAction
(ActionConfig actionConfig) Configures the condition check that determines when to stop.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setActionObjectCollection
Sets the objects to be acted upon by the primary action.These are the targets for the repeated action (e.g., buttons to click, fields to type in). The action will be performed on these objects until the termination condition is met.
- Parameters:
objectCollection
- The collection of objects for the primary action- Returns:
- This builder instance for method chaining
-
setConditionObjectCollection
Sets the objects to monitor for the termination condition.These objects are checked by the until action to determine when to stop the primary action. They may be different from the action objects (e.g., click button A until message B appears).
- Parameters:
objectCollection
- The collection of objects for condition checking- Returns:
- This builder instance for method chaining
-
setDoAction
Configures the primary action to be performed repeatedly.This ActionConfig defines what action is executed in the loop (e.g., CLICK, TYPE, DRAG). It includes all timing, search, and behavior settings for the repeated action.
- Parameters:
actionConfig
- The configuration for the primary action- Returns:
- This builder instance for method chaining
-
setUntilAction
Configures the condition check that determines when to stop.This ActionConfig defines how to check the termination condition (e.g., FIND to wait for appearance, VANISH to wait for disappearance). The success criteria in these options determine when the loop terminates.
- Parameters:
actionConfig
- The configuration for condition checking- Returns:
- This builder instance for method chaining
-
setMaxActions
Sets the maximum number of times the primary action can be performed.This safety limit prevents infinite loops if the termination condition is never met. Once this limit is reached, the operation stops regardless of the condition state. Default is 3 if not set.
- Parameters:
maxActions
- The maximum number of action repetitions allowed- Returns:
- This builder instance for method chaining
-
build
Creates a configured DoUntilActionObject instance.This method constructs the final object with all configured values. No validation is performed - callers should ensure all necessary components are set before building. Result tracking fields are initialized to their default states.
- Returns:
- A new DoUntilActionObject with the configured settings
-