All Downloads are FREE. Search and download functionalities are using the official Maven repository.

wee0.config.IConfig Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2016-2022, wee0.com.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 **/
package wee0.config;

import java.util.Set;

/**
 * 键值配置对象规范接口。
 * @author		baihw
 * @date 		2018年3月9日
 **/

/**
 * 
 *  examples:
 * 
**/ public interface IConfig{ /** * 配置关键字:热加载。 */ String KEY_HOTRELOAD = "hotReload"; /** * 配置关键字:应用唯一标识。 */ String KEY_APPID = "appId"; /** * 配置关键字:环境变量。 */ String KEY_ENV = "env"; /** * 配置关键字:日志。 */ String KEY_LOG = "log"; /** * 配置关键字:网络代理。 */ String KEY_NET_PROXY = "netProxy"; /** * 配置关键字:缓存。 */ String KEY_CACHE = "cache"; /** * 配置关键字:服务。 */ String KEY_SERVER = "server"; // /** // * 配置关键字:内部服务。 // */ // String KEY_SERVER = "service"; /** * 配置关键字:指令库 */ String KEY_COMMANDS = "commands"; /** * 配置关键字:程序 */ String KEY_PROGRAM = "program"; /** * 配置关键字:用户域数据。 */ String KEY_USER_CONFIG = "userConfig"; /** * 集合是否为空。 * * @return true / false */ boolean isEmpty(); /** * 获取长度。 * * @return 长度 */ int length(); /** * 获取所有鍵名集合。 * * @return 所有鍵名集合 */ Set keys(); /** * 检查集合中是否包含指定键名 * * @param key 键名 * @return true / false */ boolean hasKey( String key ); /** * 获取指定键名对应的数据(原始数据类型) * * @param key 键名 * @return 值数据 / null */ Object get( String key ); /** * 获取指定键名对应的数据(字符串类型) * * @param key 键名 * @param defVal 数据不存在时的默认值 * @return 值数据 / 默认空字符串数据 */ String getString( String key, String defVal ); /** * 获取指定键名对应的数据(字符串类型) * * @param key 键名 * @return 值数据 / 默认空字符串数据 */ String getString( String key ); /** * 获取指定键名对应的数据(数值类型) * * @param key 键名 * @param defVal 数据不存在时的默认值 * @return 值数据 / 默认数据 */ Number getNumber( String key, Number defVal ); /** * 获取指定键名对应的数据(布尔类型) * * @param key 键名 * @param defVal 数据不存在时的默认值 * @return 值数据 / 默认数据 */ Boolean getBoolean( String key, Boolean defVal ); /** * 获取指定键名对应的子级键值配置对象;不存在时,返回指定的默认对象。 * * @param key 键名 * @param defVal 对象不存在时,返回的默认对象。 * @return 子级键值配置对象 */ IConfig getConfig( String key, IConfig defVal ); /** * 获取指定键名对应的子级列表配置对象;不存在时,返回指定的默认对象。 * * @param key 键名 * @param defVal 对象不存在时,返回的默认对象。 * @return 子级列表配置对象 */ IConfigList getConfigList( String key, IConfigList defVal ); } // end interface




© 2015 - 2025 Weber Informatics LLC | Privacy Policy