settings system
This commit is contained in:
1 parent
c7739f1963
commit
92f40c36b8
9 files changed
+863
-21
No files matched your search
@@ -0,0 +1,58 @@
|
||||
package carpet.settings;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Any field in this class annotated with this class is interpreted as a carpet rule.
|
||||
* The field must be static and have a type of one of:
|
||||
* - boolean
|
||||
* - int
|
||||
* - double
|
||||
* - String
|
||||
* - a subclass of Enum
|
||||
* The default value of the rule will be the initial value of the field.
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface Rule {
|
||||
/**
|
||||
* The rule name, by default the same as the field name
|
||||
*/
|
||||
String name() default ""; // default same as field name
|
||||
|
||||
/**
|
||||
* A description of the rule
|
||||
*/
|
||||
String desc();
|
||||
|
||||
/**
|
||||
* Extra information about the rule
|
||||
*/
|
||||
String[] extra() default {};
|
||||
|
||||
/**
|
||||
* A list of categories the rule is in
|
||||
*/
|
||||
RuleCategory[] category();
|
||||
|
||||
/**
|
||||
* Options to select in menu.
|
||||
* Inferred for booleans and enums. Otherwise, must be present.
|
||||
*/
|
||||
String[] options() default {};
|
||||
|
||||
/**
|
||||
* if a rule is not strict - can take any value, otherwise it needs to match
|
||||
* any of the options
|
||||
* For enums, its always strict
|
||||
*/
|
||||
boolean strict() default true;
|
||||
|
||||
/**
|
||||
* The class of the validator checked when the rule is changed.
|
||||
*/
|
||||
Class<? extends Validator>[] validate() default {};
|
||||
}
|
||||
Reference in new issue
Block a user