@Test void writeConfigurationWithDocumentationToToml() throws Exception { SchemaBuilder builder = SchemaBuilder.create(); builder.documentProperty("deepmap", "This table will have sub-tables"); builder.documentProperty("boo.baz", "A list of longs"); builder.documentProperty("bar", "Lucky number 13"); Schema schema = builder.toSchema(); Configuration config = Configuration.fromToml( ("foo = \"12\"\n" + "bar = 13\n" + "foobar = 156.34\n" + "amaps = [{a = 1, b = 2}, {a = 'hello'}]\n" + "\n" + "[boo]\n" + "baz=[1,2,3]\n" + "\n" + "[amap]\n" + "a=1\n" + "b=2\n" + "[deepmap]\n" + "' a' = 4\n" + "[deepmap.' deep']\n" + "'' = 'emptykey'\n" + "[deepmap.deeper]\n" + "farewell='goodbye'\n").replace("\n", System.lineSeparator()), schema); String expected = ("amaps = [{a = 1, b = 2}, {a = \"hello\"}]\n" + "## Lucky number 13\n" + "bar = 13\n" + "foo = \"12\"\n" + "foobar = 156.34\n" + "\n" + "[amap]\n" + "a = 1\n" + "b = 2\n" + "\n" + "[boo]\n" + "## A list of longs\n" + "baz = [1, 2, 3]\n" + "\n" + "## This table will have sub-tables\n" + "[deepmap]\n" + "\" a\" = 4\n" + "\n" + "[deepmap.\" deep\"]\n" + "\"\" = \"emptykey\"\n" + "\n" + "[deepmap.deeper]\n" + "farewell = \"goodbye\"\n").replace("\n", System.lineSeparator()); assertEquals(expected, 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);  }