|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object biz.chitec.quarterback.util.PropertiesConsolidator
Static helper class to consolidate several Properties objects into one and resort them again. Useful for storing the settings of several objects into one storage (anyone saying "registry"???). Example: Say you have several classes and everyone has its own settings. For some reason, you want to consolidate all the settings into one storage, e.g. for storing everything into one file or using it in a combined settings dialog. Then, simply do
Properties compound=PropertiesConsolidator.merge( new String[] {"fileopen","imagelib","general"}, new Properties[] {fileopener.getProps(),imagelib.getProps(),this.getProps()}, new Properties());
Target then will contain all the contents of the source bundles, with the keys being prepended by the
given prefix. E.g. a property selector.maxsize
in the fileopener properties will become
fileopen.selector.maxsize
in the combined bundle.
For dividing the compound bundle into the original parts and passing them back to the classes, do this:
Map props=PropertiesConsolidator(compound); fileopener.setProps(props.get("fileopen")); imagelib.setProps(props.get("imagelib")); this.setProps(props.get("general"));
Constructor Summary | |
private |
PropertiesConsolidator()
This is a fully static class |
Method Summary | |
static java.util.Map |
divide(java.util.Properties compound)
Divides a compound Properties bundle into original bundles. |
static java.util.Map |
divide(java.util.Set prefixes,
java.util.Properties compound)
Divides a compound Properties bundle into original bundles. |
static java.util.Map |
divide(java.lang.String[] prefix,
java.util.Properties compound)
Divides a compound Properties bundle into original bundles. |
static java.util.Map |
extract(java.lang.String prefix,
java.util.Properties compound)
Extract all values with one prefix out of the given compound bundle. |
static java.util.Properties |
merge(java.util.Map source)
Merges all Properties bundles in the given Map into new Properties bundle |
static java.util.Properties |
merge(java.util.Map source,
java.util.Properties target)
Merges all Properties bundles in the given Map into target Properties. |
static java.util.Properties |
merge(java.lang.String[] prefix,
java.util.Properties[] source)
Merges multiple Properties bundles into one which is freshly created. |
static java.util.Properties |
merge(java.lang.String[] prefix,
java.util.Properties[] source,
java.util.Properties target)
Merge multiple Properties bundles into one. |
static java.util.Properties |
merge(java.lang.String prefix,
java.util.Properties source,
java.util.Properties target)
Merge one Properties bundle into target. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
private PropertiesConsolidator()
Method Detail |
public static java.util.Properties merge(java.util.Map source, java.util.Properties target)
source
- Map with String-Properties entriestarget
- Properties bundle
public static java.util.Properties merge(java.util.Map source)
public static java.util.Properties merge(java.lang.String prefix, java.util.Properties source, java.util.Properties target)
prefix
- A prefix the bundle will havesource
- The source bundle with the key-value pairs to be mergedtarget
- The target bundle where the data will be stored in
public static java.util.Properties merge(java.lang.String[] prefix, java.util.Properties[] source, java.util.Properties target)
prefix
- A prefix the bundle will havesource
- The source bundle with the key-value pairs to be mergedtarget
- The target bundle where the data will be stored in
public static java.util.Properties merge(java.lang.String[] prefix, java.util.Properties[] source)
prefix
- The prefixes for mergingsource
- The source bundles which are merged in
public static java.util.Map divide(java.util.Set prefixes, java.util.Properties compound)
prefixes
- The prefixes to extract bundles forcompound
- The compound source for extraction
public static java.util.Map divide(java.lang.String[] prefix, java.util.Properties compound)
prefix
- Array of prefixes to extract forcompound
- The extraction source
public static java.util.Map divide(java.util.Properties compound)
compound
- The compound bundle
public static java.util.Map extract(java.lang.String prefix, java.util.Properties compound)
prefix
- The prefix of interestcompound
- The extraction source
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |