Enum FillType

java.lang.Object
java.lang.Enum<FillType>
org.instancio.settings.FillType
All Implemented Interfaces:
Serializable, Comparable<FillType>, java.lang.constant.Constable

@ExperimentalApi public enum FillType extends Enum<FillType>
Defines fill types for populating fields in existing objects when using InstancioObjectApi.fill(). Each fill type specifies which fields should be considered for population based on their current values.

Fill types follow a hierarchical structure where each subsequent type builds upon the behavior of the previous types, adding additional capabilities.

Since:
5.3.0
See Also:
  • Enum Constant Details

    • APPLY_SELECTORS

      public static final FillType APPLY_SELECTORS
      Populates an object based solely on specified selectors. Only the fields explicitly targeted by selectors are modified, while all other fields remain unchanged.
      Since:
      5.3.0
    • POPULATE_NULLS

      public static final FillType POPULATE_NULLS
      Populates all null fields with random values and applies the specified selectors. This includes the behaviour of APPLY_SELECTORS and adds population of null fields.

      Non-null fields remain unchanged unless explicitly targeted by selectors.

      Since:
      5.3.0
    • POPULATE_NULLS_AND_DEFAULT_PRIMITIVES

      public static final FillType POPULATE_NULLS_AND_DEFAULT_PRIMITIVES
      Populates both null fields and primitive fields containing default values. This extends the behavior of POPULATE_NULLS by also addressing default primitive values.

      A primitive field is considered to have a default value if it contains:

      • 0 for numeric types (byte, short, int, long, float, double)
      • false for boolean
      • '' (null character) for char

      For example:

      • A boolean field with the value false may be randomized.
      • A boolean field with the value true will remain unchanged.
      • An int field with the value 0 may be randomized.
      • An int field with any non-zero value will remain unchanged.
      Since:
      5.3.0
  • Method Details

    • values

      public static FillType[] 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

      public static FillType valueOf(String name)
      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 name
      NullPointerException - if the argument is null