*
* @return the subset of properties found. The keys are stripped from their
* prefix. The returned keys are returned in alphabetical order.
*/
public Map getPropertiesStartingWith(String prefix) {
TreeMap map = new TreeMap();
synchronized (this.properties) {
Enumeration iter = this.properties.keys();
while (iter.hasMoreElements()) {
String key = ((String)iter.nextElement()).trim();
if (prefix == null || key.startsWith(prefix)) {
Object val = this.properties.get(key);
if (prefix != null)
key = key.substring(prefix.length());
map.put(key, val);
}
}
}
synchronized (this.propMap) {
Iterator iter = this.propMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = ((Map.Entry)iter.next());
String key = (String)entry.getKey();
Object val = entry.getValue();
if (prefix == null || key.startsWith(prefix)) {
if (prefix != null)
key = key.substring(prefix.length());
map.put(key, val);
}
}
}
return map;