Package de.cuioss.test.generator.impl
Class FloatObjectGenerator
java.lang.Object
de.cuioss.test.generator.impl.FloatObjectGenerator
- All Implemented Interfaces:
TypedGenerator<Float>
Generates
Float objects within a configurable range.
Features:
- Configurable range through constructor parameters
- Default range:
Float.MIN_VALUEtoFloat.MAX_VALUE - Thread-safe implementation
- Uses double precision for internal generation to ensure even distribution
Example usage:
// Generate floats using full range var generator = new FloatObjectGenerator(); Float value = generator.next(); // Generate floats within specific range var rangeGenerator = new FloatObjectGenerator(0.0f, 100.0f); Float bounded = rangeGenerator.next(); // Value between 0 and 100
- Author:
- Oliver Wolff
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
FloatObjectGenerator
public FloatObjectGenerator()
-
-
Method Details
-
next
Description copied from interface:TypedGeneratorGenerates the next instance based on the generator's configuration. Implementations must ensure thread-safety.- Specified by:
nextin interfaceTypedGenerator<Float>- Returns:
- A newly created instance. May be null if the generator explicitly supports null value generation.
-
getType
Description copied from interface:TypedGeneratorProvides type information about what kind of objects this generator creates. The default implementation uses the first non-null result fromTypedGenerator.next()to determine the type.Note: If your generator may return null values or the generated type differs from the actual instance type, you should override this method.
- Specified by:
getTypein interfaceTypedGenerator<Float>- Returns:
- The class information indicating which type this generator is responsible for.
-