Class VariableStringGenerator.Builder

java.lang.Object
io.bloviate.gen.AbstractBuilder<String>
io.bloviate.gen.VariableStringGenerator.Builder
All Implemented Interfaces:
Builder<String>
Enclosing class:
VariableStringGenerator

public static class VariableStringGenerator.Builder extends AbstractBuilder<String>
Builder for VariableStringGenerator instances.
  • Constructor Details

    • Builder

      public Builder(RandomGenerator random)
      Constructs a new builder.
      Parameters:
      random - the seeded random generator backing the produced generator
  • Method Details

    • minLength

      public VariableStringGenerator.Builder minLength(int minLength)
      Sets the inclusive lower bound of the random length range.
      Parameters:
      minLength - the minimum string length; effectively clamped up to 1 at generation time (lengths below 1 are treated as 1). Defaults to 1.
      Returns:
      this builder, for chaining
    • maxLength

      public VariableStringGenerator.Builder maxLength(int maxLength)
      Sets the inclusive upper bound of the random length range.
      Parameters:
      maxLength - the maximum string length, inclusive. Defaults to 10.
      Returns:
      this builder, for chaining
    • letters

      public VariableStringGenerator.Builder letters(boolean letters)
      Controls whether ASCII letters (A-Za-z) are included in the character set.
      Parameters:
      letters - true to include letters. Defaults to true.
      Returns:
      this builder, for chaining
    • numbers

      public VariableStringGenerator.Builder numbers(boolean numbers)
      Controls whether decimal digits (0-9) are included in the character set.
      Parameters:
      numbers - true to include digits. Defaults to false.
      Returns:
      this builder, for chaining
    • build

      public VariableStringGenerator build()
      Description copied from interface: Builder
      Builds and returns a configured data generator.
      Returns:
      a new DataGenerator configured with the builder's settings