Implement propertyNames in the Properties object returned by

getFilteredProperties so that it works with getSubProperties.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2283 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
andrzej
2008-03-27 20:01:20 +00:00
parent 3dce990f2b
commit 024932d4c4
@@ -121,6 +121,33 @@ public class PropertiesUtil
return source.getProperty(dprefix + key, return source.getProperty(dprefix + key,
source.getProperty(key, defaultValue)); source.getProperty(key, defaultValue));
} }
public Enumeration propertyNames () {
return new Enumeration() {
public boolean hasMoreElements () {
return next != null;
}
public Object nextElement () {
Object onext = next;
next = findNext();
return onext;
}
protected Object findNext () {
while (senum.hasMoreElements()) {
String name = (String)senum.nextElement();
if (!name.startsWith(dprefix)) {
return name;
}
name = name.substring(dprefix.length());
if (!source.containsKey(name)) {
return name;
}
}
return null;
}
protected Enumeration senum = source.propertyNames();
protected Object next = findNext();
};
}
}; };
} }