Class BitStringGenerator

All Implemented Interfaces:
DataGenerator<String>

public class BitStringGenerator extends AbstractDataGenerator<String>
Generates a string of '0' and '1' characters for SQL BIT / VARBIT columns, e.g. 10110.

The number of bits is the configured size clamped to [1, 25]: BIT/VARBIT columns must hold at least one bit, and an unbounded VARBIT reports a max size of 0 which would otherwise yield an empty (invalid) value. Size defaults to 1. Output is seeded and therefore reproducible for a given random source.

  • Method Details

    • generate

      public String generate()
      Description copied from interface: DataGenerator
      Generates a random value of type T.
      Returns:
      a generated value, may be null if the generator supports nullable columns
    • get

      public String get(ResultSet resultSet, int columnIndex) throws SQLException
      Description copied from interface: DataGenerator
      Retrieves a value from a ResultSet column.
      Parameters:
      resultSet - the result set to read from
      columnIndex - the 1-based column index
      Returns:
      the value from the result set, properly cast to type T
      Throws:
      SQLException - if the database operation fails