class SystemPropertiesConfiguration extends AbstractConfiguration implements Configuration {

  @Override
  public Configuration getSubconfiguration(final String key) {
    final String prefix = key + ".";
    final InMemoryConfiguration subconfiguration = new InMemoryConfiguration();

    Set<String> stringProperties = getProperties().stringPropertyNames();
    for (final String name : stringProperties) {
      if (name.startsWith(prefix)) {
        final String subname = name.substring(prefix.length());
        subconfiguration.define(subname, getProperty(name));
      }
    }
    return subconfiguration;
  }

}