@Test public void test_list_file_fallback() throws Exception { List<Grandfather> grandfathers = config.list(Grandfather.class); assertThat(grandfathers.size(), is(3)); for (Grandfather g : grandfathers) { if (g.getBeanId().equals("g10")) { assertGrandfather10(g); } } }
@Override public <T> List<T> list(Class<T> configurable) { doLookup(); Schema s = schemaManager.getSchema(configurable); initFile(configurable); Map<BeanId, Bean> beans = new HashMap<>(); Map<BeanId, Bean> found = beanManager.list(s.getName()); if (found.isEmpty()) { for (Bean bean : FILE_CONFIG.values()) { if (bean.getId().getSchemaName().equals(s.getName())) { beans.put(bean.getId(), bean); } } } for (Bean foundBean : found.values()) { beans.put(foundBean.getId(), foundBean); } schemaManager.setSchema(beans.values()); for (Bean bean : beans.values()) { setSingletonReferences(bean); if (cacheManager.isPresent()) { cacheManager.get().put(bean); } } ArrayList<T> objects = new ArrayList<>(); for(Object object : schemaManager.convertBeans(beans.values())) { objects.add((T) object); } return objects; }
ConfigCoreContext extends ConfigContext { @Override public <T> List<T> list(Class<T> configurable) { doLookup(); Schema s = schemaManager.getSchema(configurable); initFile(configurable); Map<BeanId, Bean> beans = new HashMap<>(); Map<BeanId, Bean> found = beanManager.list(s.getName()); if (found.isEmpty()) { for (Bean bean : FILE_CONFIG.values()) { if (bean.getId().getSchemaName().equals(s.getName())) { beans.put(bean.getId(), bean); } } } for (Bean foundBean : found.values()) { beans.put(foundBean.getId(), foundBean); } schemaManager.setSchema(beans.values()); for (Bean bean : beans.values()) { setSingletonReferences(bean); if (cacheManager.isPresent()) { cacheManager.get().put(bean); } } ArrayList<T> objects = new ArrayList<>(); for(Object object : schemaManager.convertBeans(beans.values())) { objects.add((T) object); } return objects; } }
ConfigCoreContext extends ConfigContext { @Override public <T> List<T> list(Class<T> configurable) { doLookup(); Schema s = schemaManager.getSchema(configurable); initFile(configurable); Map<BeanId, Bean> beans = new HashMap<>(); Map<BeanId, Bean> found = beanManager.list(s.getName()); if (found.isEmpty()) { for (Bean bean : FILE_CONFIG.values()) { if (bean.getId().getSchemaName().equals(s.getName())) { beans.put(bean.getId(), bean); } } } for (Bean foundBean : found.values()) { beans.put(foundBean.getId(), foundBean); } schemaManager.setSchema(beans.values()); for (Bean bean : beans.values()) { setSingletonReferences(bean); if (cacheManager.isPresent()) { cacheManager.get().put(bean); } } ArrayList<T> objects = new ArrayList<>(); for(Object object : schemaManager.convertBeans(beans.values())) { objects.add((T) object); } return objects; }  }
ConfigCoreContext extends ConfigContext { @Override public <T> List<T> list(Class<T> configurable) { doLookup(); Schema s = schemaManager.getSchema(configurable); initFile(configurable); Map<BeanId, Bean> beans = new HashMap<>(); Map<BeanId, Bean> found = beanManager.list(s.getName()); if (found.isEmpty()) { for (Bean bean : FILE_CONFIG.values()) { if (bean.getId().getSchemaName().equals(s.getName())) { beans.put(bean.getId(), bean); } } } for (Bean foundBean : found.values()) { beans.put(foundBean.getId(), foundBean); } schemaManager.setSchema(beans.values()); for (Bean bean : beans.values()) { setSingletonReferences(bean); if (cacheManager.isPresent()) { cacheManager.get().put(bean); } } ArrayList<T> objects = new ArrayList<>(); for(Object object : schemaManager.convertBeans(beans.values())) { objects.add((T) object); } return objects; }  @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> List<T> list(Class<T> configurable) { doLookup(); Schema s = schemaManager.getSchema(configurable); initFile(configurable); Map<BeanId, Bean> beans = new HashMap<>(); Map<BeanId, Bean> found = beanManager.list(s.getName()); if (found.isEmpty()) { for (Bean bean : FILE_CONFIG.values()) { if (bean.getId().getSchemaName().equals(s.getName())) { beans.put(bean.getId(), bean); } } } for (Bean foundBean : found.values()) { beans.put(foundBean.getId(), foundBean); } schemaManager.setSchema(beans.values()); for (Bean bean : beans.values()) { setSingletonReferences(bean); if (cacheManager.isPresent()) { cacheManager.get().put(bean); } } ArrayList<T> objects = new ArrayList<>(); for(Object object : schemaManager.convertBeans(beans.values())) { objects.add((T) object); } return objects; }  @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();  }