Enum Class MergeStrategy

java.lang.Object
java.lang.Enum<MergeStrategy>
io.github.arthurhoch.kissconfig.MergeStrategy
All Implemented Interfaces:
Serializable, Comparable<MergeStrategy>, Constable

public enum MergeStrategy extends Enum<MergeStrategy>
Defines how values from later sources interact with values already loaded from earlier sources.

SearchOrder is read order. With FILL_MISSING_ONLY, the first source wins. With OVERRIDE_EXISTING, the last source wins. With FAIL_ON_DUPLICATE, duplicate canonical keys fail. See docs/merge-strategy.md for examples.

  • Enum Constant Details

    • FILL_MISSING_ONLY

      public static final MergeStrategy FILL_MISSING_ONLY
      Keep the first value for a canonical key. Later sources only add missing keys.
    • OVERRIDE_EXISTING

      public static final MergeStrategy OVERRIDE_EXISTING
      Replace an existing value when a later source contains the same canonical key.
    • FAIL_ON_DUPLICATE

      public static final MergeStrategy FAIL_ON_DUPLICATE
      Fail when a canonical key appears more than once.
  • Method Details

    • values

      public static MergeStrategy[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MergeStrategy valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null