public class Environment extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Set<String> |
activeProfiles
激活特定配置
|
protected Set<String> |
allProfiles
所有的profile
|
protected List<String> |
cfgFileLocations
配置文件路径
|
protected List<String> |
cfgFileNames
配置文件名字
|
protected EP |
ep |
protected Map<String,String> |
finalAttrs
最终汇总属性
|
protected Map<String,Map<String,String>> |
locationSources
location 和 其对应的 所有属性
|
protected Log |
log |
protected Pattern |
p |
protected Map<String,Map<String,String>> |
profileSources
profile 和 其对应的 所有属性
|
static String |
PROP_ACTIVE |
protected Map<String,Object> |
runtimeAttrs
运行时改变的属性, 优先级高于
finalAttrs see: getAttr(String) |
| Constructor and Description |
|---|
Environment(EP ep) |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
getAttr(String key)
取属性.
|
Boolean |
getBoolean(String name,
Boolean defaultValue) |
Map<String,String> |
getFinalAttrs() |
Integer |
getInteger(String key,
Integer defaultValue) |
Map<String,Map<String,String>> |
getLocationSources() |
Long |
getLong(String key,
Long defaultValue) |
String |
getString(String key,
String defaultValue) |
Map<String,String> |
group(String... keys)
取一组属性集合.
|
protected void |
init()
初始化
|
protected void |
initLog()
初始化日志实现系统
|
protected void |
loadCfg()
加载配置
支持: properties 文件.
|
protected void |
loadPropertiesFile(String profile,
String cfgFileLocation,
String cfgFileName)
加载 properties 文件源
|
protected void |
parseValue(Map<String,String> attrs,
AtomicInteger count)
替换 值包含${attr}的字符串
|
Environment |
setAttr(String key,
Object value)
用于运行时改变属性
|
public static final String PROP_ACTIVE
protected Log log
protected EP ep
protected final Map<String,Object> runtimeAttrs
finalAttrs see: getAttr(String)protected Pattern p
public Environment(EP ep)
protected void init()
protected void loadCfg()
protected void initLog()
protected void loadPropertiesFile(String profile, String cfgFileLocation, String cfgFileName)
profile - cfgFileLocation - cfgFileName - protected void parseValue(Map<String,String> attrs, AtomicInteger count)
attrs - @EL(name="env.getAttr", async=false) protected Object getAttr(String key)
key - public Environment setAttr(String key, Object value)
key - 属性名value - 属性值@EL(name="env.ns", async=false) public Map<String,String> group(String... keys)
keys - 属性前缀Copyright © 2020. All rights reserved.