1
mirror of https://github.com/CarmJos/EasyConfiguration.git synced 2024-09-19 12:15:52 +00:00

docs(sample): Add sample codes. 🥚

This commit is contained in:
Carm Jos 2024-01-03 23:33:39 +08:00
parent 48050a52a2
commit 97db8204dc
3 changed files with 7 additions and 3 deletions

View File

@ -62,6 +62,7 @@ public class Sample {
@HeaderComment("Configure your name!") // Header comment
ConfiguredValue<String> NAME = ConfiguredValue.of("Joker");
@ConfigPath("year") // Custom path
ConfiguredValue<Integer> AGE = ConfiguredValue.of(24);
}
@ -89,7 +90,7 @@ enabled: true # Enabled?
info:
# Configure your name!
name: Joker
age: 24
year: 24
```
### Dependencies

View File

@ -56,6 +56,7 @@ public class Sample {
@HeaderComment("Configure your name!") // 头部注释
ConfiguredValue<String> NAME = ConfiguredValue.of("Joker");
@ConfigPath("year") // 自定义配置路径,若不定义,则按照默认规则生成
ConfiguredValue<Integer> AGE = ConfiguredValue.of(24);
}
}
@ -81,7 +82,7 @@ enabled: true # Enabled?
info:
# Configure your name!
name: Joker
age: 24
year: 24
```
### 依赖方式

View File

@ -2,6 +2,7 @@ package config;
import cc.carm.lib.configuration.EasyConfiguration;
import cc.carm.lib.configuration.core.Configuration;
import cc.carm.lib.configuration.core.annotation.ConfigPath;
import cc.carm.lib.configuration.core.annotation.HeaderComment;
import cc.carm.lib.configuration.core.annotation.InlineComment;
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
@ -18,7 +19,8 @@ public class Sample {
interface INFO extends Configuration {
@HeaderComment("Configure your name!") // Header comment
ConfiguredValue<String> NAME = ConfiguredValue.of("Joker");
@ConfigPath("year") // Custom path
ConfiguredValue<Integer> AGE = ConfiguredValue.of(24);
}