Skip to content

Commit

Permalink
修复路径截取错误导致无法拥有内部object类型的问题 (#38)
Browse files Browse the repository at this point in the history
* 修复路径截取错误导致无法拥有内部object类型的问题

* 移除测试输出
  • Loading branch information
flowerinsnowdh authored Jul 10, 2023
1 parent eee4a27 commit e4435bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static HOCONConfigWrapper getObjectOn(@NotNull HOCONConfigWrapper parent,
currentObject = new HOCONConfigWrapper(ConfigFactory.empty().root());
previousObject.setDirect(pathName, currentObject);
}
currentPath = currentPath.substring(0, index);
currentPath = currentPath.substring(index + 1);
}

return currentObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package online.flowerinsnow.test.easyconfiguration;

import cc.carm.lib.configuration.EasyConfiguration;
import cc.carm.lib.configuration.demo.DatabaseConfiguration;
import cc.carm.lib.configuration.demo.tests.conf.DemoConfiguration;
//import cc.carm.lib.configuration.demo.DatabaseConfiguration;
//import cc.carm.lib.configuration.demo.tests.conf.DemoConfiguration;
import cc.carm.lib.configuration.hocon.HOCONFileConfigProvider;
import online.flowerinsnow.test.easyconfiguration.config.Config;
import org.junit.Test;
Expand All @@ -14,13 +14,11 @@ public class HOCONTest {
public void onTest() {
HOCONFileConfigProvider provider = EasyConfiguration.from(new File("target/hocon.conf"));
provider.initialize(Config.class);
provider.initialize(DatabaseConfiguration.class);
// provider.initialize(DatabaseConfiguration.class);
try {
provider.reload();
} catch (Exception e) {
e.printStackTrace();
}

System.out.println("Config.TestObject.TEST_BOOLEAN.getNotNull() = " + Config.TestObject.TEST_BOOLEAN.getNotNull());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@ public class Config extends ConfigurationRoot {
public static class TestObject extends ConfigurationRoot {
@HeaderComment("测试字段 Boolean")
public static final ConfiguredValue<Boolean> TEST_BOOLEAN = ConfiguredValue.of(Boolean.class, true);
@HeaderComment("inner")
public static class InnerObject extends ConfigurationRoot {
@HeaderComment("测试字段")
public static final ConfiguredValue<Boolean> TEST_BOOLEAN_1 = ConfiguredValue.of(Boolean.class, true);
}
}
}

0 comments on commit e4435bf

Please sign in to comment.