Merge branch 'subtree'
[fanfix.git] / src / be / nikiroo / utils / resources / Meta.java
CommitLineData
ec1f3444
NR
1package be.nikiroo.utils.resources;
2
3import java.lang.annotation.ElementType;
4import java.lang.annotation.Retention;
5import java.lang.annotation.RetentionPolicy;
6import java.lang.annotation.Target;
7
8/**
9 * Annotation used to give some information about the translation keys, so the
10 * translation .properties file can be created programmatically.
11 *
12 * @author niki
13 */
14@Retention(RetentionPolicy.RUNTIME)
15@Target(ElementType.FIELD)
16public @interface Meta {
17 /**
db31c358
NR
18 * The format of an item (the values it is expected to be of).
19 * <p>
20 * Note that the INI file can contain arbitrary data, but it is expected to
21 * be valid.
22 *
23 * @author niki
24 */
25 public enum Format {
26 /** An integer value, can be negative. */
27 INT,
28 /** true or false. */
29 BOOLEAN,
30 /** Any text String. */
31 STRING,
32 /** A password field. */
33 PASSWORD,
34 /** A colour (either by name or #rrggbb or #aarrggbb). */
35 COLOR,
36 /** A locale code (e.g., fr-BE, en-GB, es...). */
37 LOCALE,
38 /** A path to a file. */
39 FILE,
40 /** A path to a directory. */
41 DIRECTORY,
42 /** A fixed list of values (see {@link Meta#list()} for the values). */
43 FIXED_LIST,
44 /**
45 * A fixed list of values (see {@link Meta#list()} for the values) OR a
46 * custom String value (basically, a {@link Format#FIXED_LIST} with an
47 * option to enter a not accounted for value).
48 */
9e834013 49 COMBO_LIST,
db31c358
NR
50 }
51
52 /**
d18e136e
NR
53 * A description for this item: what it is or does, how to explain that item
54 * to the user including what can be used here (i.e., %s = file name, %d =
55 * file size...).
56 * <p>
57 * For group, the first line ('\\n'-separated) will be used as a title while
58 * the rest will be the description.
ec1f3444
NR
59 *
60 * @return what it is
61 */
db31c358 62 String description() default "";
ee020e75
NR
63
64 /**
65 * This item should be hidden from the user (she will still be able to
66 * modify it if she opens the file manually).
67 * <p>
68 * Defaults to FALSE (visible).
69 *
70 * @return TRUE if it should stay hidden
71 */
72 boolean hidden() default false;
ec1f3444
NR
73
74 /**
db31c358
NR
75 * This item is only used as a group, not as an option.
76 * <p>
77 * For instance, you could have LANGUAGE_CODE as a group for which you won't
78 * use the value in the program, and LANGUAGE_CODE_FR, LANGUAGE_CODE_EN
79 * inside for which the value must be set.
ec1f3444 80 *
e8aa5bf9 81 * @return TRUE if it is a group
ec1f3444 82 */
db31c358 83 boolean group() default false;
ec1f3444
NR
84
85 /**
86 * What format should/must this key be in.
87 *
88 * @return the format it is in
89 */
db31c358
NR
90 Format format() default Format.STRING;
91
92 /**
93 * The list of fixed values this item can be (either for
94 * {@link Format#FIXED_LIST} or {@link Format#COMBO_LIST}).
95 *
96 * @return the list of values
97 */
98 String[] list() default {};
99
100 /**
101 * This item can be left unspecified.
102 *
103 * @return TRUE if it can
104 */
105 boolean nullable() default true;
106
e8aa5bf9
NR
107 /**
108 * The default value of this item.
109 *
110 * @return the value
111 */
112 String def() default "";
113
db31c358
NR
114 /**
115 * This item is a comma-separated list of values instead of a single value.
0877d6f5
NR
116 * <p>
117 * The list items are separated by a comma, each surrounded by
118 * double-quotes, with backslashes and double-quotes escaped by a backslash.
119 * <p>
120 * Example: <tt>"un", "deux"</tt>
db31c358
NR
121 *
122 * @return TRUE if it is
123 */
124 boolean array() default false;
ec1f3444
NR
125
126 /**
d18e136e
NR
127 * @deprecated add the info into the description, as only the description
128 * will be translated.
ec1f3444 129 */
d18e136e 130 @Deprecated
db31c358 131 String info() default "";
ec1f3444 132}