Class SpecGenConfBuilder

java.lang.Object
jsonvalues.spec.SpecGenConfBuilder

public final class SpecGenConfBuilder extends Object
The `SpecGenConfBuilder` class is responsible for configuring the generation parameters used by `SpecToGen`. It allows customization of the characteristics of the generated data, such as the size of arrays, maps, and numbers, as well as the length of strings, keys in maps, and other data types. Additionally, it provides options for specifying the probability of generating optional and nullable object fields.
See Also:
  • Constructor Details

    • SpecGenConfBuilder

      public SpecGenConfBuilder()
  • Method Details

    • withOptionalKeyProbability

      public SpecGenConfBuilder withOptionalKeyProbability(int probability)
      Sets the probability of generating optional object fields. A number `n` between [2,10], being the ratio of the probability of generating an object with optional fields `n/1`. It can be useful to avoid stackoverflow errors when generating recursive objects, in which case we may need to specify a greater probability of optional fields.
      Parameters:
      probability - The probability value to set.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withNullableKeyProbability

      public SpecGenConfBuilder withNullableKeyProbability(int probability)
      Sets the probability of generating nullable objects. A number `n` between [2,10], being the ratio of the probability of generating an object with null fields `n/1`.It can be useful to avoid stackoverflow errors when * generating recursive objects, in which case we may need to specify a greater probability of optional fields.
      Parameters:
      probability - The probability value to set.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withArraySize

      public SpecGenConfBuilder withArraySize(int minimumSize, int maximumSize)
      Sets the size range for generated arrays.
      Parameters:
      minimumSize - The minimum size for arrays.
      maximumSize - The maximum size for arrays.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withObjSize

      public SpecGenConfBuilder withObjSize(int minimumSize, int maximumSize)
      Sets the size range for generated json objects.
      Parameters:
      minimumSize - The minimum size for maps.
      maximumSize - The maximum size for maps.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withKeyLength

      public SpecGenConfBuilder withKeyLength(int minimumLength, int maximumLength)
      Sets the length range for keys in generated json objects.
      Parameters:
      minimumLength - The minimum length for keys.
      maximumLength - The maximum length for keys.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withStringLength

      public SpecGenConfBuilder withStringLength(int minimumLength, int maximumLength)
      Sets the length range for generated strings.
      Parameters:
      minimumLength - The minimum length for strings.
      maximumLength - The maximum length for strings.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withIntSize

      public SpecGenConfBuilder withIntSize(int minimumSize, int maximumSize)
      Sets the size range for generated integers.
      Parameters:
      minimumSize - The minimum size for integers.
      maximumSize - The maximum size for integers.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withLongSize

      public SpecGenConfBuilder withLongSize(long minimumSize, long maximumSize)
      Sets the size range for generated long integers.
      Parameters:
      minimumSize - The minimum size for long integers.
      maximumSize - The maximum size for long integers.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withDoubleSize

      public SpecGenConfBuilder withDoubleSize(double minimumSize, double maximumSize)
      Sets the size range for generated double values.
      Parameters:
      minimumSize - The minimum size for double values.
      maximumSize - The maximum size for double values.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withBigDecSize

      public SpecGenConfBuilder withBigDecSize(BigDecimal minimumSize, BigDecimal maximumSize)
      Sets the size range for generated BigDecimal values.
      Parameters:
      minimumSize - The minimum size for BigDecimal values.
      maximumSize - The maximum size for BigDecimal values.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withBigIntSize

      public SpecGenConfBuilder withBigIntSize(BigInteger minimumSize, BigInteger maximumSize)
      Sets the size range for generated BigInteger values.
      Parameters:
      minimumSize - The minimum size for BigInteger values.
      maximumSize - The maximum size for BigInteger values.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withBinaryLength

      public SpecGenConfBuilder withBinaryLength(int minimumLength, int maximumLength)
      Sets the length range for generated binary data.
      Parameters:
      minimumLength - The minimum length for binary data.
      maximumLength - The maximum length for binary data.
      Returns:
      The updated instance of SpecGenConfBuilder.
    • withInstantRange

      public SpecGenConfBuilder withInstantRange(Instant minimumDate, Instant maximumDate)
      Sets the range for generated Instant values.
      Parameters:
      minimumDate - The minimum Instant value.
      maximumDate - The maximum Instant value.
      Returns:
      The updated instance of SpecGenConfBuilder.