Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scarsz/configuralize
YAML/JSON configuration library with built-in internationalization
https://github.com/scarsz/configuralize
config configuration java json library yaml
Last synced: 4 months ago
JSON representation
YAML/JSON configuration library with built-in internationalization
- Host: GitHub
- URL: https://github.com/scarsz/configuralize
- Owner: Scarsz
- License: unlicense
- Created: 2019-08-27T00:14:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-14T20:53:52.000Z (about 2 years ago)
- Last Synced: 2024-05-01T15:35:11.710Z (10 months ago)
- Topics: config, configuration, java, json, library, yaml
- Language: Java
- Size: 43 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Configuralize
A config library that doesn't waste your time. Built-in internationalization.
Supports .yml files via SnakeYAML and .json files via json-simple.# Dependency information
```xmlscarsz
https://nexus.scarsz.me/content/groups/public/github.scarsz
configuralize
1.4.0```
# Example usage
Files are defined as their own folder in resources. In the below example,
the `config` and `messages` config resources have `en`, English; `fr`, French;
and `de`, German translations.
```
/resources/config/en.yml
/resources/config/fr.yml
/resources/config/de.yml
/resources/messages/en.yml
/resources/messages/fr.yml
/resources/messages/de.yml
```
```java
DynamicConfig config = new DynamicConfig();
config.addSource(Test.class, "config", new File("config.yml"));
config.addSource(Test.class, "messages", new File("messages.yml"));
config.saveAllDefaults(false /* overwrite files if they already exist? */);
config.loadAll();// given either the config or messages resources contain a key for "Test key"...
String value = config.getString("Test key");
Optional optionalValue = config.getOptionalString("Test key");
String otherwiseValue = config.getStringElse("Test key", "value if key not in either resource");
```See more detailed usage in https://github.com/Scarsz/Configuralize/tree/master/src/test.