@Test public void getBooleanListProperty() throws Exception { List<Boolean> list = Lists.newArrayList(false, true); when(api.getBooleanList("a")).thenReturn(list); assertThat(config.get(new ListProperty<>(Boolean.class, "a", Lists.emptyList()))) .isEqualTo(list); }
@Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value = property instanceof ListProperty ? getList((ListProperty) property) : getValue(key, type); if (value == null) { return defaultValue; } return property.map((T) value); }
LightbendConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value = property instanceof ListProperty ? getList((ListProperty) property) : getValue(key, type); if (value == null) { return defaultValue; } return property.map((T) value); } }
LightbendConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value = property instanceof ListProperty ? getList((ListProperty) property) : getValue(key, type); if (value == null) { return defaultValue; } return property.map((T) value); } LightbendConfiguration(Config api); }
LightbendConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value = property instanceof ListProperty ? getList((ListProperty) property) : getValue(key, type); if (value == null) { return defaultValue; } return property.map((T) value); } LightbendConfiguration(Config api); @Override @SuppressWarnings("unchecked") T get(Property<T> property, T defaultValue); @Override boolean exists(Property<?> property); }
LightbendConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value = property instanceof ListProperty ? getList((ListProperty) property) : getValue(key, type); if (value == null) { return defaultValue; } return property.map((T) value); } LightbendConfiguration(Config api); @Override @SuppressWarnings("unchecked") T get(Property<T> property, T defaultValue); @Override boolean exists(Property<?> property);  }