com.creamtec.core
Class AppProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<java.lang.Object,java.lang.Object>
          extended by java.util.Properties
              extended by com.creamtec.core.AppProperties
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>
Direct Known Subclasses:
AjaxSwingProperties

public class AppProperties
extends java.util.Properties

AppProperties extends java.util.Properties and adds convenience methods for reading properties from a file and getting typed properties such as boolean and int

See Also:
Serialized Form

Constructor Summary
AppProperties()
          Instantiates the object
AppProperties(java.util.Properties defaults)
          Instantiates the object populated with default values
AppProperties(java.lang.String fileName)
          Instantiates the object and reads the properties from a given file
AppProperties(java.lang.String fileName, boolean trace)
          Instantiates the object and reads the properties from a given file
 
Method Summary
 java.lang.String getAppName()
           
 boolean getBooleanProperty(java.lang.String key, boolean defValue)
          Returns a value of the boolean property
 java.lang.String getFileName()
          Returns the file name that was used to load the properties
 int getIntProperty(java.lang.String key, int defValue)
          Returns a value of the int property
 void setAppName(java.lang.String appName)
           
 void setBooleanProperty(java.lang.String key, boolean value)
          Sets the value of a boolean property
 void setIntProperty(java.lang.String key, int value)
          Sets the value of an int property
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, storeToXML, storeToXML
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AppProperties

public AppProperties(java.lang.String fileName)
Instantiates the object and reads the properties from a given file

Parameters:
fileName - name of the file

AppProperties

public AppProperties(java.lang.String fileName,
                     boolean trace)
Instantiates the object and reads the properties from a given file

Parameters:
fileName - name of the file
trace - if true, a log message will be written indicating the progress of loading

AppProperties

public AppProperties(java.util.Properties defaults)
              throws java.lang.Exception
Instantiates the object populated with default values

Parameters:
defaults - Properties
Throws:
java.lang.Exception

AppProperties

public AppProperties()
Instantiates the object

Throws:
java.lang.Exception
Method Detail

getAppName

public java.lang.String getAppName()

setAppName

public void setAppName(java.lang.String appName)

getBooleanProperty

public boolean getBooleanProperty(java.lang.String key,
                                  boolean defValue)
Returns a value of the boolean property

Parameters:
key - property name
defValue - default value that should be used if the property has no value
Returns:
value

setBooleanProperty

public void setBooleanProperty(java.lang.String key,
                               boolean value)
Sets the value of a boolean property

Parameters:
key - property name
value - value

getIntProperty

public int getIntProperty(java.lang.String key,
                          int defValue)
Returns a value of the int property

Parameters:
key - property name
defValue - default value that should be used if the property has no value
Returns:
value

setIntProperty

public void setIntProperty(java.lang.String key,
                           int value)
Sets the value of an int property

Parameters:
key - property name
value - value

getFileName

public java.lang.String getFileName()
Returns the file name that was used to load the properties

Returns:
file name


Copyright © 2000-2012 CreamTec LLC. All Rights Reserved.