All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.robertboothby.djenni.lang.package.html Maven / Gradle / Ivy

Go to download

This module holds the core components of the Djenni data generator framework. By itself it provides most of the components to create an efficient end to end data generation framework for a specific domain. It contains the core SupplierBuilder interfaces, implementations for the core Java data types and useful test components. It is intended to be used in conjunction with the source-generator module that will speed up delivery of domain specific data generation and also with common domain modules (TBD) that deliver standard generators for common frameworks such as JAXB.

There is a newer version: 0.2.0
Show newest version



    com.robertboothby.djenni.lang


This package contains {@link com.robertboothby.djenni.SupplierBuilder} instances for the core java types in the java.lang package.

There are currently limitations in the implementation because of a logical flaw - Take Long for example. The full range between {@link java.lang.Long#MIN_VALUE} and {@link java.lang.Long#MAX_VALUE} cannot be represented by a single Long value this means that when one uses {@link java.util.concurrent.ThreadLocalRandom#nextLong(long)} one cannot get a single number that is distributed over the range of values. Thus in order to get a random Long value between the minimum and maximum one needs to perform at least 2 random number generations. The first to determine whether we are dealing with the positive values or the negative values (0 must not be forgotten...), the second to generate a long within the chosen partial range.

Probably the best approach is to have two instances of these types of generators that can be built one being the "fast" one that deals with ranges that can be randomised simply (in the case of long the range is less than Long.MAX_VALUE) and a "slow" one that deals with the greater ranges and does the appropriate calculation. These two types can then be automatically be selected between by the appropriate SupplierBuilder.

Of course a good question to ask is how often do we, when generating random data, need Longs and similar types generated to the full range.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy