Skip to content

Commit 6efb569

Browse files
committed
add javadoc to configs
1 parent d39e746 commit 6efb569

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

src/main/java/com/falsepattern/lib/config/Config.java

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
import java.lang.annotation.RetentionPolicy;
88
import java.lang.annotation.Target;
99

10+
/**
11+
* A modern configuration system to replace the old and obtuse forge config system.
12+
*
13+
* Note that just annotating a configuration class with {@link Config} is not enough, you must also register it using
14+
* {@link com.falsepattern.lib.config.ConfigurationManager#registerConfig}!
15+
*/
1016
@Documented
1117
@Retention(RetentionPolicy.RUNTIME)
1218
@Target(ElementType.TYPE)
@@ -22,29 +28,51 @@
2228
*/
2329
String category() default "general";
2430

31+
/**
32+
* The lang file key of this configuration. Used in config GUIs.
33+
*/
34+
@Documented
2535
@Retention(RetentionPolicy.RUNTIME)
2636
@Target({ElementType.FIELD, ElementType.TYPE})
2737
@interface LangKey {
2838
String value();
2939
}
3040

41+
/**
42+
* The description of the configuration.
43+
*/
44+
@Documented
3145
@Retention(RetentionPolicy.RUNTIME)
3246
@Target(ElementType.FIELD)
3347
@interface Comment {
3448
String[] value();
3549
}
3650

51+
/**
52+
* If you have extra fields in the config class used for anything else other than configuring, you must annotate
53+
* the using this so that the config engine doesn't pick them up.
54+
*/
55+
@Documented
3756
@Retention(RetentionPolicy.RUNTIME)
3857
@Target(ElementType.FIELD)
3958
@interface Ignore {
4059
}
4160

61+
/**
62+
* The default value for a boolean field. Not having a default is deprecated since 0.10, and will be strongly
63+
* enforced in 0.11+!
64+
*/
65+
@Documented
4266
@Retention(RetentionPolicy.RUNTIME)
4367
@Target(ElementType.FIELD)
4468
@interface DefaultBoolean {
4569
boolean value();
4670
}
4771

72+
/**
73+
* The range of possible values an int config can have.
74+
*/
75+
@Documented
4876
@Retention(RetentionPolicy.RUNTIME)
4977
@Target(ElementType.FIELD)
5078
@interface RangeInt {
@@ -53,12 +81,21 @@
5381
int max() default Integer.MAX_VALUE;
5482
}
5583

84+
/**
85+
* The default value for an int field. Not having a default is deprecated since 0.10, and will be strongly
86+
* enforced in 0.11+!
87+
*/
88+
@Documented
5689
@Retention(RetentionPolicy.RUNTIME)
5790
@Target(ElementType.FIELD)
5891
@interface DefaultInt {
5992
int value();
6093
}
6194

95+
/**
96+
* The range of possible values a float config can have.
97+
*/
98+
@Documented
6299
@Retention(RetentionPolicy.RUNTIME)
63100
@Target(ElementType.FIELD)
64101
@interface RangeFloat {
@@ -67,47 +104,83 @@
67104
float max() default Float.MAX_VALUE;
68105
}
69106

107+
/**
108+
* The default value for a float field. Not having a default is deprecated since 0.10, and will be strongly
109+
* enforced in 0.11+!
110+
*/
111+
@Documented
70112
@Retention(RetentionPolicy.RUNTIME)
71113
@Target(ElementType.FIELD)
72114
@interface DefaultFloat {
73115
float value();
74116
}
75117

118+
/**
119+
* The default value for a String field. Not having a default is deprecated since 0.10, and will be strongly
120+
* enforced in 0.11+!
121+
*/
122+
@Documented
76123
@Retention(RetentionPolicy.RUNTIME)
77124
@Target(ElementType.FIELD)
78125
@interface DefaultString {
79126
String value();
80127
}
81128

129+
/**
130+
* A regex pattern for restricting the allowed strings.
131+
*/
132+
@Documented
82133
@Retention(RetentionPolicy.RUNTIME)
83134
@Target(ElementType.FIELD)
84135
@interface Pattern {
85136
String value();
86137
}
87138

139+
/**
140+
* The default value for an Enum field. Not having a default is deprecated since 0.10, and will be strongly
141+
* enforced in 0.11+!
142+
*/
143+
@Documented
88144
@Retention(RetentionPolicy.RUNTIME)
89145
@Target(ElementType.FIELD)
90146
@interface DefaultEnum {
91147
String value();
92148
}
93149

150+
/**
151+
* The default value for a string array field. Not having a default is deprecated since 0.10, and will be strongly
152+
* enforced in 0.11+!
153+
*/
154+
@Documented
94155
@Retention(RetentionPolicy.RUNTIME)
95156
@Target(ElementType.FIELD)
96157
@interface DefaultStringList {
97158
String[] value();
98159
}
99160

161+
/**
162+
* The name of this config property in the config file. If not specified, the field's name will be used instead.
163+
*/
164+
@Documented
100165
@Retention(RetentionPolicy.RUNTIME)
101166
@Target(ElementType.FIELD)
102167
@interface Name {
103168
String value();
104169
}
105170

171+
/**
172+
* Whether the specific configuration needs a minecraft restart to be applied.
173+
*/
174+
@Documented
106175
@Retention(RetentionPolicy.RUNTIME)
107176
@Target({ElementType.FIELD, ElementType.TYPE})
108177
@interface RequiresMcRestart {
109178
}
110179

180+
/**
181+
* Whether the specific configuration needs a world/server rejoin to be applied.
182+
*/
183+
@Documented
111184
@Retention(RetentionPolicy.RUNTIME)
112185
@Target({ElementType.FIELD, ElementType.TYPE})
113186
@interface RequiresWorldRestart {

0 commit comments

Comments
 (0)