public class PropUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static Prop |
append(File file) |
static Prop |
append(File file,
Charset encoding) |
static Prop |
append(Prop prop) |
static Prop |
append(String fileName) |
static Prop |
append(String fileName,
Charset encoding) |
static Prop |
appendIfExists(File file) |
static Prop |
appendIfExists(File file,
Charset encoding) |
static Prop |
appendIfExists(String fileName) |
static Prop |
appendIfExists(String fileName,
Charset encoding) |
static void |
clear() |
static boolean |
containsKey(String key) |
static String |
get(String key) |
static String |
get(String key,
String defaultValue) |
static Boolean |
getBoolean(String key) |
static Boolean |
getBoolean(String key,
Boolean defaultValue) |
static Double |
getDouble(String key) |
static Double |
getDouble(String key,
Double defaultValue) |
static String |
getEnv() |
static String |
getEnvKey() |
static Integer |
getInt(String key) |
static Integer |
getInt(String key,
Integer defaultValue) |
static Long |
getLong(String key) |
static Long |
getLong(String key,
Long defaultValue) |
static Prop |
getProp() |
static Prop |
getProp(String fileName) |
static boolean |
isLoad() |
static void |
setEnvKey(String envKey)
设置环境 key,PropKit 将通过该 key 获取环境 value。
|
static Prop |
use(File file)
Use the properties file bye File object.
|
static Prop |
use(File file,
Charset encoding)
Use the properties file bye File object.
|
static Prop |
use(String fileName)
Use the properties file.
|
static Prop |
use(String fileName,
String env) |
static Prop |
use(String fileName,
String env,
Charset encoding) |
static Prop |
useFirstFound(String... fileNames)
Use the first found properties file
|
static Prop |
useless(String fileName) |
public static void setEnvKey(String envKey)
public static String getEnvKey()
public static String getEnv()
public static Prop use(String fileName)
use(String, String)public static Prop use(File file)
#use(File, String)public static Prop use(File file, Charset encoding)
Example:
PropKit.use(new File("/var/config/my_config.txt"), "UTF-8");
Strig userName = PropKit.use("my_config.txt").get("userName");
file - the properties File objectencoding - the encodingpublic static void clear()
public static Prop useFirstFound(String... fileNames)
public static boolean isLoad()
public static Prop getProp()
public static boolean containsKey(String key)
Copyright © 2024. All rights reserved.