1
mirror of https://github.com/CarmJos/EasyConfiguration.git synced 2026-06-04 18:48:20 +08:00

Compare commits

...

4 Commits

Author SHA1 Message Date
carm 5f89ff4db7 Merge remote-tracking branch 'origin/master' 2022-05-20 18:18:47 +08:00
carm d6f4970277 [3.1.0] fix(api): configuration reload problem
BREAKING CHANGES: Now we override "onReload()" method to define ConfigurationProvider how to reload the configs.

Fix the problem that when the configuration file is read, the "reload()" method not working.
2022-05-20 18:16:44 +08:00
carm c045ca1489 Merge pull request #5 from CarmJos/dependabot/maven/org.bspfsystems-yamlconfiguration-1.2.0
Bump yamlconfiguration from 1.1.0 to 1.2.0
2022-05-20 10:10:38 +08:00
dependabot[bot] ceea900b08 Bump yamlconfiguration from 1.1.0 to 1.2.0
Bumps [yamlconfiguration](https://github.com/bspfsystems/YamlConfiguration) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/bspfsystems/YamlConfiguration/releases)
- [Commits](https://github.com/bspfsystems/YamlConfiguration/compare/v1.1.0...v1.2.0)

---
updated-dependencies:
- dependency-name: org.bspfsystems:yamlconfiguration
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-19 14:41:47 +00:00
7 changed files with 14 additions and 9 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>easyconfiguration-parent</artifactId> <artifactId>easyconfiguration-parent</artifactId>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<version>3.0.0</version> <version>3.1.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<properties> <properties>
@@ -26,10 +26,15 @@ public abstract class ConfigurationProvider<W extends ConfigurationWrapper> {
public abstract @NotNull W getConfiguration(); public abstract @NotNull W getConfiguration();
public abstract void reload() throws Exception; public void reload() throws Exception {
onReload(); // 调用重写的Reload方法
this.updateTime = System.currentTimeMillis();
}
public abstract void save() throws Exception; public abstract void save() throws Exception;
protected abstract void onReload() throws Exception;
public abstract void setHeaderComment(@Nullable String path, @Nullable List<String> comments); public abstract void setHeaderComment(@Nullable String path, @Nullable List<String> comments);
public abstract void setInlineComment(@NotNull String path, @Nullable String comment); public abstract void setInlineComment(@NotNull String path, @Nullable String comment);
+1 -1
View File
@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>easyconfiguration-parent</artifactId> <artifactId>easyconfiguration-parent</artifactId>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<version>3.0.0</version> <version>3.1.0</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -49,7 +49,6 @@ public class JSONConfigProvider extends FileConfigProvider<JSONConfigWrapper> {
if (map == null) map = new LinkedHashMap<>(); if (map == null) map = new LinkedHashMap<>();
this.configuration = new JSONConfigWrapper(map); this.configuration = new JSONConfigWrapper(map);
this.initializer = new ConfigInitializer<>(this);
} }
@Override @Override
@@ -58,7 +57,8 @@ public class JSONConfigProvider extends FileConfigProvider<JSONConfigWrapper> {
} }
@Override @Override
public void reload() { protected void onReload() throws Exception {
super.reload();
initializeConfig(); initializeConfig();
} }
+2 -2
View File
@@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>easyconfiguration-parent</artifactId> <artifactId>easyconfiguration-parent</artifactId>
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<version>3.0.0</version> <version>3.1.0</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@@ -29,7 +29,7 @@
<dependency> <dependency>
<groupId>org.bspfsystems</groupId> <groupId>org.bspfsystems</groupId>
<artifactId>yamlconfiguration</artifactId> <artifactId>yamlconfiguration</artifactId>
<version>1.1.0</version> <version>1.2.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@@ -38,7 +38,7 @@ public class YAMLConfigProvider extends FileConfigProvider<YAMLSectionWrapper> {
} }
@Override @Override
public void reload() throws Exception { protected void onReload() throws Exception {
configuration.load(getFile()); configuration.load(getFile());
} }
+1 -1
View File
@@ -15,7 +15,7 @@
<groupId>cc.carm.lib</groupId> <groupId>cc.carm.lib</groupId>
<artifactId>easyconfiguration-parent</artifactId> <artifactId>easyconfiguration-parent</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>3.0.0</version> <version>3.1.0</version>
<modules> <modules>
<module>core</module> <module>core</module>
<module>impl/yaml</module> <module>impl/yaml</module>