aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/Boolean.java
blob: 55983896629c3c823280a837cc05844ba0bf245f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package dev.isxander.yacl3.config.v2.api.autogen;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * An option factory.
 * <p>
 * This creates a regular option with a
 * {@link dev.isxander.yacl3.api.controller.BooleanControllerBuilder} controller.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Boolean {
    enum Formatter {
        YES_NO,
        TRUE_FALSE,
        ON_OFF,
        /**
         * Uses the translation keys:
         * <ul>
         *     <li>true: {@code yacl3.config.$configId.$fieldName.fmt.true}</li>
         *     <li>false: {@code yacl3.config.$configId.$fieldName.fmt.false}</li>
         * </ul>
         */
        CUSTOM,
    }

    /**
     * The format used to display the boolean.
     */
    Formatter formatter() default Formatter.TRUE_FALSE;

    /**
     * Whether to color the formatted text green and red
     * depending on the value: true or false respectively.
     */
    boolean colored() default false;
}