bexee.util
Class BexeeProperties

java.lang.Object
  extended bybexee.util.BexeeProperties

public class BexeeProperties
extends java.lang.Object

Provides a convenient way for accessing system properties and bexee properties of which the latter are stored in a file called bexee.properties and must be somewhere in the classpath.

Note that system properties take precedence over all other properties unless a property is explicitly programmaticly set.

The system properties are always checked for changes whereas the properties from the bexee.properties are only read once upon creation.

The class provides a number of static methods that always check first if the properties had been loaded from the properties file.

Version:
$Revision: 1.1 $, $Date: 2004/12/15 14:18:20 $
Author:
Patric Fornasier

Field Summary
protected static java.util.Properties bexee
           
protected static java.lang.String FILE_NAME
           
protected static java.util.Properties props
           
 
Constructor Summary
BexeeProperties()
           
 
Method Summary
static java.util.Properties getProperties()
          Returns the initialized underlying property file.
static java.lang.String getProperty(java.lang.String key)
          Searches for the property with the specified key in this property list.
static java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Searches for the property with the specified key in this property list.
static java.lang.Object setProperty(java.lang.String key, java.lang.String value)
          Calls the Hashtable method put.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_NAME

protected static final java.lang.String FILE_NAME
See Also:
Constant Field Values

props

protected static java.util.Properties props

bexee

protected static java.util.Properties bexee
Constructor Detail

BexeeProperties

public BexeeProperties()
Method Detail

getProperty

public static java.lang.String getProperty(java.lang.String key)
Searches for the property with the specified key in this property list. The method returns null if the property is not found.

Parameters:
key - the property key.
Returns:
the value in this property list with the specified key value.

getProperty

public static java.lang.String getProperty(java.lang.String key,
                                           java.lang.String defaultValue)
Searches for the property with the specified key in this property list. The method returns the default value argument if the property is not found.

Parameters:
key - the hashtable key
defaultValue - a default value
Returns:
the value in this property list with the specified key value

getProperties

public static java.util.Properties getProperties()
Returns the initialized underlying property file.

Returns:
a Property object.

setProperty

public static java.lang.Object setProperty(java.lang.String key,
                                           java.lang.String value)
Calls the Hashtable method put. Provided for parallelism with the getProperty method. Enforces use of strings for property keys and values. The value returned is the result of the Hashtable call to put.

Parameters:
key - the key to be placed into this property list
value - the value corresponding to key
Returns:
the previous value of the specified key in this property list, or null if it did not have one


Copyright © 2004 Berne University of Applied Sciences. All Rights Reserved.