public class Prop extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected Properties |
properties |
| 构造器和说明 |
|---|
Prop()
支持 new Prop().appendIfExists(...)
|
Prop(File file)
Prop constructor.
|
Prop(File file,
String encoding)
Prop constructor
Example:
Prop prop = new Prop(new File("/var/config/my_config.txt"), "UTF-8"); String userName = prop.get("userName"); |
Prop(String fileName)
Prop constructor.
|
Prop(String fileName,
String encoding)
Prop constructor
Example:
Prop prop = new Prop("my_config.txt", "UTF-8"); String userName = prop.get("userName"); prop = new Prop("com/jfinal/file_in_sub_path_of_classpath.txt", "UTF-8"); String value = prop.get("key"); |
| 限定符和类型 | 方法和说明 |
|---|---|
Prop |
append(File file) |
Prop |
append(File file,
String encoding) |
Prop |
append(Prop prop) |
Prop |
append(String fileName) |
Prop |
append(String fileName,
String encoding) |
Prop |
appendIfExists(File file) |
Prop |
appendIfExists(File file,
String encoding) |
Prop |
appendIfExists(String fileName) |
Prop |
appendIfExists(String fileName,
String encoding) |
boolean |
containsKey(String key) |
String |
get(String key) |
String |
get(String key,
String defaultValue) |
Boolean |
getBoolean(String key) |
Boolean |
getBoolean(String key,
Boolean defaultValue) |
Double |
getDouble(String key) |
Double |
getDouble(String key,
Double defaultValue) |
Integer |
getInt(String key) |
Integer |
getInt(String key,
Integer defaultValue) |
Long |
getLong(String key) |
Long |
getLong(String key,
Long defaultValue) |
Properties |
getProperties() |
boolean |
isEmpty() |
boolean |
notEmpty() |
protected Properties properties
public Prop()
public Prop(String fileName)
Prop(String, String)public Prop(String fileName, String encoding)
Example:
Prop prop = new Prop("my_config.txt", "UTF-8");
String userName = prop.get("userName");
prop = new Prop("com/jfinal/file_in_sub_path_of_classpath.txt", "UTF-8");
String value = prop.get("key");
fileName - the properties file's name in classpath or the sub directory of classpathencoding - the encodingpublic Prop(File file)
Prop(File, String)public boolean containsKey(String key)
public boolean isEmpty()
public boolean notEmpty()
public Properties getProperties()
Copyright © 2024. All rights reserved.