public class TProperties extends Object
| Constructor and Description |
|---|
TProperties() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
清空 Properites 缓存
|
static boolean |
defaultValue(File file,
String name)
从Properties读取双精度浮点数
|
static boolean |
getBoolean(File file,
String name,
Boolean defaultValue)
从Properties文件读取 Boolean
|
static boolean |
getBoolean(String fileName,
String name)
从Properties文件读取 Boolean
|
static boolean |
getBoolean(String fileName,
String name,
Boolean defaultValue)
从Properties文件读取 Boolean
|
static double |
getDouble(File file,
String name)
从Properties读取双精度浮点数
|
static double |
getDouble(File file,
String name,
Double defaultValue)
从Properties读取双精度浮点数
|
static double |
getDouble(String fileName,
String name)
从Properties读取双精度浮点数
|
static double |
getDouble(String fileName,
String name,
Double defaultValue)
从Properties读取双精度浮点数
|
static float |
getFloat(File file,
String name)
从Properties文件读取浮点数
|
static float |
getFloat(File file,
String name,
Float defaultValue)
从Properties文件读取浮点数
|
static float |
getFloat(String fileName,
String name)
从Properties文件读取浮点数
|
static float |
getFloat(String fileName,
String name,
Float defaultValue)
从Properties文件读取浮点数
|
static int |
getInt(File file,
String name)
从Properties文件读取整形
|
static int |
getInt(File file,
String name,
Integer defaultValue)
从Properties文件读取整形
|
static int |
getInt(String fileName,
String name)
从Properties文件读取整形
|
static int |
getInt(String fileName,
String name,
Integer defaultValue)
从Properties文件读取整形
|
static Properties |
getProperties(File file)
解析 Properties 文件
|
static Properties |
getProperties(String fileName)
解析 Properties 文件
|
static Properties |
getProperties(URL url)
从 http 服务拉取并解析 Properties 文件
|
static String |
getString(File file,
String name)
从Properties文件读取字符串
|
static String |
getString(File file,
String name,
String defaultValue)
从Properties文件读取字符串
|
static String |
getString(String fileName,
String name)
从Properties文件读取字符串
|
static String |
getString(String fileName,
String name,
String defaultValue)
从Properties文件读取字符串
|
static void |
setString(File file,
String name,
String value)
保存信息到 Properties文件
|
public static Properties getProperties(URL url)
url - 文件对象public static Properties getProperties(File file)
file - 文件对象public static Properties getProperties(String fileName)
fileName - 文件名, 不包含扩展名, 或自动瓶装环境参数和扩展名
传入 database 参数会拼装出 database-环境名.properties 作为文件名
并且在 classes 或者 target/classes 目录下寻找指定文件.
如果没有指定环境名的配置文件则使用默认的配置文件public static String getString(File file, String name, String defaultValue)
file - 文件对象name - 属性名defaultValue - 默认值public static String getString(File file, String name)
file - 文件对象name - 属性名public static int getInt(File file, String name, Integer defaultValue)
file - 文件对象name - 属性名defaultValue - 默认值public static int getInt(File file, String name)
file - 文件对象name - 属性名public static float getFloat(File file, String name, Float defaultValue)
file - 文件对象name - 属性名defaultValue - 默认值public static float getFloat(File file, String name)
file - 文件对象name - 属性名public static double getDouble(File file, String name, Double defaultValue)
file - 文件对象name - 属性名defaultValue - 默认值public static double getDouble(File file, String name)
file - 文件对象name - 属性名public static boolean getBoolean(File file, String name, Boolean defaultValue)
file - 文件对象name - 属性名defaultValue - 默认值public static boolean defaultValue(File file, String name)
file - 文件对象name - 属性名public static void setString(File file, String name, String value) throws IOException
file - 文件对象name - 属性名value - 属性值IOException - IO异常public static String getString(String fileName, String name, String defaultValue)
fileName - 文件对象name - 属性名defaultValue - 默认值public static String getString(String fileName, String name)
fileName - 文件对象name - 属性名public static int getInt(String fileName, String name, Integer defaultValue)
fileName - 文件对象name - 属性名defaultValue - 默认值public static int getInt(String fileName, String name)
fileName - 文件对象name - 属性名public static float getFloat(String fileName, String name, Float defaultValue)
fileName - 文件对象name - 属性名defaultValue - 默认值public static float getFloat(String fileName, String name)
fileName - 文件对象name - 属性名public static double getDouble(String fileName, String name, Double defaultValue)
fileName - 文件对象name - 属性名defaultValue - 默认值public static double getDouble(String fileName, String name)
fileName - 文件对象name - 属性名public static boolean getBoolean(String fileName, String name, Boolean defaultValue)
fileName - 文件对象name - 属性名defaultValue - 默认值public static boolean getBoolean(String fileName, String name)
fileName - 文件对象name - 属性名public void clear()
Copyright © 2020 Voovan. All rights reserved.