mirror of
https://github.com/CarmJos/EasyConfiguration.git
synced 2024-09-19 20:25:51 +00:00
docs(sample): Add sample codes. 🥚
This commit is contained in:
parent
97db8204dc
commit
9647591b0d
11
README.md
11
README.md
@ -57,6 +57,13 @@ public class Sample {
|
|||||||
@InlineComment("Enabled?") // Inline comment
|
@InlineComment("Enabled?") // Inline comment
|
||||||
ConfiguredValue<Boolean> ENABLED = ConfiguredValue.of(true);
|
ConfiguredValue<Boolean> ENABLED = ConfiguredValue.of(true);
|
||||||
|
|
||||||
|
ConfiguredList<UUID> UUIDS = ConfiguredList.builderOf(UUID.class).fromString()
|
||||||
|
.parseValue(UUID::fromString).serializeValue(UUID::toString)
|
||||||
|
.defaults(
|
||||||
|
UUID.fromString("00000000-0000-0000-0000-000000000000"),
|
||||||
|
UUID.fromString("00000000-0000-0000-0000-000000000001")
|
||||||
|
).build();
|
||||||
|
|
||||||
interface INFO extends Configuration {
|
interface INFO extends Configuration {
|
||||||
|
|
||||||
@HeaderComment("Configure your name!") // Header comment
|
@HeaderComment("Configure your name!") // Header comment
|
||||||
@ -87,6 +94,10 @@ public class Sample {
|
|||||||
|
|
||||||
enabled: true # Enabled?
|
enabled: true # Enabled?
|
||||||
|
|
||||||
|
uuids:
|
||||||
|
- 00000000-0000-0000-0000-000000000000
|
||||||
|
- 00000000-0000-0000-0000-000000000001
|
||||||
|
|
||||||
info:
|
info:
|
||||||
# Configure your name!
|
# Configure your name!
|
||||||
name: Joker
|
name: Joker
|
||||||
|
11
README_CN.md
11
README_CN.md
@ -51,6 +51,13 @@ public class Sample {
|
|||||||
@InlineComment("Enabled?") // 行内注释
|
@InlineComment("Enabled?") // 行内注释
|
||||||
ConfiguredValue<Boolean> ENABLED = ConfiguredValue.of(true);
|
ConfiguredValue<Boolean> ENABLED = ConfiguredValue.of(true);
|
||||||
|
|
||||||
|
ConfiguredList<UUID> UUIDS = ConfiguredList.builderOf(UUID.class).fromString()
|
||||||
|
.parseValue(UUID::fromString).serializeValue(UUID::toString)
|
||||||
|
.defaults(
|
||||||
|
UUID.fromString("00000000-0000-0000-0000-000000000000"),
|
||||||
|
UUID.fromString("00000000-0000-0000-0000-000000000001")
|
||||||
|
).build();
|
||||||
|
|
||||||
interface INFO extends Configuration {
|
interface INFO extends Configuration {
|
||||||
|
|
||||||
@HeaderComment("Configure your name!") // 头部注释
|
@HeaderComment("Configure your name!") // 头部注释
|
||||||
@ -79,6 +86,10 @@ public class Sample {
|
|||||||
|
|
||||||
enabled: true # Enabled?
|
enabled: true # Enabled?
|
||||||
|
|
||||||
|
uuids:
|
||||||
|
- 00000000-0000-0000-0000-000000000000
|
||||||
|
- 00000000-0000-0000-0000-000000000001
|
||||||
|
|
||||||
info:
|
info:
|
||||||
# Configure your name!
|
# Configure your name!
|
||||||
name: Joker
|
name: Joker
|
||||||
|
@ -6,8 +6,11 @@ import cc.carm.lib.configuration.core.annotation.ConfigPath;
|
|||||||
import cc.carm.lib.configuration.core.annotation.HeaderComment;
|
import cc.carm.lib.configuration.core.annotation.HeaderComment;
|
||||||
import cc.carm.lib.configuration.core.annotation.InlineComment;
|
import cc.carm.lib.configuration.core.annotation.InlineComment;
|
||||||
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
|
import cc.carm.lib.configuration.core.source.ConfigurationProvider;
|
||||||
|
import cc.carm.lib.configuration.core.value.type.ConfiguredList;
|
||||||
import cc.carm.lib.configuration.core.value.type.ConfiguredValue;
|
import cc.carm.lib.configuration.core.value.type.ConfiguredValue;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Sample {
|
public class Sample {
|
||||||
|
|
||||||
@HeaderComment("Configurations for sample")
|
@HeaderComment("Configurations for sample")
|
||||||
@ -16,6 +19,13 @@ public class Sample {
|
|||||||
@InlineComment("Enabled?") // Inline comment
|
@InlineComment("Enabled?") // Inline comment
|
||||||
ConfiguredValue<Boolean> ENABLED = ConfiguredValue.of(true);
|
ConfiguredValue<Boolean> ENABLED = ConfiguredValue.of(true);
|
||||||
|
|
||||||
|
ConfiguredList<UUID> UUIDS = ConfiguredList.builderOf(UUID.class).fromString()
|
||||||
|
.parseValue(UUID::fromString).serializeValue(UUID::toString)
|
||||||
|
.defaults(
|
||||||
|
UUID.fromString("00000000-0000-0000-0000-000000000000"),
|
||||||
|
UUID.fromString("00000000-0000-0000-0000-000000000001")
|
||||||
|
).build();
|
||||||
|
|
||||||
interface INFO extends Configuration {
|
interface INFO extends Configuration {
|
||||||
@HeaderComment("Configure your name!") // Header comment
|
@HeaderComment("Configure your name!") // Header comment
|
||||||
ConfiguredValue<String> NAME = ConfiguredValue.of("Joker");
|
ConfiguredValue<String> NAME = ConfiguredValue.of("Joker");
|
||||||
|
Loading…
Reference in New Issue
Block a user