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

wee0.config.IEnv 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.io.PrintStream;
import java.util.function.BiConsumer;

/**
 * 环境变量操作对象规范接口
 * @author		baihw
 * @date 		2018年2月28日
 **/

/**
 * 
 *  examples:
 * 
**/ public interface IEnv{ /** * 关键字:wee0执行程序安装主目录。 */ public static final String KEY_HOME = "WEE0_HOME"; // /** // * 关键字:当前是否处于debug模式。 // */ // public static final String KEY_ISDEBUG = "wee0.isDebug"; /** * 关键字:wee0环境字符集编码。 */ public static final String KEY_ENCODING = "wee0.encoding"; /** * 关键字:wee0辅助工具管理类名称。 */ public static final String KEY_UTIL_MANAGER_IMPL_NAME = "wee0.utilManagerImpl"; /** * 关键字:wee0环境变量操作对象管理类名称。 */ public static final String KEY_ENV_IMPL = "wee0.envImpl"; /** * 关键字:wee0日志工厂类名称。 */ public static final String KEY_LOGGERFACOTRY_IMPL = "wee0.loggerFactoryImpl"; /** * 关键字:wee0包管理器实现类名称。 */ public static final String KEY_PACKAGEMANAGER_IMPL = "wee0.packageManagerImpl"; /** * 关键字:HTTP请求客户端实现类名称。 */ public static final String KEY_HTTPCLIENT_IMPL = "wee0.httpClientImpl"; /** * 关键字:wee0实现类名称。 */ public static final String KEY_WEE0_IMPL = "wee0.impl"; /** * 关键字:wee0引导目录。用户执行wee0命令路径。 */ public static final String KEY_BOOT_DIR = "wee0.bootDir"; /** * 关键字:wee0工作目录。不配置默认使用执行程序的目录。 */ public static final String KEY_WORK_DIR = "wee0.workDir"; /** * 关键字:wee0临时文件目录。不配置默认使用workDir下的tmp目录。 */ public static final String KEY_TMP_DIR = "wee0.tmpDir"; /** * 关键字:wee0系统文件目录。不配置默认使用workDir下的.wee0目录。 */ public static final String KEY_SYS_DIR = "wee0.sysDir"; /** * 获取指定名称的环境变量。 * * @param key 环境变量名称 * @param defVal 为空时的默认值 * @return 环境变量值 */ String get( String key, String defVal ); /** * 获取指定名称的环境变量(布尔类型)。 * * @param key 环境变量名称 * @param defVal 为空时的默认值 * @return 环境变量值 */ Boolean getBoolean( String key, Boolean defVal ); /** * 获取指定名称的环境变量(数值类型)。 * * @param key 环境变量名称 * @param defVal 为空时的默认值 * @return 环境变量值 */ Number getNumber( String key, Number defVal ); /** * 遍历数据方法。 * * @param action 遍历时的处理逻辑 */ void forEach( BiConsumer action ); /** * 调试时使用此方法打印出所有环境变量数据。 * * @param out 输出流. */ void list( PrintStream out ); /************************************************** * 一些辅助快速获取的方法。 **************************************************/ /** * 获取当前使用的字符集编码。 * * @return 当前使用的字符集编码 */ String getEncoding(); /** * 获取项目工作目录。 * * @return 项目工作目录 */ String getWorkDir(); /** * 获取临时文件存储目录。 * * @return 临时文件存储目录 */ String getTmpDir(); /** * 获取系统文件存储目录。 * * @return 系统文件存储目录 */ String getSysDir(); } // end class




© 2015 - 2025 Weber Informatics LLC | Privacy Policy