Class EnumSetGenerator<E extends Enum<E>>
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<EnumSet<E>>
org.instancio.internal.generator.util.EnumSetGenerator<E>
- All Implemented Interfaces:
Generator<EnumSet<E>>,GeneratorSpec<EnumSet<E>>,EnumSetGeneratorSpec<E>,NullableGeneratorSpec<EnumSet<E>>
public class EnumSetGenerator<E extends Enum<E>>
extends AbstractGenerator<EnumSet<E>>
implements EnumSetGeneratorSpec<E>
-
Constructor Summary
ConstructorsConstructorDescriptionEnumSetGenerator(GeneratorContext context) EnumSetGenerator(GeneratorContext context, Class<E> enumClass) -
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.final EnumSetGeneratorSpec<E>Specifies enum values to exclude from the generatedEnumSet.hints()Hints provided by the generator to the engine.maxSize(int size) Maximum size ofEnumSetto generate.minSize(int size) Minimum size ofEnumSetto generate.final EnumSetGeneratorSpec<E>Specifies choices from which theEnumSetwill be generated.size(int size) Size ofEnumSetto generate.tryGenerateNonNull(Random random) Makes the best effort to return a non-null value.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
generate, getContext, isNullable, nullable, nullable
-
Constructor Details
-
EnumSetGenerator
-
EnumSetGenerator
-
-
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. -
size
Description copied from interface:EnumSetGeneratorSpecSize ofEnumSetto generate.- Specified by:
sizein interfaceEnumSetGeneratorSpec<E extends Enum<E>>- Parameters:
size- ofEnumSet- Returns:
- spec builder
-
minSize
Description copied from interface:EnumSetGeneratorSpecMinimum size ofEnumSetto generate.- Specified by:
minSizein interfaceEnumSetGeneratorSpec<E extends Enum<E>>- Parameters:
size- minimum size (inclusive)- Returns:
- spec builder
-
maxSize
Description copied from interface:EnumSetGeneratorSpecMaximum size ofEnumSetto generate.- Specified by:
maxSizein interfaceEnumSetGeneratorSpec<E extends Enum<E>>- Parameters:
size- maximum size (inclusive)- Returns:
- spec builder
-
of
Description copied from interface:EnumSetGeneratorSpecSpecifies choices from which theEnumSetwill be generated.- Specified by:
ofin interfaceEnumSetGeneratorSpec<E extends Enum<E>>- Parameters:
elements- from which the enum set will be generated- Returns:
- spec builder
-
excluding
Description copied from interface:EnumSetGeneratorSpecSpecifies enum values to exclude from the generatedEnumSet.- Specified by:
excludingin interfaceEnumSetGeneratorSpec<E extends Enum<E>>- Parameters:
elements- to excluding from the generated enum set- 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<EnumSet<E extends Enum<E>>>- Parameters:
random- for generating the value- Returns:
- generated value, either a null or non-null
-
hints
Description copied from interface:GeneratorHints provided by the generator to the engine.The most important hint for custom generators is
AfterGenerate. This hint indicates whether the object created by this generator:- should be populated (for example, if it has
nullfields) - can be modified using selectors
For example, setting the hint to
AfterGenerate.POPULATE_NULLSwill cause Instancio to populatenullfields on the object returned by this generator:@Override public Hints hints() { return Hints.afterGenerate(AfterGenerate.POPULATE_NULLS); }If the action is not specified, default behaviour will be based on the
AfterGeneratevalue configured in theSettingsusing the keyKeys.AFTER_GENERATE_HINT.In addition, the following hints can be provided for populating data structures:
- should be populated (for example, if it has
-