A library that simplify the creation of multiple configuration types.
Getting started
Note: replace
latest-version-here
with the jitpack's version badge above.
repositories {
maven("https://jitpack.io")
// ... other
}
dependencies {
implementation("com.github.Tofpu:dynamic-configuration:latest-version-here")
// ... other
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<!-- other -->
</repositories>
<dependencies>
<dependency>
<groupId>com.github.Tofpu</groupId>
<artifactId>dynamic-configuration</artifactId>
<version>latest-version-here</version>
</dependency>
<!-- other -->
</dependencies>
Usage
// define your config types
enum MyConfigTypes implements ConfigType {
CONFIG("config"),
MESSAGE("messages");
private final String identifier;
ConfigTypes(String identifier) {
this.identifier = identifier;
}
@Override
public String identifier() {
return identifier;
}
}
final File configDirectory = // this is where the configs will be located
final DynamicConfigHandler configHandler = new DynamicConfigHandler(configDirectory);
// pass down your custom defined config types here
configHandler.load(MyConfigTypes.values());
Configuration config = configHandler.on(MyConfigTypes.CONFIG);
Until a proper document is in place, please refer to ConfigurationTest class in the meantime.