|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--amber.utility.PropertiesHandler
This class contains a series of utility functions which can be used to access properties files.
| Constructor Summary | |
PropertiesHandler()
Default constructor |
|
PropertiesHandler(boolean loadSystemProperties)
Allows the properties to be loaded with or without the system properties included. |
|
PropertiesHandler(java.lang.String filename)
Constructs a handler based on the specified filename. |
|
PropertiesHandler(java.lang.String filename,
boolean loadSystemProperties)
Constructs a handler based on the specified filename. |
|
| Method Summary | |
protected java.lang.String |
createCompositeName(java.lang.String group,
java.lang.String name)
This function is used by the group property functions. |
boolean |
doesGroupPropertyExist(java.lang.String group,
java.lang.String name)
Determines if the group property exists in the properties object. |
boolean |
doesPropertyExist(java.lang.String name)
Determines if the property exists in the properties object. |
java.lang.String |
getFilename()
This function returns the name of the properties file active. |
java.lang.String |
getGroupProperty(java.lang.String group,
java.lang.String name,
java.lang.String defaultValue)
Get a property from the properties object. |
boolean |
getGroupPropertyBoolean(java.lang.String group,
java.lang.String name,
boolean defaultValue)
Get a property boolean from the properties object. |
int |
getGroupPropertyInt(java.lang.String group,
java.lang.String name,
int defaultValue)
Get a property integer from the properties object. |
long |
getGroupPropertyLong(java.lang.String group,
java.lang.String name,
long defaultValue)
Get a property long from the properties object. |
java.util.Enumeration |
getGroupPropertyNames(java.lang.String groupName)
Get an enumeration of all the property names in the properties object. |
java.lang.String |
getHeader()
This function returns the name of the properties file active. |
java.lang.String |
getProperty(java.lang.String name,
java.lang.String defaultValue)
Get a property from the properties object. |
boolean |
getPropertyBoolean(java.lang.String name,
boolean defaultValue)
Get a property boolean from the properties object. |
int |
getPropertyInt(java.lang.String name,
int defaultValue)
Get a property integer from the properties object. |
long |
getPropertyLong(java.lang.String name,
long defaultValue)
Get a property long from the properties object. |
java.util.Enumeration |
getPropertyNames()
Get an enumeration of all the property names in the properties object. |
boolean |
isFileValid()
Returns the state of the file load. |
boolean |
isResource()
This returns true if the properties file loaded the properties as a resource. |
protected void |
openPropertiesFile(java.lang.String filename,
boolean loadSystemProperties)
This function is used to actually read the properties from the file. |
void |
removeGroupProperty(java.lang.String group,
java.lang.String name)
Remove a property from the properties group object. |
void |
removeProperty(java.lang.String name)
Remove a property from the properties object. |
void |
save()
This function saves the properties file to the internal filename. |
void |
save(java.lang.String filename)
This function saves the properties file to the specified filename. |
void |
setFilename(java.lang.String newName)
This function sets the filename of the properties file and opens the corresponding properties. |
void |
setFilename(java.lang.String newName,
boolean loadSystemProperties)
This function sets the filename of the properties file and opens the corresponding properties. |
void |
setGroupProperty(java.lang.String group,
java.lang.String name,
java.lang.String value)
Set a property in the properties object. |
void |
setGroupPropertyBoolean(java.lang.String group,
java.lang.String name,
boolean value)
Set a boolean property in the properties object. |
void |
setGroupPropertyInt(java.lang.String group,
java.lang.String name,
int value)
Set an integer property in the properties object. |
void |
setGroupPropertyLong(java.lang.String group,
java.lang.String name,
long value)
Set an integer property in the properties object. |
void |
setHeader(java.lang.String header)
This function sets the optional header for the properties file. |
void |
setProperty(java.lang.String name,
java.lang.String value)
Set a property in the properties object. |
void |
setPropertyBoolean(java.lang.String name,
boolean value)
Set an boolean property in the properties object. |
void |
setPropertyInt(java.lang.String name,
int value)
Set an integer property in the properties object. |
void |
setPropertyLong(java.lang.String name,
long value)
Set a long property in the properties object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PropertiesHandler()
public PropertiesHandler(java.lang.String filename)
filename - String name of the properties file.
public PropertiesHandler(java.lang.String filename,
boolean loadSystemProperties)
filename - String name of the properties file.loadSystemProperties - boolean true if the system properties are
to be loaded.public PropertiesHandler(boolean loadSystemProperties)
loadSystemProperties - boolean true if the system properties are
to be loaded.| Method Detail |
protected java.lang.String createCompositeName(java.lang.String group,
java.lang.String name)
group - String containing the name of the group.name - String name of the individual property entry.
public boolean doesGroupPropertyExist(java.lang.String group,
java.lang.String name)
group - String containing the name of the group. This is a base
dotted notation string which is prepended to the name value. Do not
add a trailing dot.name - String property name to access.public boolean doesPropertyExist(java.lang.String name)
name - String property name to access.public java.lang.String getFilename()
public java.lang.String getGroupProperty(java.lang.String group,
java.lang.String name,
java.lang.String defaultValue)
group - String containing the name of the group. This is a base
dotted notation string which is prepended to the name value. Do not
add a trailing dot.name - String property name to access.defaultValue - String value to return if the property does not exist.
public boolean getGroupPropertyBoolean(java.lang.String group,
java.lang.String name,
boolean defaultValue)
group - String containing the name of the group. This is a base
dotted notation string which is prepended to the name value. Do not
add a trailing dot.name - String property name to access.defaultValue - boolean value to return if the property does not exist.
public int getGroupPropertyInt(java.lang.String group,
java.lang.String name,
int defaultValue)
group - String containing the name of the group. This is a base
dotted notation string which is prepended to the name value. Do not
add a trailing dot.name - String property name to access.defaultValue - int value to return if the property does not exist.
public long getGroupPropertyLong(java.lang.String group,
java.lang.String name,
long defaultValue)
group - String containing the name of the group. This is a base
dotted notation string which is prepended to the name value. Do not
add a trailing dot.name - String property name to access.defaultValue - long value to return if the property does not exist.public java.util.Enumeration getGroupPropertyNames(java.lang.String groupName)
groupName - String containing the name of the group to select.public java.lang.String getHeader()
public java.lang.String getProperty(java.lang.String name,
java.lang.String defaultValue)
name - String property name to access.defaultValue - String value to return if the property does not exist.
public boolean getPropertyBoolean(java.lang.String name,
boolean defaultValue)
name - String property name to access.defaultValue - boolean value to return if the property does not exist.
public int getPropertyInt(java.lang.String name,
int defaultValue)
name - String property name to access.defaultValue - int value to return if the property does not exist.
public long getPropertyLong(java.lang.String name,
long defaultValue)
name - String property name to access.defaultValue - long value to return if the property does not exist.public java.util.Enumeration getPropertyNames()
public boolean isFileValid()
public boolean isResource()
protected void openPropertiesFile(java.lang.String filename,
boolean loadSystemProperties)
throws java.io.IOException
filename - String containing the filename of the properties file.loadSystemProperties - boolean true if the system properties are
to be loaded.java.io.IOException - containing any errors.
public void removeGroupProperty(java.lang.String group,
java.lang.String name)
group - String containing the name of the group. This is a base
dotted notation string which is prepended to the name value. Do not
add a trailing dot.name - String property name to remove.public void removeProperty(java.lang.String name)
name - String property name to remove.
public void save()
throws java.io.IOException
java.io.IOException - containing errors saving the file.
public void save(java.lang.String filename)
throws java.io.IOException
filename - String name of the file to save to.java.io.IOException - containing errors saving the file.
public void setFilename(java.lang.String newName)
throws java.io.IOException
newName - String containing the filename of the properties file.java.io.IOException - containing any errors.
public void setFilename(java.lang.String newName,
boolean loadSystemProperties)
throws java.io.IOException
newName - String containing the filename of the properties file.loadSystemProperties - boolean true if the system properties are
to be loaded.java.io.IOException - containing any errors.
public void setGroupProperty(java.lang.String group,
java.lang.String name,
java.lang.String value)
group - String containing the name of the group. This is a base
dotted notation string which is prepended to the name value. Do not
add a trailing dot.name - String property name to set.value - String value to set the property to.
public void setGroupPropertyBoolean(java.lang.String group,
java.lang.String name,
boolean value)
group - String containing the name of the group. This is a base
dotted notation string which is prepended to the name value. Do not
add a trailing dot.name - String property name to set.value - boolean value to set the property to.
public void setGroupPropertyInt(java.lang.String group,
java.lang.String name,
int value)
group - String containing the name of the group. This is a base
dotted notation string which is prepended to the name value. Do not
add a trailing dot.name - String property name to set.value - int value to set the property to.
public void setGroupPropertyLong(java.lang.String group,
java.lang.String name,
long value)
group - String containing the name of the group. This is a base
dotted notation string which is prepended to the name value. Do not
add a trailing dot.name - String property name to set.value - long value to set the property to.public void setHeader(java.lang.String header)
header - String containing the header of the properties file.
public void setProperty(java.lang.String name,
java.lang.String value)
name - String property name to set.value - String value to set the property to.
public void setPropertyBoolean(java.lang.String name,
boolean value)
name - String property name to set.value - boolean value to set the property to.
public void setPropertyInt(java.lang.String name,
int value)
name - String property name to set.value - int value to set the property to.
public void setPropertyLong(java.lang.String name,
long value)
name - String property name to set.value - int value to set the property to.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||