Package org.instancio.generator
Class Hints.Builder
java.lang.Object
org.instancio.generator.Hints.Builder
- Enclosing class:
Hints
Builder for constructing
Hints
.-
Method Summary
Modifier and TypeMethodDescriptionafterGenerate
(AfterGenerate afterGenerate) A hint indicating what should be done with the object created by the generator.build()
Builds the object.<T extends Hint<T>>
Hints.Builderwith
(T hint) Adds specified hint object.
-
Method Details
-
with
Adds specified hint object.The hint's type acts as the key, therefore each hint type can be added only once. Adding another hint with same type will replace the previous hint.
- Type Parameters:
T
- hint type- Parameters:
hint
- to add- Returns:
- builder instance
- Since:
- 2.0.0
- See Also:
-
afterGenerate
A hint indicating what should be done with the object created by the generator. If not specified, the default action isAfterGenerate.APPLY_SELECTORS
, which implies the engine will not modify the created instance.For most common use cases, custom generators will use one of the following:
AfterGenerate.APPLY_SELECTORS
AfterGenerate.POPULATE_NULLS
AfterGenerate.POPULATE_NULLS_AND_DEFAULT_PRIMITIVES
Note: the populate action hint is not applicable to generators that produce
java.lang.Record
objects. Since records are immutable, they cannot be modified after instantiation.- Parameters:
afterGenerate
- action to be taken by the engine after object has been created by the generator- Returns:
- builder instance
- Since:
- 2.0.0
- See Also:
-
build
Builds the object.- Returns:
- the built instance.
-