@Test public void willReturnStoredValue_whenGivenDefault() { Object value = mAllOpts.retrieveOption(OPTION_1, VALUE_MISSING); assertThat(value).isSameInstanceAs(VALUE_1); }
@Override public <ValueT> ValueT retrieveOption(Option<ValueT> id) { ValueT value = retrieveOption(id, null); if (value == null) { throw new IllegalArgumentException("Option does not exist: " + id); } return value; }
OptionsBundle implements Config { @Override public <ValueT> ValueT retrieveOption(Option<ValueT> id) { ValueT value = retrieveOption(id, null); if (value == null) { throw new IllegalArgumentException("Option does not exist: " + id); } return value; } }
OptionsBundle implements Config { @Override public <ValueT> ValueT retrieveOption(Option<ValueT> id) { ValueT value = retrieveOption(id, null); if (value == null) { throw new IllegalArgumentException("Option does not exist: " + id); } return value; } OptionsBundle(TreeMap<Option<?>, Object> options); }
OptionsBundle implements Config { @Override public <ValueT> ValueT retrieveOption(Option<ValueT> id) { ValueT value = retrieveOption(id, null); if (value == null) { throw new IllegalArgumentException("Option does not exist: " + id); } return value; } OptionsBundle(TreeMap<Option<?>, Object> options); static OptionsBundle from(Config otherConfig); static OptionsBundle emptyBundle(); @Override Set<Option<?>> listOptions(); @Override boolean containsOption(Option<?> id); @Override ValueT retrieveOption(Option<ValueT> id); @Nullable @Override ValueT retrieveOption(Option<ValueT> id, @Nullable ValueT valueIfMissing); @Override void findOptions(String idStem, OptionMatcher matcher); }
OptionsBundle implements Config { @Override public <ValueT> ValueT retrieveOption(Option<ValueT> id) { ValueT value = retrieveOption(id, null); if (value == null) { throw new IllegalArgumentException("Option does not exist: " + id); } return value; } OptionsBundle(TreeMap<Option<?>, Object> options); static OptionsBundle from(Config otherConfig); static OptionsBundle emptyBundle(); @Override Set<Option<?>> listOptions(); @Override boolean containsOption(Option<?> id); @Override ValueT retrieveOption(Option<ValueT> id); @Nullable @Override ValueT retrieveOption(Option<ValueT> id, @Nullable ValueT valueIfMissing); @Override void findOptions(String idStem, OptionMatcher matcher);  }