|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Dictionary<K,V> java.util.Hashtable<java.lang.Object,java.lang.Object> java.util.Properties mk.fsgrep.util.PersistentData
public class PersistentData
A simple persistent data store using the Java Properties framework. This gives crude support for collection storage by key prefix identification.
Field Summary | |
---|---|
protected static java.io.File |
DATA_FILE
The file where this object is persisted. |
Fields inherited from class java.util.Properties |
---|
defaults |
Constructor Summary | |
---|---|
protected |
PersistentData()
The default constructor loads the file. |
Method Summary | |
---|---|
boolean |
getBooleanProperty(java.lang.String key)
Lookup the value for the given key and convert it to a boolean. |
static PersistentData |
getInstance()
|
java.util.Collection<java.lang.String> |
getKeysPrefixed(java.lang.String prefix)
Return the sorted set of all keys that have the give prefix. |
protected void |
load()
Read the data file to populate this object. |
void |
put(java.lang.String prefix,
int index,
java.lang.String value)
Save the key/value mapping where the key is a prefix/index. |
void |
removeKeysPrefixed(java.lang.String prefix)
Remove all keys that have the give prefix. |
void |
store()
Save this objects values to the file. |
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, rehash, remove, size, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final java.io.File DATA_FILE
Constructor Detail |
---|
protected PersistentData()
Method Detail |
---|
public static PersistentData getInstance()
protected void load()
public boolean getBooleanProperty(java.lang.String key)
key
- The association key.
public void store()
public java.util.Collection<java.lang.String> getKeysPrefixed(java.lang.String prefix)
prefix
- The string begining of the keys to be extracted.
public void removeKeysPrefixed(java.lang.String prefix)
prefix
- The string begining of the keys to be removed.public void put(java.lang.String prefix, int index, java.lang.String value)
prefix
- The key prefix.index
- The index (numeric) part of the key.value
- The value associated with the key.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |