@Test public void test_admin_override_get_file_fallback() { Grandfather g10 = new Grandfather("g10"); g10.setProp1("g10"); admin.createObject(g10); Grandfather g = config.get("g10", Grandfather.class).get(); assertThat(g.getProp1(), is("g10")); }
@Override public <T> T get(Class<T> configurable) { doLookup(); Schema schema = schemaManager.getSchema(configurable); BeanId singleton = getSingletonId(schema, configurable); Optional<Bean> bean; try { if (configurable.getName().equals(RECURSION_SHORTCIRCUIT.get())) { bean = Optional.absent(); } else { RECURSION_SHORTCIRCUIT.set(configurable.getName()); bean = beanManager.getEager(singleton); } } finally { RECURSION_SHORTCIRCUIT.set(null); } if (!bean.isPresent()) { initFile(configurable); Bean fileBean = FILE_CONFIG.get(singleton); if (fileBean != null) { fileBean.set(schema); bean = Optional.of(fileBean); } if (bean.isPresent()) { T object = (T) schemaManager.convertBean(bean.get()); if (cacheManager.isPresent()) { cacheManager.get().put(bean.get()); } return object; } } if (!bean.isPresent()) { bean = Optional.of(Bean.create(BeanId.createSingleton(schema.getName()))); } schemaManager.setSchema(Arrays.asList(bean.get())); setSingletonReferences(bean.get()); T object = (T) schemaManager.convertBean(bean.get()); if (cacheManager.isPresent()) { cacheManager.get().put(bean.get()); } return object; }
ConfigCoreContext extends ConfigContext { @Override public <T> T get(Class<T> configurable) { doLookup(); Schema schema = schemaManager.getSchema(configurable); BeanId singleton = getSingletonId(schema, configurable); Optional<Bean> bean; try { if (configurable.getName().equals(RECURSION_SHORTCIRCUIT.get())) { bean = Optional.absent(); } else { RECURSION_SHORTCIRCUIT.set(configurable.getName()); bean = beanManager.getEager(singleton); } } finally { RECURSION_SHORTCIRCUIT.set(null); } if (!bean.isPresent()) { initFile(configurable); Bean fileBean = FILE_CONFIG.get(singleton); if (fileBean != null) { fileBean.set(schema); bean = Optional.of(fileBean); } if (bean.isPresent()) { T object = (T) schemaManager.convertBean(bean.get()); if (cacheManager.isPresent()) { cacheManager.get().put(bean.get()); } return object; } } if (!bean.isPresent()) { bean = Optional.of(Bean.create(BeanId.createSingleton(schema.getName()))); } schemaManager.setSchema(Arrays.asList(bean.get())); setSingletonReferences(bean.get()); T object = (T) schemaManager.convertBean(bean.get()); if (cacheManager.isPresent()) { cacheManager.get().put(bean.get()); } return object; } }
ConfigCoreContext extends ConfigContext { @Override public <T> T get(Class<T> configurable) { doLookup(); Schema schema = schemaManager.getSchema(configurable); BeanId singleton = getSingletonId(schema, configurable); Optional<Bean> bean; try { if (configurable.getName().equals(RECURSION_SHORTCIRCUIT.get())) { bean = Optional.absent(); } else { RECURSION_SHORTCIRCUIT.set(configurable.getName()); bean = beanManager.getEager(singleton); } } finally { RECURSION_SHORTCIRCUIT.set(null); } if (!bean.isPresent()) { initFile(configurable); Bean fileBean = FILE_CONFIG.get(singleton); if (fileBean != null) { fileBean.set(schema); bean = Optional.of(fileBean); } if (bean.isPresent()) { T object = (T) schemaManager.convertBean(bean.get()); if (cacheManager.isPresent()) { cacheManager.get().put(bean.get()); } return object; } } if (!bean.isPresent()) { bean = Optional.of(Bean.create(BeanId.createSingleton(schema.getName()))); } schemaManager.setSchema(Arrays.asList(bean.get())); setSingletonReferences(bean.get()); T object = (T) schemaManager.convertBean(bean.get()); if (cacheManager.isPresent()) { cacheManager.get().put(bean.get()); } return object; }  }
ConfigCoreContext extends ConfigContext { @Override public <T> T get(Class<T> configurable) { doLookup(); Schema schema = schemaManager.getSchema(configurable); BeanId singleton = getSingletonId(schema, configurable); Optional<Bean> bean; try { if (configurable.getName().equals(RECURSION_SHORTCIRCUIT.get())) { bean = Optional.absent(); } else { RECURSION_SHORTCIRCUIT.set(configurable.getName()); bean = beanManager.getEager(singleton); } } finally { RECURSION_SHORTCIRCUIT.set(null); } if (!bean.isPresent()) { initFile(configurable); Bean fileBean = FILE_CONFIG.get(singleton); if (fileBean != null) { fileBean.set(schema); bean = Optional.of(fileBean); } if (bean.isPresent()) { T object = (T) schemaManager.convertBean(bean.get()); if (cacheManager.isPresent()) { cacheManager.get().put(bean.get()); } return object; } } if (!bean.isPresent()) { bean = Optional.of(Bean.create(BeanId.createSingleton(schema.getName()))); } schemaManager.setSchema(Arrays.asList(bean.get())); setSingletonReferences(bean.get()); T object = (T) schemaManager.convertBean(bean.get()); if (cacheManager.isPresent()) { cacheManager.get().put(bean.get()); } return object; }  @Override void register(Class<?>... configurable); @Override void unregister(Class<?>... configurable); @Override T get(Class<T> configurable); @Override List<T> list(Class<T> configurable); @Override Optional<T> get(String id, Class<T> configurable); @Override ConfigQuery<T> newQuery(Class<T> configurable); @Override void registerObserver(ConfigObserver observer); void doLookup(); }
ConfigCoreContext extends ConfigContext { @Override public <T> T get(Class<T> configurable) { doLookup(); Schema schema = schemaManager.getSchema(configurable); BeanId singleton = getSingletonId(schema, configurable); Optional<Bean> bean; try { if (configurable.getName().equals(RECURSION_SHORTCIRCUIT.get())) { bean = Optional.absent(); } else { RECURSION_SHORTCIRCUIT.set(configurable.getName()); bean = beanManager.getEager(singleton); } } finally { RECURSION_SHORTCIRCUIT.set(null); } if (!bean.isPresent()) { initFile(configurable); Bean fileBean = FILE_CONFIG.get(singleton); if (fileBean != null) { fileBean.set(schema); bean = Optional.of(fileBean); } if (bean.isPresent()) { T object = (T) schemaManager.convertBean(bean.get()); if (cacheManager.isPresent()) { cacheManager.get().put(bean.get()); } return object; } } if (!bean.isPresent()) { bean = Optional.of(Bean.create(BeanId.createSingleton(schema.getName()))); } schemaManager.setSchema(Arrays.asList(bean.get())); setSingletonReferences(bean.get()); T object = (T) schemaManager.convertBean(bean.get()); if (cacheManager.isPresent()) { cacheManager.get().put(bean.get()); } return object; }  @Override void register(Class<?>... configurable); @Override void unregister(Class<?>... configurable); @Override T get(Class<T> configurable); @Override List<T> list(Class<T> configurable); @Override Optional<T> get(String id, Class<T> configurable); @Override ConfigQuery<T> newQuery(Class<T> configurable); @Override void registerObserver(ConfigObserver observer); void doLookup();  }