KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > annotations > ValuesAnnotation


1
2 package annotations;
3
4 import java.lang.annotation.Retention JavaDoc;
5 import java.lang.annotation.RetentionPolicy JavaDoc;
6
7
8 /**
9  * Annotation declaration with different values
10  */

11 @Retention JavaDoc(RetentionPolicy.RUNTIME)
12 public @interface ValuesAnnotation {
13   byte byteValue() default (byte) 255;
14   char charValue() default (char) 128;
15   boolean booleanValue() default true;
16   int intValue() default 10;
17   short shortValue() default (short) 20;
18   long longValue() default 100L;
19   float floatValue() default 10.0F;
20   double doubleValue() default 20.0D;
21   String JavaDoc stringValue() default "defaultString";
22
23   Class JavaDoc classValue() default Values.class;
24   ValuesEnum enumValue() default ValuesEnum.ONE;
25   ValueAttrAnnotation annotationValue() default @ValueAttrAnnotation;
26
27   byte[] byteArrayValue() default {(byte) 128, (byte) 129};
28   char[] charArrayValue() default { '1', '2'};
29   boolean[] booleanArrayValue() default { true, false};
30   int[] intArrayValue() default { 500, 501};
31   short[] shortArrayValue() default { (short) 20000, (short) 2001};
32   long[] longArrayValue() default { 101L, 102L};
33   float[] floatArrayValue() default { 11.0F, 12.0F};
34   double[] doubleArrayValue() default { 21.0D, 22.0D};
35   String JavaDoc[] stringArrayValue() default { "11", "22"};
36
37   ValuesEnum[] enumArrayValue() default { ValuesEnum.ONE, ValuesEnum.TWO};
38   ValueAttrAnnotation[] annotationArrayValue() default { @ValueAttrAnnotation(), @ValueAttrAnnotation("1")};
39   Class JavaDoc[] classArrayValue() default { Values.class, Values.class};
40
41 }
42
43
Popular Tags