public void clearProperties(Class<?> clazz) { Properties props = getProperties(); Properties newProps = new Properties(); for (Iterator<String> iter = CastUtils.cast(props.keySet().iterator()); iter.hasNext(); ) { String key = iter.next(); if (key.startsWith(clazz.getName())) { continue; } newProps.setProperty(key, props.getProperty(key)); } setProperties(newProps); }
public Properties getProperties(String prefix) { Properties rtn = new Properties(); Properties props = getProperties(); for (Iterator<String> iter = CastUtils.cast(props.keySet().iterator()); iter.hasNext(); ) { String key = iter.next(); if (key.startsWith(prefix)) { String s = key.substring(prefix.length() + 1); rtn.setProperty(s, props.getProperty(key)); } } return rtn; }