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:
@@ -121,6 +121,33 @@ public class PropertiesUtil
|
||||
return source.getProperty(dprefix + key,
|
||||
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();
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user