Class CharacterGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<Character>
org.instancio.internal.generator.lang.CharacterGenerator
- All Implemented Interfaces:
AsStringGeneratorSpec<Character>,Generator<Character>,GeneratorSpec<Character>,AsGeneratorSpec<Character>,CharacterAsGeneratorSpec,CharacterGeneratorSpec,CharacterSpec,NullableGeneratorSpec<Character>,ValueSpec<Character>
public class CharacterGenerator
extends AbstractGenerator<Character>
implements CharacterSpec, CharacterAsGeneratorSpec
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.nullable()Indicates thatnullvalue can be generated.range(char min, char max) Range of characters to generate.protected CharactertryGenerateNonNull(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
-
CharacterGenerator
-
CharacterGenerator
public CharacterGenerator()
-
-
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<Character>- Returns:
- spec name if defined, or
nullotherwise
-
range
Description copied from interface:CharacterGeneratorSpecRange of characters to generate.- Specified by:
rangein interfaceCharacterAsGeneratorSpec- Specified by:
rangein interfaceCharacterGeneratorSpec- Specified by:
rangein interfaceCharacterSpec- Parameters:
min- lower bound (inclusive)max- upper bound (inclusive)- Returns:
- spec builder
-
nullable
Description copied from interface:NullableGeneratorSpecIndicates thatnullvalue can be generated.- Specified by:
nullablein interfaceCharacterAsGeneratorSpec- Specified by:
nullablein interfaceCharacterGeneratorSpec- Specified by:
nullablein interfaceCharacterSpec- Specified by:
nullablein interfaceNullableGeneratorSpec<Character>- Specified by:
nullablein interfaceValueSpec<Character>- Overrides:
nullablein classAbstractGenerator<Character>- 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<Character>- Parameters:
random- for generating the value- Returns:
- generated value, either a null or non-null
-