@Test public void getDefaultBooleanProperty() throws Exception { when(api.getBoolean(anyString())).thenThrow(new ConfigException.BadPath("", "")); assertThat(config.get(new BooleanProperty("a", false))).isFalse(); }
@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);  }