public class ConfigUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
addProperties(Properties properties) |
static int |
getPid() |
static Properties |
getProperties() |
static String |
getProperty(String key) |
static String |
getProperty(String key,
String defaultValue) |
static boolean |
isDefault(String value) |
static boolean |
isEmpty(String value) |
static boolean |
isNotEmpty(String value) |
static Properties |
loadProperties(String fileName) |
static Properties |
loadProperties(String fileName,
boolean allowMultiFile) |
static Properties |
loadProperties(String fileName,
boolean allowMultiFile,
boolean optional)
Load properties file to
Properties from class path. |
static List<String> |
mergeValues(Class<?> type,
String cfg,
List<String> def)
扩展点列表中插入缺省扩展点。
|
static String |
replaceProperty(String expression,
Map<String,String> params) |
static void |
setProperties(Properties properties) |
public static boolean isNotEmpty(String value)
public static boolean isEmpty(String value)
public static boolean isDefault(String value)
public static List<String> mergeValues(Class<?> type, String cfg, List<String> def)
扩展点列表支持
default,表示缺省扩展点插入的位置
-,表示剔除。 -foo1,剔除添加缺省扩展点foo1。-default,剔除添加所有缺省扩展点。
type - 扩展点类型cfg - 扩展点名列表def - 缺省的扩展点的列表public static Properties getProperties()
public static void setProperties(Properties properties)
public static void addProperties(Properties properties)
public static Properties loadProperties(String fileName)
public static Properties loadProperties(String fileName, boolean allowMultiFile)
public static Properties loadProperties(String fileName, boolean allowMultiFile, boolean optional)
Properties from class path.fileName - properties file name. for example: dubbo.properties, METE-INF/conf/foo.propertiesallowMultiFile - if false, throw IllegalStateException when found multi file on the class path.optional - is optional. if false, log warn when properties config file not found!sProperties content. IllegalStateException - not allow multi-file, but multi-file exsit on class path.public static int getPid()
Copyright © 2012–2017 Alibaba. All rights reserved.