Package org.instancio.generator
Enum AfterGenerate
- All Implemented Interfaces:
Serializable
,Comparable<AfterGenerate>
,java.lang.constant.Constable
An action hint that is passed from a generator to the engine
via the
Generator.hints()
method.
This hint indicates to the engine what action, if any, should be applied to the object(s) created by the generator.
- Since:
- 2.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionIndicates that an object created by the generator can be modified using any of the following methods:InstancioApi.set(TargetSelector, Object)
InstancioApi.supply(TargetSelector, Generator)
InstancioApi.generate(TargetSelector, Function)
Indicates that an object created by the generator should not be modified.A hint to populate all fields, regardless of their initial values.Indicates thatnull
fields declared by an object that was created by the generator should be populated by the engine.Indicates that primitive fields with default values declared by an object that was created by the generator should be populated by the engine. -
Method Summary
Modifier and TypeMethodDescriptionstatic AfterGenerate
Returns the enum constant of this type with the specified name.static AfterGenerate[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
DO_NOT_MODIFY
Indicates that an object created by the generator should not be modified. The engine will treat the object as read-only and assign it to the target field as is.The following methods with matching selectors will not be applied to the object:
InstancioApi.set(TargetSelector, Object)
InstancioApi.supply(TargetSelector, Generator)
InstancioApi.generate(TargetSelector, Function)
Note:
callbacks
provided via theonComplete()
method will still be executed.- Since:
- 2.0.0
-
APPLY_SELECTORS
Indicates that an object created by the generator can be modified using any of the following methods:- Since:
- 2.0.0
-
POPULATE_NULLS
Indicates thatnull
fields declared by an object that was created by the generator should be populated by the engine. In addition, the object can be also be modified as described byAPPLY_SELECTORS
.- Since:
- 2.0.0
-
POPULATE_NULLS_AND_DEFAULT_PRIMITIVES
Indicates that primitive fields with default values declared by an object that was created by the generator should be populated by the engine. In addition, the behaviour described byPOPULATE_NULLS
applies as well.Default values for primitive fields are defined as:
- Zero for all numeric types
false
forboolean
' '
null character forchar
For instance, if a
boolean
field was initialised totrue
, it will not be "populated". However, if it isfalse
, then it will be randomised to eithertrue
orfalse
.- Since:
- 2.0.0
-
POPULATE_ALL
A hint to populate all fields, regardless of their initial values. This action will cause all the values to be overwritten with random data.This is the default mode of internal generators.
- Since:
- 2.0.0
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-