Class ShortGenerator.Builder

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

public static class ShortGenerator.Builder extends AbstractBuilder<Short>
Fluent builder for ShortGenerator.
  • Constructor Details

    • Builder

      public Builder(RandomGenerator random)
      Creates a builder backed by the given seeded random source.
      Parameters:
      random - the random source used to draw generated values
  • Method Details

    • start

      public ShortGenerator.Builder start(int start)
      Sets the inclusive lower bound of the generated range. Defaults to 0.
      Parameters:
      start - the smallest value that may be generated (inclusive)
      Returns:
      this builder, for chaining
      Throws:
      IllegalArgumentException - if start is less than Short.MIN_VALUE
    • end

      public ShortGenerator.Builder end(int end)
      Sets the exclusive upper bound of the generated range. Defaults to Short.MAX_VALUE; generated values are always strictly less than this bound.
      Parameters:
      end - the upper bound that may never be generated (exclusive)
      Returns:
      this builder, for chaining
      Throws:
      IllegalArgumentException - if end is greater than Short.MAX_VALUE
    • build

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