Class ScxConfig

All Implemented Interfaces:
ScxConfigSource

public final class ScxConfig extends MultiConfigSource
配置文件类
Version:
0.0.1
Author:
scx567888
  • Constructor Details

    • ScxConfig

      public ScxConfig(ScxConfigSource... scxConfigSources)
      a
      Parameters:
      scxConfigSources - a
  • Method Details

    • get

      public Object get(String keyPath)
      从配置文件中获取配置值 没有找到会返回 null
      Parameters:
      keyPath - keyPath
      Returns:
      a T object.
    • get

      public <T> T get(String keyPath, ScxConfigValueHandler<T> handler)
      a
      Type Parameters:
      T - a
      Parameters:
      keyPath - a
      handler - a
      Returns:
      a
    • getOrDefault

      public <T> T getOrDefault(String keyPath, T defaultVal)
      从默认配置文件获取配置值 并自动判断类型 没有找到配置文件会返回 默认值
      Type Parameters:
      T - a T object.
      Parameters:
      keyPath - keyPath
      defaultVal - 默认值
      Returns:
      a T object.
    • get

      public <T> T get(String keyPath, Class<T> type)
      获取指定类型的配置文件 , 并尝试根据 cool.scx.type 进行转换
      Type Parameters:
      T - a
      Parameters:
      keyPath - a
      type - a
      Returns:
      a