LibJF/libjf-config-core-v1/src/testmod/java/io/gitlab/jfronny/libjf/config/test/TestConfigCustom.java

64 lines
2.1 KiB
Java

package io.gitlab.jfronny.libjf.config.test;
import io.gitlab.jfronny.libjf.config.api.v1.*;
import io.gitlab.jfronny.libjf.config.api.v1.dsl.*;
import java.util.LinkedList;
import java.util.List;
@JfConfig(referencedConfigs = {"Yes", "No", "Yes"})
public class TestConfigCustom implements JfCustomConfig {
// User-created
@Entry
public static Integer someValue = 10;
@Entry public static String someOther = "Yes";
@Category
public static class SomeCategory {
@Entry public static boolean someBool = true;
@Entry public static List<String> someObject = new LinkedList<>();
@Verifier
public static void exampleVerifier() {
}
@Preset
public static void examplePreset() {
}
// Generated
private static CategoryBuilder<?> libjf$config$root(CategoryBuilder<?> builder) {
return builder
.value("someBool", someBool, () -> SomeCategory.someBool, v -> SomeCategory.someBool = v)
.value(EntryInfo.ofField(SomeCategory.class, "someObject"))
.addVerifier(SomeCategory::exampleVerifier)
.addPreset("examplePreset", SomeCategory::examplePreset);
}
}
// Generated
@Override
public void register(DSL.Defaulted dsl) {
// Here to ensure the static initializer is called
}
static {
libjf$config$clinit();
}
private static void libjf$config$clinit() {
ConfigHolder.getInstance().migrateFiles("libjf-config-v1-testmod");
DSL.create("libjf-config-v1-testmod").config(TestConfigCustom::libjf$config$root);
}
private static ConfigBuilder<?> libjf$config$root(ConfigBuilder<?> builder) {
return builder
.referenceConfig("libjf-config-reflect-v0-testmod")
.value("someValue", someValue, -50, 50, () -> someValue, v -> someValue = v)
.value("someOther", someOther, () -> someOther, v -> someOther = v)
.category("someCategory", SomeCategory::libjf$config$root);
}
}