Class BooleanGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<Boolean>
org.instancio.internal.generator.lang.BooleanGenerator
- All Implemented Interfaces:
AsStringGeneratorSpec<Boolean>,Generator<Boolean>,GeneratorSpec<Boolean>,AsGeneratorSpec<Boolean>,BooleanAsGeneratorSpec,BooleanGeneratorSpec,BooleanSpec,NullableGeneratorSpec<Boolean>,ValueSpec<Boolean>
public class BooleanGenerator
extends AbstractGenerator<Boolean>
implements BooleanSpec, BooleanAsGeneratorSpec
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.nullable()Indicates thatnullvalue can be generated.probability(double probability) Specifies the probability of generatingtrue.protected BooleantryGenerateNonNull(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
-
Constructor Details
-
BooleanGenerator
public BooleanGenerator() -
BooleanGenerator
-
-
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<Boolean>- Returns:
- spec name if defined, or
nullotherwise
-
probability
Description copied from interface:BooleanSpecSpecifies the probability of generatingtrue.- Specified by:
probabilityin interfaceBooleanAsGeneratorSpec- Specified by:
probabilityin interfaceBooleanGeneratorSpec- Specified by:
probabilityin interfaceBooleanSpec- Parameters:
probability- of generatingtruebetween 0 and 1 inclusive- Returns:
- spec builder
-
nullable
Description copied from interface:NullableGeneratorSpecIndicates thatnullvalue can be generated.- Specified by:
nullablein interfaceBooleanAsGeneratorSpec- Specified by:
nullablein interfaceBooleanGeneratorSpec- Specified by:
nullablein interfaceBooleanSpec- Specified by:
nullablein interfaceNullableGeneratorSpec<Boolean>- Specified by:
nullablein interfaceValueSpec<Boolean>- Overrides:
nullablein classAbstractGenerator<Boolean>- 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<Boolean>- Parameters:
random- for generating the value- Returns:
- generated value, either a null or non-null
-