java.lang.Object
io.github.projectunified.cronutils.model.field.expression.FieldExpression
io.github.projectunified.cronutils.model.field.expression.RandomExpression
All Implemented Interfaces:
Serializable

public class RandomExpression extends FieldExpression
Represents a random value expression in a cron field, using the '~' character. This is specific to OpenBSD cron expressions.
See Also:
  • Constructor Details

  • Method Details

    • getRandomValue

      public IntegerFieldValue getRandomValue(int min, int max)
      Get random value within the range considering step if specified
      Parameters:
      min - minimum value allowed for the field
      max - maximum value allowed for the field
      Returns:
      random value as IntegerFieldValue
    • getFrom

      public Integer getFrom()
    • getTo

      public Integer getTo()
    • getStep

      public Integer getStep()
    • accept

      public FieldExpression accept(FieldExpressionVisitor visitor)
      Description copied from class: FieldExpression
      Accept 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:
      accept in class FieldExpression
      Parameters:
      visitor - - FieldExpressionVisitor instance, never null
      Returns:
      FieldExpression copied instance with visitor action performed.
    • asString

      public String asString()
      Description copied from class: FieldExpression
      Represents FieldExpression as string.
      Specified by:
      asString in class FieldExpression
      Returns:
      String representation, never null.
    • toString

      public String toString()
      Overrides:
      toString in class Object