@Retention(value=RUNTIME)
@Target(value=FIELD)
public @interface Config
Example usage:
@Config("items.rocket.params")
public int maxCount = 3; //4 is the default value
This code will load the items.rocket.params.maxCount config setting into this variable.The config file content may look like this:
items{
rocket{
params{
maxCount = 14
enabled: true
}
}
}
baz = string
For root values you could just use @Config annotation with no parameters:
@Config public String baz = "default";
Note, that your class must have an ConfigHolder annotation
for this to work properly.
Also, if you allow @ConfigHolder annotation to scan
inner @ConfigHolder types, then this types could represent HOCON objects of your config.
ConfigHolderpublic static final Config DEFAULT