Debian Codegraph @

src/aQute/bnd/annotation/metatype/Meta.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 package aQute.bnd.annotation.metatype;
2
3 import java.lang.annotation.ElementType;
4 import java.lang.annotation.Retention;
5 import java.lang.annotation.RetentionPolicy;
6 import java.lang.annotation.Target;
7
8 /**
9 * The Metadata interface provides access to the properties that underly a
10 * Configurable interface. Any Configurable interface can implement this
11 * interface. The interface provides the annotations that can be used to create
12 * metatype objects. @ConsumerInterface
13 */
14
15 public interface Meta {
16 enum Type {
17 Boolean,
18 Byte,
19 Character,
20 Short,
21 Integer,
22 Long,
23 Float,
24 Double,
25 String,
26 Password
27 }
28
29 /**
30 * Constant NULL for default usage
31 */
32 String NULL = "§NULL§";
33
34 /**
35 * The OCD Annotation maps to the OCD element in the Metatype specification.
36 * The only difference is that it is possible to create a Designate element
37 * as well.
38 */
39 @Target(ElementType.TYPE)
40 @Retention(RetentionPolicy.RUNTIME)
41 @interface OCD {
42 /**
43 * The name for this component. The default name is a the short class
44 * name that us un-camel cased to make it more readable.
45 *
46 * @return The name of this component
47 */
48 String name() default NULL;
49
50 /**
51 * The id of the component. Default the name of the class in FQN
52 * notation but with nested classes using the $ as separator (not .).
53 * The Felix webconsole always uses this id as the PID and not the pid
54 * in the Designate element. Reported as an error.
55 *
56 * @return the id
57 */
58 String id() default NULL;
59
60 /**
61 * The localization prefix. The default localization prefix is the name
62 * of the class with a $ separator for nested classes.
63 *
64 * @return the localization prefix.
65 */
66 String localization() default NULL;
67
68 /**
69 * A description for this ocd. The default is empty.
70 *
71 * @return the description
72 */
73 String description() default NULL;
74
75 /**
76 * Defines if this is for a factory or not.
77 */
78 boolean factory() default false;
79 }
80
81 /**
82 * The AD element in the Metatype specification.
83 */
84 @Target(ElementType.METHOD)
85 @Retention(RetentionPolicy.RUNTIME)
86 @interface AD {
87 /**
88 * A description of the attribute. Default is empty.
89 *
90 * @return The description of the attribute.
91 */
92 String description() default NULL;
93
94 /**
95 * The name of the attribute. By default the un-camel cased version of
96 * the method name.
97 *
98 * @return the name
99 */
100 String name() default NULL;
101
102 /**
103 * The id of the attribute. By default the name of the method. The id is
104 * the key used to access the properties. This is the reason the AD is a
105 * runtime annotation so the runtime can find the proper key.
106 *
107 * @return the id
108 */
109 String id() default NULL;
110
111 /**
112 * The type of the field. This must be one of the basic types in the
113 * metatype specification. By default, the type is derived from the
114 * return type of the method. This includes most collections and arrays.
115 * Unrecognized types are defaulted to String.
116 *
117 * @return the type to be used.
118 */
119 Type type() default Type.String;
120
121 /**
122 * The cardinality of the attribute. If not explicitly set it will be
123 * derived from the attributes return type. Collections return
124 * Integer.MIN_VALUE and arrays use Integer.MAX_VALUE. If a single
125 * string needs to be converted to a Collection or array then the | will
126 * be used as a separator to split the line.
127 *
128 * @return the cardinality of the attribute
129 */
130 int cardinality() default 0;
131
132 /**
133 * The minimum value. This string must be converted to the attribute
134 * type before comparison takes place.
135 *
136 * @return the min value
137 */
138 String min() default NULL;
139
140 /**
141 * The maximum value. This string must be converted to the attribute
142 * type before comparison takes place.
143 *
144 * @return the max value
145 */
146 String max() default NULL;
147
148 /**
149 * The default value. This value must be converted to the return type of
150 * the attribute. For multi valued returns use the | as separator.
151 *
152 * @return the default value
153 */
154 String deflt() default NULL;
155
156 /**
157 * Indicates that this attribute is required. By default attributes are
158 * required.
159 */
160 boolean required() default true;
161
162 /**
163 * Provide labels for options. These labels must match the values. If no
164 * labels are set, the un-cameled version of the values are used (if
165 * they are set of course).
166 *
167 * @return the option labels
168 */
169 String[] optionLabels() default NULL;
170
171 /**
172 * The values of options. If not set and the return type is an enum
173 * class then the values will be derived from this return type.
174 *
175 * @return the option labels
176 */
177 String[] optionValues() default NULL;
178 }
179 }