@Test void writeConfigurationToTomlIncludesDefaults() throws Exception { SchemaBuilder builder = SchemaBuilder.create(); builder.addString("farewell", "goodbye", "a farewell", null); builder.addInteger("xxx", 10, "documentation\n over multiple lines!", null); builder.addInteger("zzz", 10, null, null); Schema schema = builder.toSchema(); Configuration config = Configuration.fromToml( "foo = \"12\"\n" + "foobar = 156.34\n" + "xxx = 10\n" + "zzz = 5\n" + "\n" + "[boo]\n" + "baz=[1,2,3]\n" + "\n", schema); String expected = "## a farewell\n" + "#farewell = \"goodbye\"\n" + "foo = \"12\"\n" + "foobar = 156.34\n" + "## documentation\n" + "## over multiple lines!\n" + "#xxx = 10\n" + "#zzz = 10\n" + "zzz = 5\n" + "\n" + "[boo]\n" + "baz = [1, 2, 3]\n"; assertEquals(expected.replace("\n", System.lineSeparator()), config.toToml()); }
@Override public void toToml(Appendable appendable) throws IOException { new TomlSerializer(this, schema).writeTo(appendable); }
TomlBackedConfiguration implements Configuration { @Override public void toToml(Appendable appendable) throws IOException { new TomlSerializer(this, schema).writeTo(appendable); } }
TomlBackedConfiguration implements Configuration { @Override public void toToml(Appendable appendable) throws IOException { new TomlSerializer(this, schema).writeTo(appendable); } TomlBackedConfiguration(TomlParseResult toml, @Nullable Schema schema); }
TomlBackedConfiguration implements Configuration { @Override public void toToml(Appendable appendable) throws IOException { new TomlSerializer(this, schema).writeTo(appendable); } TomlBackedConfiguration(TomlParseResult toml, @Nullable Schema schema); @Override List<ConfigurationError> errors(); @Override void toToml(Appendable appendable); @Override Set<String> keySet(); @Override boolean contains(String key); @Nullable @Override Object get(String key); @Nullable @Override DocumentPosition inputPositionOf(String key); @Override String getString(String key); @Override int getInteger(String key); @Override long getLong(String key); @Override double getDouble(String key); @Override boolean getBoolean(String key); @Override Map<String, Object> getMap(String key); @Override List<Object> getList(String key); @Override List<String> getListOfString(String key); @Override List<Integer> getListOfInteger(String key); @Override List<Long> getListOfLong(String key); @Override List<Double> getListOfDouble(String key); @Override List<Boolean> getListOfBoolean(String key); @Override List<Map<String, Object>> getListOfMap(String key); }
TomlBackedConfiguration implements Configuration { @Override public void toToml(Appendable appendable) throws IOException { new TomlSerializer(this, schema).writeTo(appendable); } TomlBackedConfiguration(TomlParseResult toml, @Nullable Schema schema); @Override List<ConfigurationError> errors(); @Override void toToml(Appendable appendable); @Override Set<String> keySet(); @Override boolean contains(String key); @Nullable @Override Object get(String key); @Nullable @Override DocumentPosition inputPositionOf(String key); @Override String getString(String key); @Override int getInteger(String key); @Override long getLong(String key); @Override double getDouble(String key); @Override boolean getBoolean(String key); @Override Map<String, Object> getMap(String key); @Override List<Object> getList(String key); @Override List<String> getListOfString(String key); @Override List<Integer> getListOfInteger(String key); @Override List<Long> getListOfLong(String key); @Override List<Double> getListOfDouble(String key); @Override List<Boolean> getListOfBoolean(String key); @Override List<Map<String, Object>> getListOfMap(String key);  }