@Test public void testCreate() { final String key = randomUUID().toString(); final String v1 = randomUUID().toString(); final String v2 = randomUUID().toString(); InMemoryConfiguration conf1 = new InMemoryConfiguration(); conf1.define(key, v1); InMemoryConfiguration conf2 = new InMemoryConfiguration(); conf1.define(key, v2); Configuration conf = HierachicalConfiguration.create(conf1, conf2); assertEquals(v2, conf.get(key)); }
public static Configuration create(final Configuration... configurations) { int i = 0; while (i < configurations.length && null == configurations[i]) { ++i; } if (i >= configurations.length) { return new DummyConfiguration(); } Configuration hirarchicalConf = configurations[i]; while (i < configurations.length) { if (null != configurations[i]) { hirarchicalConf = new HierachicalConfiguration(hirarchicalConf, configurations[i]); } ++i; } return hirarchicalConf; }
HierachicalConfiguration extends AbstractConfiguration { public static Configuration create(final Configuration... configurations) { int i = 0; while (i < configurations.length && null == configurations[i]) { ++i; } if (i >= configurations.length) { return new DummyConfiguration(); } Configuration hirarchicalConf = configurations[i]; while (i < configurations.length) { if (null != configurations[i]) { hirarchicalConf = new HierachicalConfiguration(hirarchicalConf, configurations[i]); } ++i; } return hirarchicalConf; } }
HierachicalConfiguration extends AbstractConfiguration { public static Configuration create(final Configuration... configurations) { int i = 0; while (i < configurations.length && null == configurations[i]) { ++i; } if (i >= configurations.length) { return new DummyConfiguration(); } Configuration hirarchicalConf = configurations[i]; while (i < configurations.length) { if (null != configurations[i]) { hirarchicalConf = new HierachicalConfiguration(hirarchicalConf, configurations[i]); } ++i; } return hirarchicalConf; } HierachicalConfiguration(final Configuration configuration); }
HierachicalConfiguration extends AbstractConfiguration { public static Configuration create(final Configuration... configurations) { int i = 0; while (i < configurations.length && null == configurations[i]) { ++i; } if (i >= configurations.length) { return new DummyConfiguration(); } Configuration hirarchicalConf = configurations[i]; while (i < configurations.length) { if (null != configurations[i]) { hirarchicalConf = new HierachicalConfiguration(hirarchicalConf, configurations[i]); } ++i; } return hirarchicalConf; } HierachicalConfiguration(final Configuration configuration); static Configuration create(final Configuration... configurations); @Override Configuration getSubconfiguration(final String key); @Override Object getValue(final String key); @Override Map<String, Object> asMap(); @Override void define(final String key, final Object value); @Override void remove(String key); }
HierachicalConfiguration extends AbstractConfiguration { public static Configuration create(final Configuration... configurations) { int i = 0; while (i < configurations.length && null == configurations[i]) { ++i; } if (i >= configurations.length) { return new DummyConfiguration(); } Configuration hirarchicalConf = configurations[i]; while (i < configurations.length) { if (null != configurations[i]) { hirarchicalConf = new HierachicalConfiguration(hirarchicalConf, configurations[i]); } ++i; } return hirarchicalConf; } HierachicalConfiguration(final Configuration configuration); static Configuration create(final Configuration... configurations); @Override Configuration getSubconfiguration(final String key); @Override Object getValue(final String key); @Override Map<String, Object> asMap(); @Override void define(final String key, final Object value); @Override void remove(String key);  }