Package dev.orne.test.rnd
Class Generators.MissingGenerator
java.lang.Object
dev.orne.test.rnd.Generators.MissingGenerator
- All Implemented Interfaces:
Generator
- Enclosing class:
- Generators
@API(status=INTERNAL,
since="0.1")
public static final class Generators.MissingGenerator
extends Object
implements Generator
Cache value for missing generators for a value type.
- Since:
- Generators 1.0
- Version:
- 1.0, 2022-10
- Author:
- (w) Iker Hernaez
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The error message.static final Generators.MissingGenerator
The generator placeholder for missing generators. -
Method Summary
Modifier and TypeMethodDescription<T> T
defaultValue
(@NotNull Class<T> type) Returns the default value for the specified type.<T> T
nullableDefaultValue
(@NotNull Class<T> type) Returns the default value for the specified type allowingnull
values.<T> T
nullableRandomValue
(@NotNull Class<T> type) Returns a random value of the specified type allowingnull
values.<T> T
randomValue
(@NotNull Class<T> type) Returns a random value of the specified type.boolean
Checks if values of the specified type can be generated by this instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.orne.test.rnd.Generator
asParameterizable, getPriority
-
Field Details
-
ERR_MSG
The error message.- See Also:
-
INSTANCE
The generator placeholder for missing generators.
-
-
Method Details
-
supports
Checks if values of the specified type can be generated by this instance. -
defaultValue
Returns the default value for the specified type.- Specified by:
defaultValue
in interfaceGenerator
- Type Parameters:
T
- The requested value type.- Parameters:
type
- The requested value type.- Returns:
- The default value for the specified type.
-
nullableDefaultValue
Returns the default value for the specified type allowingnull
values.This method should return
null
except for native types.- Specified by:
nullableDefaultValue
in interfaceGenerator
- Type Parameters:
T
- The requested value type.- Parameters:
type
- The requested value type.- Returns:
- The nullable default value for the specified type.
-
randomValue
Returns a random value of the specified type.- Specified by:
randomValue
in interfaceGenerator
- Type Parameters:
T
- The requested value type.- Parameters:
type
- The requested value type.- Returns:
- A random value for the specified type.
-
nullableRandomValue
Returns a random value of the specified type allowingnull
values.The returned value has a probability of be
null
except for native types. If notnull
behaves asrandomValue()
.- Specified by:
nullableRandomValue
in interfaceGenerator
- Type Parameters:
T
- The requested value type.- Parameters:
type
- The requested value type.- Returns:
- A random nullable value for the specified type.
- See Also:
-