Class Hints.Builder

java.lang.Object
org.instancio.generator.Hints.Builder
Enclosing class:
Hints

public static final class Hints.Builder extends Object
Builder for constructing Hints.
  • Method Details

    • with

      public <T extends Hint<T>> Hints.Builder with(T hint)
      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

      public Hints.Builder afterGenerate(AfterGenerate afterGenerate)
      A hint indicating what should be done with the object created by the generator. If not specified, the default action is AfterGenerate.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:

      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

      public Hints build()
      Builds the object.
      Returns:
      the built instance.