|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<Object,Object>
java.util.Properties
util.EnsureProperties
public class EnsureProperties
An extension to the classical Properties object. This class
circumvents the clumsy implementation of assigning non-defined keys default
values in the parent class with an other implemntation. If the method
ensurePropertySet(java.lang.String, java.lang.String) is called prior to a querry for a certain key
the default value is returned unless the key was not present in the
original Properties.
Additionally a direct construction of the properties from a file is allowed. Note that an IllegalArgumentException is thrown if the properties cannot be constructed from the given file name.
| Field Summary |
|---|
| Fields inherited from class java.util.Properties |
|---|
defaults |
| Constructor Summary | |
|---|---|
EnsureProperties()
Calls the superclass-constructor. |
|
EnsureProperties(File infile)
Reads the properties from the given file. |
|
EnsureProperties(Properties def)
Calls the superclass-constructor. |
|
| Method Summary | |
|---|---|
static Properties |
augment(Properties which,
Properties by)
Augments the first argumental properties with all the properties found in the second argument. |
boolean |
ensurePropertySet(String key,
String def)
Ensures that a property with the specified key is present in the properties. |
| Methods inherited from class java.util.Properties |
|---|
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames |
| 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 |
| Constructor Detail |
|---|
public EnsureProperties()
public EnsureProperties(Properties def)
public EnsureProperties(File infile)
| Method Detail |
|---|
public boolean ensurePropertySet(String key,
String def)
key - The key to ensure is mapped to a value in the properties.def - The default value to add if the key is not mapped.
public static Properties augment(Properties which,
Properties by)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||