public class ConfigService extends Object implements GetConfig, IComponent
| 限定符和类型 | 字段和说明 |
|---|---|
static Map<String,Object> |
CONFIG
所有的配置保存在这个 config 中
|
static Map<String,Object> |
FLAT_CONFIG
所有的配置保存在这个 config 中(扁平化处理过的)
|
static boolean |
isLoaded
是否加载成功
|
static String |
jsonPath
json 文件路径
|
static String |
jsonStr
json 字符串内容
|
| 构造器和说明 |
|---|
ConfigService() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
get(String key)
简化版本
|
static boolean |
getBol(String key)
简化版本
|
static int |
getInt(String key)
简化版本
|
static String |
getSchemeJson()
获取配置 JSON 说明文件。
|
String |
getString(String key)
读取配置并转换其为字符串类型。
|
static boolean |
getValueAsBool(String key)
读取配置并转换其为 布尔 类型。
|
static int |
getValueAsInt(String key)
读取配置并转换其为 int 类型。
|
static long |
getValueAsLong(String key)
读取配置并转换其为 long 类型。
|
static String |
getValueAsString(String key)
读取配置并转换其为字符串类型。
|
static void |
load(String jsonPath)
加载 JSON 配置
|
static void |
loadJSON_in_JS(Map<String,Object> map)
load the json config file to the JS Runtime, and let the new values put into
it, finally save this new json file
|
static void |
save()
保存 JSON 配置
|
static String |
transform(String namespace)
扁平化 JSON 的 key
|
public static String jsonPath
public static String jsonStr
public static boolean isLoaded
public static void load(String jsonPath)
jsonPath - JSON 配置文件所在路径public static void save()
public static boolean getValueAsBool(String key)
key - 配置键值public static int getValueAsInt(String key)
key - 配置键值public static long getValueAsLong(String key)
key - 配置键值public static String getValueAsString(String key)
key - 配置键值public String getString(String key)
public static int getInt(String key)
key - 配置键值public static boolean getBol(String key)
key - 配置键值public static String transform(String namespace)
namespace - JSON 命名空间public static String getSchemeJson()
Copyright © 2013–2021 AJAXJS. All rights reserved.