com.pushtotest.testmaker.resources
Class PropertyFinder

java.lang.Object
  extended by com.pushtotest.testmaker.resources.PropertyFinder

public class PropertyFinder
extends java.lang.Object

This is a simple wrapper around a ResourceBundle that simplifies loading it and getting a value from it. Mainly used so that we can pre-load them and cache them for static access.


Constructor Summary
PropertyFinder(java.lang.String resourceBundle)
          Constructor.
 
Method Summary
 boolean getBoolean(java.lang.String key, boolean defValue)
          Looks up a key in the ResourceBundle and finds the value associated with it.
 double getDouble(java.lang.String key, double defValue)
          Looks up a key in the ResourceBundle and finds the value associated with it.
 int getInt(java.lang.String key, int defValue)
          Looks up a key in the ResourceBundle and finds the value associated with it.
 java.util.Enumeration getKeys()
          Returns an enumeration of all the keys in this Bundle.
 java.util.Locale getLocale()
          Return the Locale for this ResourceBundle.
 long getLong(java.lang.String key, long defValue)
          Looks up a key in the ResourceBundle and finds the value associated with it.
 java.lang.String getString(java.lang.String key)
          Looks up a key in the ResourceBundle and finds the value associated with it.
 java.lang.String getString(java.lang.String key, java.lang.String defValue)
          Looks up a key in the ResourceBundle and finds the value associated with it.
 java.lang.String[] getStringArray(java.lang.String key, java.lang.String[] defValue)
          This method is used to retrieve a multi-valued property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyFinder

public PropertyFinder(java.lang.String resourceBundle)
Constructor. Takes a single string argument. That string is the path to the properties file that you want loaded.

Parameters:
resourceBundle - The properties file that you want to load.
Method Detail

getKeys

public java.util.Enumeration getKeys()
Returns an enumeration of all the keys in this Bundle.

Returns:
An Enumeration of keys.

getLocale

public java.util.Locale getLocale()
Return the Locale for this ResourceBundle.

Returns:
The Locale that is associated with this ResourceBundle

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String defValue)
Looks up a key in the ResourceBundle and finds the value associated with it. If the key is not found (or is null) the default value will be passed back. No checking is done on the default value, so if you don't want null back, don't pass it in.

Parameters:
key - The key that you want to look up.
defValue - The default value to return if that key is not found.
Returns:
The String value associated with that key.

getString

public java.lang.String getString(java.lang.String key)
Looks up a key in the ResourceBundle and finds the value associated with it. If the key is not found (or is null) a null is returned.

Parameters:
key - The key that you want to look up.
Returns:
The String value associated with that key or null

getStringArray

public java.lang.String[] getStringArray(java.lang.String key,
                                         java.lang.String[] defValue)
This method is used to retrieve a multi-valued property. This is written property=value,value2.

Parameters:
key - The key that holds the values you want.
defValue - The default values in case the key is not found.
Returns:
The array of strings.

getInt

public int getInt(java.lang.String key,
                  int defValue)
Looks up a key in the ResourceBundle and finds the value associated with it. If the key is not found (or is null) the default value will be passed back. No checking is done on the default value, so if you don't want null back, don't pass it in.

Parameters:
key - The key that you want to look up.
defValue - The default value to return if that key is not found.
Returns:
The int value associated with that key.

getLong

public long getLong(java.lang.String key,
                    long defValue)
Looks up a key in the ResourceBundle and finds the value associated with it. If the key is not found (or is null) the default value will be passed back. No checking is done on the default value, so if you don't want null back, don't pass it in.

Parameters:
key - The key that you want to look up.
defValue - The default value to return if that key is not found.
Returns:
The long value associated with that key.

getDouble

public double getDouble(java.lang.String key,
                        double defValue)
Looks up a key in the ResourceBundle and finds the value associated with it. If the key is not found (or is null) the default value will be passed back. No checking is done on the default value, so if you don't want null back, don't pass it in.

Parameters:
key - The key that you want to look up.
defValue - The default value to return if that key is not found.
Returns:
The double value associated with that key.

getBoolean

public boolean getBoolean(java.lang.String key,
                          boolean defValue)
Looks up a key in the ResourceBundle and finds the value associated with it. If the key is not found (or is null) the default value will be passed back. No checking is done on the default value, so if you don't want null back, don't pass it in.

Parameters:
key - The key that you want to look up.
defValue - The default value to return if that key is not found.
Returns:
The boolean value associated with that key.