Package jsonvalues.spec
Class SpecGenConfBuilder
java.lang.Object
jsonvalues.spec.SpecGenConfBuilder
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionwithArraySize
(int minimumSize, int maximumSize) Sets the size range for generated arrays.withBigDecSize
(BigDecimal minimumSize, BigDecimal maximumSize) Sets the size range for generated BigDecimal values.withBigIntSize
(BigInteger minimumSize, BigInteger maximumSize) Sets the size range for generated BigInteger values.withBinaryLength
(int minimumLength, int maximumLength) Sets the length range for generated binary data.withDoubleSize
(double minimumSize, double maximumSize) Sets the size range for generated double values.withInstantRange
(Instant minimumDate, Instant maximumDate) Sets the range for generated Instant values.withIntSize
(int minimumSize, int maximumSize) Sets the size range for generated integers.withKeyLength
(int minimumLength, int maximumLength) Sets the length range for keys in generated json objects.withLongSize
(long minimumSize, long maximumSize) Sets the size range for generated long integers.withNullableKeyProbability
(int probability) Sets the probability of generating nullable objects.withObjSize
(int minimumSize, int maximumSize) Sets the size range for generated json objects.withOptionalKeyProbability
(int probability) Sets the probability of generating optional object fields.withStringLength
(int minimumLength, int maximumLength) Sets the length range for generated strings.
-
Constructor Details
-
SpecGenConfBuilder
public SpecGenConfBuilder()
-
-
Method Details
-
withOptionalKeyProbability
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
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
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
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
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
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
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
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
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
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
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
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
Sets the range for generated Instant values.- Parameters:
minimumDate
- The minimum Instant value.maximumDate
- The maximum Instant value.- Returns:
- The updated instance of SpecGenConfBuilder.
-