Class LocalDateTimeGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<T>
org.instancio.internal.generator.time.LocalDateTimeGenerator
- All Implemented Interfaces:
AsStringGeneratorSpec<LocalDateTime>,Generator<LocalDateTime>,GeneratorSpec<LocalDateTime>,AsGeneratorSpec<LocalDateTime>,LocalDateTimeSpec,NullableGeneratorSpec<LocalDateTime>,TemporalAaStringGeneratorSpec<LocalDateTime>,TemporalGeneratorSpec<LocalDateTime>,TemporalSpec<LocalDateTime>,ValueSpec<LocalDateTime>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.future()Generate a value in the future.nullable()Indicates thatnullvalue can be generated.past()Generate a value in the past.range(LocalDateTime start, LocalDateTime end) Generate a value within the given range.protected LocalDateTimetryGenerateNonNull(Random random) Makes the best effort to return a non-null value.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
generate, getContext, hints, isNullable, nullableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.instancio.generator.specs.AsGeneratorSpec
as, asStringMethods inherited from interface org.instancio.generator.AsStringGeneratorSpec
asString
-
Field Details
-
min
-
max
-
-
Constructor Details
-
LocalDateTimeGenerator
public LocalDateTimeGenerator() -
LocalDateTimeGenerator
-
-
Method Details
-
apiMethod
Description copied from class:AbstractGeneratorReturns the public API method name of the generator spec. The returned name is used for reporting validation errors.- Specified by:
apiMethodin classAbstractGenerator<LocalDateTime>- Returns:
- spec name if defined, or
nullotherwise
-
past
Description copied from interface:TemporalGeneratorSpecGenerate a value in the past.- Specified by:
pastin interfaceLocalDateTimeSpec- Specified by:
pastin interfaceTemporalAaStringGeneratorSpec<LocalDateTime>- Specified by:
pastin interfaceTemporalGeneratorSpec<LocalDateTime>- Specified by:
pastin interfaceTemporalSpec<LocalDateTime>- Returns:
- spec builder
-
future
Description copied from interface:TemporalGeneratorSpecGenerate a value in the future.- Specified by:
futurein interfaceLocalDateTimeSpec- Specified by:
futurein interfaceTemporalAaStringGeneratorSpec<LocalDateTime>- Specified by:
futurein interfaceTemporalGeneratorSpec<LocalDateTime>- Specified by:
futurein interfaceTemporalSpec<LocalDateTime>- Returns:
- spec builder
-
range
Description copied from interface:TemporalGeneratorSpecGenerate a value within the given range.- Specified by:
rangein interfaceLocalDateTimeSpec- Specified by:
rangein interfaceTemporalAaStringGeneratorSpec<LocalDateTime>- Specified by:
rangein interfaceTemporalGeneratorSpec<LocalDateTime>- Specified by:
rangein interfaceTemporalSpec<LocalDateTime>- Parameters:
start- lower bound (inclusive)end- upper bound (inclusive)- Returns:
- spec builder
-
nullable
Description copied from interface:NullableGeneratorSpecIndicates thatnullvalue can be generated.- Specified by:
nullablein interfaceLocalDateTimeSpec- Specified by:
nullablein interfaceNullableGeneratorSpec<LocalDateTime>- Specified by:
nullablein interfaceTemporalGeneratorSpec<LocalDateTime>- Specified by:
nullablein interfaceTemporalSpec<LocalDateTime>- Specified by:
nullablein interfaceValueSpec<LocalDateTime>- Overrides:
nullablein classAbstractGenerator<LocalDateTime>- Returns:
- spec builder
-
tryGenerateNonNull
Description copied from class:AbstractGeneratorMakes the best effort to return a non-null value. However, in certain cases this method will produce anull.- Specified by:
tryGenerateNonNullin classAbstractGenerator<LocalDateTime>- Parameters:
random- for generating the value- Returns:
- generated value, either a null or non-null
-