Class RandomExpression
java.lang.Object
io.github.projectunified.cronutils.model.field.expression.FieldExpression
io.github.projectunified.cronutils.model.field.expression.RandomExpression
- All Implemented Interfaces:
Serializable
Represents a random value expression in a cron field, using the '~' character.
This is specific to OpenBSD cron expressions.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRandomExpression(RandomUtils randomUtils) RandomExpression(Integer from, Integer to, Integer step, RandomUtils randomUtils) -
Method Summary
Modifier and TypeMethodDescriptionaccept(FieldExpressionVisitor visitor) Accept a visitor to perform some action on the instance.asString()Represents FieldExpression as string.getFrom()getRandomValue(int min, int max) Get random value within the range considering step if specifiedgetStep()getTo()toString()Methods inherited from class io.github.projectunified.cronutils.model.field.expression.FieldExpression
always, and, questionMark
-
Constructor Details
-
RandomExpression
-
RandomExpression
-
-
Method Details
-
getRandomValue
Get random value within the range considering step if specified- Parameters:
min- minimum value allowed for the fieldmax- maximum value allowed for the field- Returns:
- random value as IntegerFieldValue
-
getFrom
-
getTo
-
getStep
-
accept
Description copied from class:FieldExpressionAccept a visitor to perform some action on the instance. Current instance is cloned, so that we ensure immutability. Clone of this instance is returned after visitor.visit(clone) was invoked.- Specified by:
acceptin classFieldExpression- Parameters:
visitor- - FieldExpressionVisitor instance, never null- Returns:
- FieldExpression copied instance with visitor action performed.
-
asString
Description copied from class:FieldExpressionRepresents FieldExpression as string.- Specified by:
asStringin classFieldExpression- Returns:
- String representation, never null.
-
toString
-