public class PropertiesUtil extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected static Map<String,Properties> |
allProps
所有读取过的属性集合
文件名 - 属性集合
|
protected static Properties |
defaultProp
默认属性集合(文件在Constants中配置)
|
| 构造器和说明 |
|---|
PropertiesUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Properties |
getProperties(String fileName)
读取属性文件,并将读出来的属性集合添加到【allProps】当中
如果该属性文件之前已读取过,则直接从【allProps】获得
|
static String |
getProperty(String name)
从默认的属性文件中获取某一属性值
如果属性文件不存在该属性则返回 null
|
static String |
getProperty(String fileName,
String name)
从指定的属性文件中获取某一属性值
如果属性文件不存在该属性则返回 null
|
protected static Properties |
loadProperties(String fileName)
解析属性文件,将文件中的所有属性都读取到【Properties】当中
|
protected static Properties defaultProp
protected static Map<String,Properties> allProps
public static Properties getProperties(String fileName)
fileName - 属性文件名protected static Properties loadProperties(String fileName)
fileName - 属性文件名public static String getProperty(String fileName, String name)
fileName - 属性文件name - 属性名称Copyright © 2023. All rights reserved.