Class YearGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<T>
org.instancio.internal.generator.time.YearGenerator
- All Implemented Interfaces:
AsStringGeneratorSpec<Year>,Generator<Year>,GeneratorSpec<Year>,AsGeneratorSpec<Year>,NullableGeneratorSpec<Year>,TemporalAaStringGeneratorSpec<Year>,TemporalGeneratorSpec<Year>,TemporalSpec<Year>,YearSpec,ValueSpec<Year>
-
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.Generate a value within the given range.protected YeartryGenerateNonNull(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
-
YearGenerator
public YearGenerator() -
YearGenerator
-
-
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<Year>- Returns:
- spec name if defined, or
nullotherwise
-
past
Description copied from interface:TemporalGeneratorSpecGenerate a value in the past.- Specified by:
pastin interfaceTemporalAaStringGeneratorSpec<Year>- Specified by:
pastin interfaceTemporalGeneratorSpec<Year>- Specified by:
pastin interfaceTemporalSpec<Year>- Specified by:
pastin interfaceYearSpec- Returns:
- spec builder
-
future
Description copied from interface:TemporalGeneratorSpecGenerate a value in the future.- Specified by:
futurein interfaceTemporalAaStringGeneratorSpec<Year>- Specified by:
futurein interfaceTemporalGeneratorSpec<Year>- Specified by:
futurein interfaceTemporalSpec<Year>- Specified by:
futurein interfaceYearSpec- Returns:
- spec builder
-
range
Description copied from interface:TemporalGeneratorSpecGenerate a value within the given range.- Specified by:
rangein interfaceTemporalAaStringGeneratorSpec<Year>- Specified by:
rangein interfaceTemporalGeneratorSpec<Year>- Specified by:
rangein interfaceTemporalSpec<Year>- Specified by:
rangein interfaceYearSpec- 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 interfaceNullableGeneratorSpec<Year>- Specified by:
nullablein interfaceTemporalGeneratorSpec<Year>- Specified by:
nullablein interfaceTemporalSpec<Year>- Specified by:
nullablein interfaceValueSpec<Year>- Specified by:
nullablein interfaceYearSpec- Overrides:
nullablein classAbstractGenerator<Year>- 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<Year>- Parameters:
random- for generating the value- Returns:
- generated value, either a null or non-null
-