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 String |
getSystemProperty(String key)
System environment -> System properties
|
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)
Insert default extension into extension list.
|
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)
Extension list support
default, means the location for default extensions.
-, means remove. -foo1 will remove default extension 'foo'; -default will remove all default extensions.
type - Extension typecfg - Extension name listdef - Default extension listpublic static Properties getProperties()
public static void setProperties(Properties properties)
public static void addProperties(Properties properties)
public static String getSystemProperty(String key)
key - keypublic 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 exist on class path.public static int getPid()
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.