its.util
Class PropertiesUtils
java.lang.Object
its.util.PropertiesUtils
- public class PropertiesUtils
- extends java.lang.Object
|
Method Summary |
static boolean |
getBoolean(java.util.Properties p,
java.lang.String name)
|
static boolean |
getBoolean(java.util.Properties p,
java.lang.String name,
boolean default_)
|
static double |
getDouble(java.util.Properties p,
java.lang.String name)
|
static double |
getDouble(java.util.Properties p,
java.lang.String name,
double default_)
|
static int |
getInt(java.util.Properties p,
java.lang.String name)
|
static int |
getInt(java.util.Properties p,
java.lang.String name,
int default_)
|
static java.util.List |
getIntegerList(java.util.Properties p,
java.lang.String name,
java.util.List default_)
|
static java.util.Vector |
getIntegerValues(java.lang.String str)
|
static long |
getLong(java.util.Properties p,
java.lang.String name)
|
static long |
getLong(java.util.Properties p,
java.lang.String name,
long default_)
|
static java.util.Properties |
getProperties(java.io.File f)
|
static java.lang.String |
getString(java.util.Properties p,
java.lang.String name)
|
static java.lang.String |
getString(java.util.Properties p,
java.lang.String name,
java.lang.String default_)
|
static void |
inspect(java.util.Properties p)
|
static java.util.Properties |
loadInvertedProperties(java.io.File f)
|
static java.util.Properties |
loadInvertedProperties(java.io.Reader r)
|
static java.util.Properties |
locateProperties(java.lang.String[] appArgs,
java.lang.Class mainClass)
Procedure for populating a properties object at application startup.
1. if a cmd line arg is supplied, assume it is a file and attempt to
load it as such.
2. if no cmd line arg, look in the classpath for resource whose name
is derived from the main class name, qualified by package.
3. if resource in 2 does not exist, result is an empty properties map
This procedure is useful only to applications, not really to classes
embedded in e.g. web containers like Tomcat. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PropertiesUtils
public PropertiesUtils()
locateProperties
public static java.util.Properties locateProperties(java.lang.String[] appArgs,
java.lang.Class mainClass)
throws java.io.IOException
- Procedure for populating a properties object at application startup.
1. if a cmd line arg is supplied, assume it is a file and attempt to
load it as such.
2. if no cmd line arg, look in the classpath for resource whose name
is derived from the main class name, qualified by package.
3. if resource in 2 does not exist, result is an empty properties map
This procedure is useful only to applications, not really to classes
embedded in e.g. web containers like Tomcat. There is no 'main' routine
in the user application, and no assumptions can be made about the
existence of a file system
- Throws:
java.io.IOException
getProperties
public static java.util.Properties getProperties(java.io.File f)
throws java.io.IOException
- Throws:
java.io.IOException
inspect
public static void inspect(java.util.Properties p)
getString
public static java.lang.String getString(java.util.Properties p,
java.lang.String name)
- Parameters:
p - properties objectname - a required property name within p
- Returns:
- string-typed value of name in p
getString
public static java.lang.String getString(java.util.Properties p,
java.lang.String name,
java.lang.String default_)
- Parameters:
p - properties objectname - a property name within pdefault_ - value to return if property nort present
- Returns:
- string-typed value of name in p, or default_ if not found
getInt
public static int getInt(java.util.Properties p,
java.lang.String name)
- Parameters:
p - properties objectname - a required property name within p
- Returns:
- int-typed value of name in p
getInt
public static int getInt(java.util.Properties p,
java.lang.String name,
int default_)
- Parameters:
p - properties objectname - a property namedefault_ - value returned if name is not in p
- Returns:
- int-typed value of name (or default_)
getLong
public static long getLong(java.util.Properties p,
java.lang.String name)
- Parameters:
p - properties objectname - a required property name within p
- Returns:
- long-typed value of name in p
getLong
public static long getLong(java.util.Properties p,
java.lang.String name,
long default_)
- Parameters:
p - properties objectname - a property namedefault_ - value returned if name is not in p
- Returns:
- long-typed value of name (or default_)
getBoolean
public static boolean getBoolean(java.util.Properties p,
java.lang.String name)
- Parameters:
p - properties objectname - a required property name within p
- Returns:
- boolean-typed value of name in p
getBoolean
public static boolean getBoolean(java.util.Properties p,
java.lang.String name,
boolean default_)
getDouble
public static double getDouble(java.util.Properties p,
java.lang.String name)
- Parameters:
p - properties objectname - a required property name within p
- Returns:
- double-typed value of name in p
getDouble
public static double getDouble(java.util.Properties p,
java.lang.String name,
double default_)
- Parameters:
p - properties objectname - a property namedefault_ - value returned if name is not in p
- Returns:
- double-typed value of name (or default_)
getIntegerValues
public static java.util.Vector getIntegerValues(java.lang.String str)
throws java.io.IOException
- Throws:
java.io.IOException
getIntegerList
public static java.util.List getIntegerList(java.util.Properties p,
java.lang.String name,
java.util.List default_)
throws java.io.IOException
- Throws:
java.io.IOException
loadInvertedProperties
public static java.util.Properties loadInvertedProperties(java.io.File f)
throws java.io.IOException
- Throws:
java.io.IOException
loadInvertedProperties
public static java.util.Properties loadInvertedProperties(java.io.Reader r)
throws java.io.IOException
- Throws:
java.io.IOException