| java.lang.Object net.suberic.util.VariableBundle
VariableBundle | public class VariableBundle extends Object (Code) | | VariableBundle is a combination of a Properties object, a ResourceBundle
object, and (optionally) a second Properties object to act as the 'parent'
properties. This allows both for a single point of reference for
variables, as well as the ability to do hierarchical lookups with the
parent (see getProperty() for an example).
The order of lookup is as follows: Local properties are checked first,
then parent properties, and then finally (if the value is not found in
any properties) the ResourceBundle is checked.
|
Method Summary | |
public void | addValueChangeListener(ValueChangeListener vcl, String property) This adds the ValueChangeListener to listen for changes in the
given property. | public void | clearRemoveList() Clears the removeList. | protected void | configure(InputStream propertiesFile, String resourceFile, VariableBundle newParentProperties) Configures the VariableBundle. | public static List | convertToList(String value) Converts a value which has multiple values separated by a ':' (colon)
to a java.util.List. | public static String | convertToString(List pValue) Converts a List of Strings to a colon-delimited String. | public static Vector | convertToVector(String value) Converts a value which has multiple values separated by a ':' (colon)
to a java.util.Vector. | public String | escapeWhiteSpace(String sourceString) Escapes whitespace in a string by putting a '\' in front of each
whitespace character. | public void | fireValueChanged(String changedValue) This notifies all registered listeners for changedValue that its
value has changed. | public Map | getAllListeners() Returns all of the ValueChangeListeners registered. | public VariableBundle | getParentProperties() | public Properties | getProperties() | public String | getProperty(String key, String defaultValue) | public String | getProperty(String key) | public Enumeration | getPropertyAsEnumeration(String propertyName, String defaultValue) Returns a property which has multiple values separated by a ':' (colon)
as a java.util.Enumeration. | public List | getPropertyAsList(String propertyName, String defaultValue) Converts the given property value to a List using the convertToList
call. | public Vector | getPropertyAsVector(String propertyName, String defaultValue) Converts the given property value to a Vector using the convertToVector
call. | public ResourceBundle | getResources() | public File | getSaveFile() Returns the current saveFile. | public Properties | getWritableProperties() | public boolean | propertyIsRemoved(String prop) Returns true if the property is in the removeList for this
VariableBundle. | public void | removeProperty(String remProp) This removes the property from the currently VariableBundle. | public void | removeValueChangeListener(ValueChangeListener vcl) This removes the given ValueChangeListener for all the values that
it's listening to. | public void | removeValueChangeListener(ValueChangeListener vcl, String property) This removes the given ValueChangeListener from listening on the
given property. | public void | saveProperties() Saves the current properties in the VariableBundle to a file. | public void | saveProperties(File pSaveFile) Saves the current properties in the VariableBundle to a file. | public void | setProperties(Properties newProperties) | public void | setProperty(String propertyName, String propertyValue) | public void | setProperty(String propertyName, String propertyValue, boolean temporary) sets a property as temporary (so it won't be saved). | public void | setResourceBundle(ResourceBundle newResources) | public void | setSaveFile(File newFile) Sets the save file. | public String | unEscapeString(String sourceString) resolves a whitespace-escaped string. | public void | unRemoveProperty(String unRemProp) Removes a property from the removeList. |
addValueChangeListener | public void addValueChangeListener(ValueChangeListener vcl, String property)(Code) | | This adds the ValueChangeListener to listen for changes in the
given property.
|
clearRemoveList | public void clearRemoveList()(Code) | | Clears the removeList. This should generally be called after
you do a writeProperties();
|
convertToList | public static List convertToList(String value)(Code) | | Converts a value which has multiple values separated by a ':' (colon)
to a java.util.List.
|
convertToString | public static String convertToString(List pValue)(Code) | | Converts a List of Strings to a colon-delimited String.
|
convertToVector | public static Vector convertToVector(String value)(Code) | | Converts a value which has multiple values separated by a ':' (colon)
to a java.util.Vector.
|
escapeWhiteSpace | public String escapeWhiteSpace(String sourceString)(Code) | | Escapes whitespace in a string by putting a '\' in front of each
whitespace character.
|
fireValueChanged | public void fireValueChanged(String changedValue)(Code) | | This notifies all registered listeners for changedValue that its
value has changed.
|
getAllListeners | public Map getAllListeners()(Code) | | Returns all of the ValueChangeListeners registered.
|
getPropertyAsEnumeration | public Enumeration getPropertyAsEnumeration(String propertyName, String defaultValue)(Code) | | Returns a property which has multiple values separated by a ':' (colon)
as a java.util.Enumeration.
|
getPropertyAsList | public List getPropertyAsList(String propertyName, String defaultValue)(Code) | | Converts the given property value to a List using the convertToList
call.
|
getPropertyAsVector | public Vector getPropertyAsVector(String propertyName, String defaultValue)(Code) | | Converts the given property value to a Vector using the convertToVector
call.
|
getSaveFile | public File getSaveFile()(Code) | | Returns the current saveFile.
|
propertyIsRemoved | public boolean propertyIsRemoved(String prop)(Code) | | Returns true if the property is in the removeList for this
VariableBundle.
|
removeProperty | public void removeProperty(String remProp)(Code) | | This removes the property from the currently VariableBundle. This
is different than setting the value to "" (or null) in that, if the
property is removed, it is removed from the source property file.
|
removeValueChangeListener | public void removeValueChangeListener(ValueChangeListener vcl)(Code) | | This removes the given ValueChangeListener for all the values that
it's listening to.
|
removeValueChangeListener | public void removeValueChangeListener(ValueChangeListener vcl, String property)(Code) | | This removes the given ValueChangeListener from listening on the
given property.
|
saveProperties | public void saveProperties()(Code) | | Saves the current properties in the VariableBundle to a file. Note
that this only saves the writableProperties of this particular
VariableBundle--underlying defaults are not written.
|
saveProperties | public void saveProperties(File pSaveFile)(Code) | | Saves the current properties in the VariableBundle to a file. Note
that this only saves the writableProperties of this particular
VariableBundle--underlying defaults are not written.
|
setProperty | public void setProperty(String propertyName, String propertyValue, boolean temporary)(Code) | | sets a property as temporary (so it won't be saved).
|
setSaveFile | public void setSaveFile(File newFile)(Code) | | Sets the save file.
|
unEscapeString | public String unEscapeString(String sourceString)(Code) | | resolves a whitespace-escaped string.
|
unRemoveProperty | public void unRemoveProperty(String unRemProp)(Code) | | Removes a property from the removeList. Only necessary if a property
had been removed since the last save, and now has been set to a new
value. It's probably a good idea, though, to call this method any
time a property has its value set.
|
|
|