cn.dreampie.common.util.properties
类 Proper

java.lang.Object
  继承者 cn.dreampie.common.util.properties.Proper

public class Proper
extends Object

Proper. Proper can load properties file from CLASSPATH or File object.


方法摘要
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 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 Prop use(File file)
          Using the properties file bye File object.
static Prop use(File file, String encoding)
          Using the properties file bye File object.
static Prop use(String fileName)
          Using the properties file.
static Prop use(String fileName, String encoding)
          Using the properties file.
static Prop useless(String fileName)
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

use

public static Prop use(String fileName)
Using the properties file. It will loading the properties file if not loading.

另请参见:
use(String, String)

use

public static Prop use(String fileName,
                       String encoding)
Using the properties file. It will loading the properties file if not loading.

Example:
Proper.use("config.txt", "UTF-8");
Proper.use("other_config.txt", "UTF-8");

String userName = Proper.get("userName");
String password = Proper.get("password");

userName = Proper.use("other_config.txt").get("userName");
password = Proper.use("other_config.txt").get("password");

Proper.use("com/jfinal/config_in_sub_directory_of_classpath.txt");

参数:
fileName - the properties file's name in classpath or the sub directory of classpath
encoding - the encoding

use

public static Prop use(File file)
Using the properties file bye File object. It will loading the properties file if not loading.

另请参见:
use(java.io.File, String)

use

public static Prop use(File file,
                       String encoding)
Using the properties file bye File object. It will loading the properties file if not loading.

Example:
Proper.use(new File("/var/config/my_config.txt"), "UTF-8");
Strig userName = Proper.use("my_config.txt").get("userName");

参数:
file - the properties File object
encoding - the encoding

useless

public static Prop useless(String fileName)

clear

public static void clear()

getProp

public static Prop getProp()

getProp

public static Prop getProp(String fileName)

get

public static String get(String key)

get

public static String get(String key,
                         String defaultValue)

getInt

public static Integer getInt(String key)

getInt

public static Integer getInt(String key,
                             Integer defaultValue)

getLong

public static Long getLong(String key)

getLong

public static Long getLong(String key,
                           Long defaultValue)

getBoolean

public static Boolean getBoolean(String key)

getBoolean

public static Boolean getBoolean(String key,
                                 Boolean defaultValue)

containsKey

public static boolean containsKey(String key)


Copyright © 2015. All rights reserved.