mirror of
https://github.com/CarmJos/EasyConfiguration.git
synced 2026-06-05 02:58:20 +08:00
docs(readme): listed all supported formats.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package online.flowerinsnow.test.easyconfiguration;
|
||||
|
||||
import cc.carm.lib.configuration.EasyConfiguration;
|
||||
import cc.carm.lib.configuration.demo.tests.ConfigurationTest;
|
||||
import cc.carm.lib.configuration.hocon.HOCONFileConfigProvider;
|
||||
import online.flowerinsnow.test.easyconfiguration.config.SimpleConfig;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -11,12 +11,9 @@ public class HOCONTest {
|
||||
@Test
|
||||
public void onTest() {
|
||||
HOCONFileConfigProvider provider = EasyConfiguration.from(new File("target/hocon.conf"));
|
||||
provider.initialize(SimpleConfig.class);
|
||||
// provider.initialize(DatabaseConfiguration.class);
|
||||
|
||||
System.out.println(SimpleConfig.TEST_INT.getNotNull());
|
||||
SimpleConfig.TEST_INT.set((int) (Math.random() * 100 * 5));
|
||||
System.out.println(SimpleConfig.TEST_INT.getNotNull());
|
||||
ConfigurationTest.testDemo(provider);
|
||||
ConfigurationTest.testInner(provider);
|
||||
|
||||
try {
|
||||
provider.save();
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
package online.flowerinsnow.test.easyconfiguration.config;
|
||||
|
||||
import cc.carm.lib.configuration.core.Configuration;
|
||||
import cc.carm.lib.configuration.core.annotation.HeaderComment;
|
||||
import cc.carm.lib.configuration.core.value.type.ConfiguredList;
|
||||
import cc.carm.lib.configuration.core.value.type.ConfiguredValue;
|
||||
|
||||
public interface SimpleConfig extends Configuration {
|
||||
@HeaderComment("测试字段 int")
|
||||
ConfiguredValue<Integer> TEST_INT = ConfiguredValue.of(Integer.class, 15);
|
||||
|
||||
@HeaderComment("测试字段 List<String>")
|
||||
ConfiguredList<String> TEST_LIST_STRING = ConfiguredList.of(String.class, "li", "li", "li1");
|
||||
|
||||
@HeaderComment("测试对象")
|
||||
interface TestObject extends Configuration {
|
||||
|
||||
@HeaderComment("测试字段 Boolean")
|
||||
ConfiguredValue<Boolean> TEST_BOOLEAN = ConfiguredValue.of(Boolean.class, true);
|
||||
|
||||
@HeaderComment("inner")
|
||||
interface InnerObject extends Configuration {
|
||||
@HeaderComment("测试字段")
|
||||
public static final ConfiguredValue<Boolean> TEST_BOOLEAN_1 = ConfiguredValue.of(Boolean.class, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user