Enum Class ConfigValueSource

java.lang.Object
java.lang.Enum<ConfigValueSource>
io.github.theword.queqiao.core.config.ConfigValueSource
All Implemented Interfaces:
Serializable, Comparable<ConfigValueSource>, Constable

public enum ConfigValueSource extends Enum<ConfigValueSource>
配置值来源

用于严格区分"用户配置了"与"值恰好等于默认值":

 用户文件里没有 port           → get=默认值, contains=false, isDefault=true
 用户文件里写了 port: 25565    → get=25565,  contains=true,  isDefault=false(即使它等于默认值)
 

未来可扩展 PROGRAMMATIC / ENVIRONMENT / COMMAND 等来源; 本阶段只实现 DEFAULT 与 USER。

Since:
0.6.12
  • Enum Constant Details

    • DEFAULT

      public static final ConfigValueSource DEFAULT
      值来自 ConfigKey 声明的默认值(用户文件中不存在该字段)
    • USER

      public static final ConfigValueSource USER
      值来自用户配置(或运行时显式 set)
  • Method Details

    • values

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