com.metamatrix.toolbox.ui.widget.util
Class PropertyLoader

java.lang.Object
  extended by com.metamatrix.toolbox.ui.widget.util.PropertyLoader

public class PropertyLoader
extends java.lang.Object

PropertyLoader is a class for loading and working with property files, especially those containing repeating branch structures.


Field Summary
static java.lang.String PROPERTY_PREFIX
           
 
Constructor Summary
PropertyLoader(java.util.Properties props)
          Constructor - set the properties object that this object should operate on.
PropertyLoader(java.lang.String propertiesFile)
          Constructor - specify the file (with path) for this object to load.
 
Method Summary
 java.util.Properties getProperties()
          return a Properties object containing all property pairs loaded into this object.
 java.util.Properties getPropertiesBranch(java.lang.String prefix)
          return a Properties object containing all property pairs beneath the specified prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_PREFIX

public static final java.lang.String PROPERTY_PREFIX
See Also:
Constant Field Values
Constructor Detail

PropertyLoader

public PropertyLoader(java.lang.String propertiesFile)
Constructor - specify the file (with path) for this object to load. The file will not be accessed until either getProperties() or getPropertyBranch() is called.

Parameters:
propertiesFile - property file name. May be either in a jar or on the file system. PropertyLoader attempts to find the file as a jar resource first, then on the file system.

PropertyLoader

public PropertyLoader(java.util.Properties props)
Constructor - set the properties object that this object should operate on.

Parameters:
props - object
Method Detail

getProperties

public java.util.Properties getProperties()
                                   throws PropertyLoaderException
return a Properties object containing all property pairs loaded into this object.

Returns:
all properties that this object has loaded. Will not return null.
Throws:
PropertyLoaderException - if the specified file name for the properties could not be found.

getPropertiesBranch

public java.util.Properties getPropertiesBranch(java.lang.String prefix)
                                         throws PropertyLoaderException
return a Properties object containing all property pairs beneath the specified prefix.

Returns:
all properties beneath the specified node, plus an additional property named PROPERTY_PREFIX with the value of the specified prefix. Will not return null.
Throws:
PropertyLoaderException - if the specified file name for the properties could not be found.


Copyright © 2009. All Rights Reserved.