Add missing method to Properties

This commit is contained in:
Alexey Andreev 2017-11-19 14:36:38 +03:00
parent 980a2d9e97
commit fc4425d7f4
2 changed files with 25 additions and 1 deletions

View File

@ -331,7 +331,7 @@ public class TProperties extends THashtable<Object, Object> {
return selected.keys(); return selected.keys();
} }
private void selectProperties(THashtable<Object, Object> selected) { private void selectProperties(TMap<Object, Object> selected) {
if (defaults != null) { if (defaults != null) {
defaults.selectProperties(selected); defaults.selectProperties(selected);
} }
@ -398,4 +398,24 @@ public class TProperties extends THashtable<Object, Object> {
} }
writer.write("\n"); writer.write("\n");
} }
public TSet<String> stringPropertyNames() {
TSet<String> selected = new THashSet<>();
selectPropertyNames(selected);
return selected;
}
private void selectPropertyNames(TSet<String> selected) {
if (defaults != null) {
defaults.selectPropertyNames(selected);
}
TEnumeration<Object> e = keys();
while (e.hasMoreElements()) {
Object key = e.nextElement();
if (key instanceof String) {
selected.add((String) key);
}
}
}
} }

View File

@ -67,6 +67,7 @@ public class ClasspathResourceMapper implements Mapper<String, ClassHolder>, Cla
Map<String, Transformation> transformationMap = new HashMap<>(); Map<String, Transformation> transformationMap = new HashMap<>();
loadProperties(properties, transformationMap); loadProperties(properties, transformationMap);
transformations.addAll(transformationMap.values()); transformations.addAll(transformationMap.values());
renamer = new ClassRefsRenamer(new CachedMapper<>(classNameMapper));
} }
private void loadProperties(Properties properties, Map<String, Transformation> cache) { private void loadProperties(Properties properties, Map<String, Transformation> cache) {
@ -165,6 +166,9 @@ public class ClasspathResourceMapper implements Mapper<String, ClassHolder>, Cla
} }
private Date getOriginalModificationDate(String className) { private Date getOriginalModificationDate(String className) {
if (classLoader == null) {
return null;
}
URL url = classLoader.getResource(className.replace('.', '/') + ".class"); URL url = classLoader.getResource(className.replace('.', '/') + ".class");
if (url == null) { if (url == null) {
return null; return null;