Caution: Still under heavy development
Babylon is a little experimental not really ready to use config format. It aims to replace json as a config format in my projects by providing the following features:
- Highly human readable
- Add comments for all values (Main reason of replacing json)
- Simple and clean API
- Managing the config as a model with annotations
On config initialization babylon will check for an existing config and will create a new one if the file does not exist or read the known config.
- Install Maven
- Clone this repo
- Instal:
mvn clean install
Maven dependencies
<dependency>
<groupId>de.felix_klauke</groupId>
<artifactId>babylon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
Model:
public class TestConfig extends Config {
private String test;
private String meh;
@Skip
private MessageManager messageManager;
public TestConfig(String test, String meh, MessageManager messageManager) {
this.test = test;
this.meh = meh;
this.messageManager = messageManager;
}
public TestConfig() {
}
}
Initialize config:
Babylon babylon = BabylonFactory.createBabylon();
Config config = new TestConfig();
babylon.initializeConfig(config, new File("config.bbl"));
Comments in the config:
@Comment( "I am a commented field" )
private String name = "SasukeKawaiiTheKing";
Comments will look like this:
{
# I am a commented field
name: "SasukeKawaiiTheKing"
}
Renaming fields:
@Name( "customName" )
private String name = "SasukeKawaiiTheKing";
Renaming will look like this:
{
customName: "SasukeKawaiiTheKing"
}