|
|||||||||
| Home >> All >> com >> simscomputing >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.simscomputing.util
Class ApplicationProperties

java.lang.Objectcom.simscomputing.util.ApplicationProperties
- public class ApplicationProperties
- extends java.lang.Object
Encapsulates the java.util.Properties class to be more programmer-friendly. Given a file name that resolves to a file that is java.util.Properties-readable, all FileStream work is done for the client programmer. This class also offers the capability to find properties based on a substring to match.
- Version:
- $Revision: 1.1.1.1 $ $Date: 2000/02/21 21:22:36 $
| Field Summary | |
private java.util.Properties |
appProperties
|
private java.io.File |
propertiesFile
|
| Constructor Summary | |
ApplicationProperties(java.lang.String fileName)
Will first verify that the given String file name is a valid file, and if so will go ahead and load the properties in that file. |
|
ApplicationProperties(java.lang.String fileName,
boolean loadNow)
Will first verify that the given String file name is a valid file, and if it is valid and the loadNow parameter is set to true,
will go ahead and load the properties in that file |
|
| Method Summary | |
boolean |
containsPropertyName(java.lang.String propertyName)
Tests for the existence of the given property name. |
boolean |
containsPropertyValue(java.lang.String propertyValue)
Tests for the existence of the given property value. |
java.util.Map |
getPropertiesLike(java.lang.String propertyNameToMatch)
Returns a Map of all property name/value pairs that match the passed-in String in any way. |
java.lang.String |
getProperty(java.lang.String propertyName)
Gets a property value given a property name. |
void |
loadProperties()
Loads all properties from the properties file given at construction time. |
void |
removeProperty(java.lang.String propertyName)
Removes the given property. |
void |
setProperty(java.lang.String propertyName,
java.lang.String propertyValue)
Sets a property value given a property name. |
void |
storeProperties()
Stores the properties back into the file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
propertiesFile
private final java.io.File propertiesFile
appProperties
private java.util.Properties appProperties
| Constructor Detail |
ApplicationProperties
public ApplicationProperties(java.lang.String fileName) throws java.io.IOException
- Will first verify that the given String file name is a valid file, and
if so will go ahead and load the properties in that file. This
constructor signature will immediately load the properties from
the given file (same as calling
ApplicationProperties(fileName, true).
ApplicationProperties
public ApplicationProperties(java.lang.String fileName, boolean loadNow) throws java.io.IOException
- Will first verify that the given String file name is a valid file, and
if it is valid and the loadNow parameter is set to
true, will go ahead and load the properties in that file
| Method Detail |
getProperty
public java.lang.String getProperty(java.lang.String propertyName)
- Gets a property value given a property name. Will return null if no name
matches.
getPropertiesLike
public java.util.Map getPropertiesLike(java.lang.String propertyNameToMatch)
- Returns a Map of all property name/value pairs that match the passed-in String
in any way. The test for matching is done via the String method indexOf, meaning
that the match expression will resolve to true if the passed-in String can be
found anywhere in the property name.
setProperty
public void setProperty(java.lang.String propertyName, java.lang.String propertyValue)
- Sets a property value given a property name. Will create an entry if none
exists for the given property name; will overwrite if one does already exist.
The set will not be persisted until storeProperties() is called.
containsPropertyName
public boolean containsPropertyName(java.lang.String propertyName)
- Tests for the existence of the given property name.
containsPropertyValue
public boolean containsPropertyValue(java.lang.String propertyValue)
- Tests for the existence of the given property value.
removeProperty
public void removeProperty(java.lang.String propertyName)
- Removes the given property. Removal will not be persisted until
storeProperties() is called.
loadProperties
public void loadProperties()
throws java.io.IOException
- Loads all properties from the properties file given at construction time.
This method works like a reload (or a first-time load if the object was
constructed with the loadNow parameter set to
false). All in-memory changes will be lost, so if previous changes are to be persisted, callstoreProperties()prior to performing the reload.
storeProperties
public void storeProperties()
throws java.io.IOException
- Stores the properties back into the file. The storage process will overwrite
all data that was in the properties file before the storeProperties was called.
|
|||||||||
| Home >> All >> com >> simscomputing >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.simscomputing.util.ApplicationProperties