GUAC-340: Add filterValues() function for convenience.

This commit is contained in:
Michael Jumper
2015-01-06 03:59:07 -08:00
parent 3b3b6b6955
commit 49ba38b20a
2 changed files with 65 additions and 1 deletions

View File

@@ -209,5 +209,26 @@ public class TokenFilter {
return output.toString();
}
/**
* Given an arbitrary map containing String values, replace each non-null
* value with the corresponding filtered value.
*
* @param map
* The map whose values should be filtered.
*/
public void filterValues(Map<?, String> map) {
// For each map entry
for (Map.Entry<?, String> entry : map.entrySet()) {
// If value is non-null, filter value through this TokenFilter
String value = entry.getValue();
if (value != null)
entry.setValue(filter(value));
}
}
}