com.alibaba.dubbo.common.utils
Class ConfigUtils
java.lang.Object
com.alibaba.dubbo.common.utils.ConfigUtils
public class ConfigUtils
- extends Object
- Author:
- ding.lid, william.liangf
isNotEmpty
public static boolean isNotEmpty(String value)
isEmpty
public static boolean isEmpty(String value)
isDefault
public static boolean isDefault(String value)
mergeValues
public static List<String> mergeValues(Class<?> type,
String cfg,
List<String> def)
- 扩展点列表中插入缺省扩展点。
扩展点列表支持
- 特殊值
default
,表示缺省扩展点插入的位置
- 特殊符号
-
,表示剔除。 -foo1
,剔除添加缺省扩展点foo1。-default
,剔除添加所有缺省扩展点。
- Parameters:
type
- 扩展点类型cfg
- 扩展点名列表def
- 缺省的扩展点的列表
- Returns:
- 完成缺省的扩展点列表插入后的列表
replaceProperty
public static String replaceProperty(String expression,
Map<String,String> params)
getProperties
public static Properties getProperties()
setProperties
public static void setProperties(Properties properties)
addProperties
public static void addProperties(Properties properties)
getProperty
public static String getProperty(String key)
getProperty
public static String getProperty(String key,
String defaultValue)
loadProperties
public static Properties loadProperties(String fileName)
loadProperties
public static Properties loadProperties(String fileName,
boolean allowMultiFile)
loadProperties
public static Properties loadProperties(String fileName,
boolean allowMultiFile,
boolean optional)
- Load properties file to
Properties
from class path.
- Parameters:
fileName
- properties file name. for example: dubbo.properties
, METE-INF/conf/foo.properties
allowMultiFile
- 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!s
- Returns:
- loaded
Properties
content.
- return empty Properties if no file found.
- merge multi properties file if found multi file
- Throws:
IllegalStateException
- not allow multi-file, but multi-file exsit on class path.
getPid
public static int getPid()
Copyright © 2012–2017 Alibaba. All rights reserved.