com.alibaba.dubbo.common.utils
Class ConfigUtils

java.lang.Object
  extended by com.alibaba.dubbo.common.utils.ConfigUtils

public class ConfigUtils
extends Object

Author:
ding.lid, william.liangf

Method Summary
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)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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)
扩展点列表中插入缺省扩展点。

扩展点列表支持

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.