-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy pathAnnotationValues.java
More file actions
124 lines (111 loc) · 3.64 KB
/
Copy pathAnnotationValues.java
File metadata and controls
124 lines (111 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
class AnnotationValues {
private static final byte BYTE = 2;
private static final short SHORT = 2;
private static final int INT = 2;
private static final long LONG = 2;
private static final float FLOAT = 2;
private static final double DOUBLE = 2;
private static final boolean BOOLEAN = true;
private static final char CHAR = 'b';
private static final String STRING = "b";
enum CustomEnum {
DEFAULT,
A,
B
}
@interface CustomAnnotation {
String value();
}
@interface SingleValues {
byte byteValue() default -1;
short shortValue() default -1;
int intValue() default -1;
long longValue() default -1;
float floatValue() default -1;
double doubleValue() default -1;
boolean booleanValue() default false;
char charValue() default '\uFFFF';
String stringValue() default "\0";
Class<?> classValue() default AnnotationValues.class;
CustomEnum enumValue() default CustomEnum.DEFAULT;
CustomAnnotation annotationValue() default @CustomAnnotation("default");
}
@SingleValues
private int singleValuesDefault;
@SingleValues(
byteValue = 1,
shortValue = 1,
intValue = 1,
longValue = 1,
floatValue = 1,
doubleValue = 1,
booleanValue = true,
charValue = 1,
stringValue = "a",
classValue = SingleValues.class,
enumValue = CustomEnum.A,
annotationValue = @CustomAnnotation("single")
)
private int singleValues;
@SingleValues(
byteValue = BYTE,
shortValue = SHORT,
intValue = INT,
longValue = LONG,
floatValue = FLOAT,
doubleValue = DOUBLE,
booleanValue = BOOLEAN,
charValue = CHAR,
stringValue = STRING,
classValue = SingleValues.class,
enumValue = CustomEnum.A,
annotationValue = @CustomAnnotation("single")
)
private int singleValuesConstants;
@interface ArrayValues {
byte[] byteValues() default -1;
short[] shortValues() default -1;
int[] intValues() default -1;
long[] longValues() default -1;
float[] floatValues() default -1;
double[] doubleValues() default -1;
boolean[] booleanValues() default false;
char[] charValues() default '\uFFFF';
String[] stringValues() default "\0";
Class<?>[] classValues() default AnnotationValues.class;
CustomEnum[] enumValues() default CustomEnum.DEFAULT;
CustomAnnotation[] annotationValues() default @CustomAnnotation("default");
}
@ArrayValues
private int arrayValuesDefault;
@ArrayValues(
byteValues = 1,
shortValues = 1,
intValues = 1,
longValues = 1,
floatValues = 1,
doubleValues = 1,
booleanValues = true,
charValues = 'a',
stringValues = "a",
classValues = ArrayValues.class,
enumValues = CustomEnum.A,
annotationValues = @CustomAnnotation("single")
)
private int arrayValuesSingleExpr;
@ArrayValues(
byteValues = {1, BYTE},
shortValues = {1, SHORT},
intValues = {1, INT},
longValues = {1, LONG},
floatValues = {1, FLOAT},
doubleValues = {1, DOUBLE},
booleanValues = {false, BOOLEAN},
charValues = {'a', CHAR},
stringValues = {"a", "b"},
classValues = {SingleValues.class, ArrayValues.class},
enumValues = {CustomEnum.A, CustomEnum.B},
annotationValues = {@CustomAnnotation("first"), @CustomAnnotation("second")}
)
private int arrayValues;
}