Package com.tnsai.coordination.workflow
Record Class LoopCondition
java.lang.Object
java.lang.Record
com.tnsai.coordination.workflow.LoopCondition
public record LoopCondition(int maxIterations, Predicate<WorkflowContext> continueWhile)
extends Record
Defines loop termination conditions for workflow loops.
- Since:
- 0.0.5
-
Constructor Summary
ConstructorsConstructorDescriptionLoopCondition(int maxIterations, Predicate<WorkflowContext> continueWhile) Creates an instance of aLoopConditionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecontinueWhilerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxIterationsrecord component.static LoopConditionmaxIterations(int max) Creates a loop that runs up to maxIterations times.booleanshouldContinue(int currentIteration, WorkflowContext context) Checks if the loop should continue.final StringtoString()Returns a string representation of this record class.static LoopConditionwhileTrue(int maxIterations, Predicate<WorkflowContext> condition) Creates a loop that continues while the predicate is true, up to a max.
-
Constructor Details
-
LoopCondition
Creates an instance of aLoopConditionrecord class.- Parameters:
maxIterations- the value for themaxIterationsrecord componentcontinueWhile- the value for thecontinueWhilerecord component
-
-
Method Details
-
maxIterations
Creates a loop that runs up to maxIterations times. -
whileTrue
Creates a loop that continues while the predicate is true, up to a max. -
shouldContinue
Checks if the loop should continue. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
maxIterations
public int maxIterations()Returns the value of themaxIterationsrecord component.- Returns:
- the value of the
maxIterationsrecord component
-
continueWhile
Returns the value of thecontinueWhilerecord component.- Returns:
- the value of the
continueWhilerecord component
-