Пример #1
0
 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);
 }
Пример #2
0
  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;
  }