View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.weaver.test.beans;
18  
19  import static java.lang.annotation.ElementType.FIELD;
20  import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.CURLY;
21  import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.LARRY;
22  import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.MOE;
23  import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.SHEMP;
24  
25  import java.lang.annotation.Target;
26  
27  public class ComplexAnnotations {
28      @TestAnnotation(
29              booleanValue = false,
30              booleanValues = { false },
31              byteValue = 0,
32              byteValues = { 0 },
33              charValue = 0,
34              charValues = { 0 },
35              doubleValue = 0,
36              doubleValues = { 0 },
37              floatValue = 0,
38              floatValues = { 0 },
39              intValue = 0,
40              intValues = { 0 },
41              longValue = 0,
42              longValues = { 0 },
43              nest = @NestAnnotation(
44                      booleanValue = false,
45                      booleanValues = { false },
46                      byteValue = 0,
47                      byteValues = { 0 },
48                      charValue = 0,
49                      charValues = { 0 },
50                      doubleValue = 0,
51                      doubleValues = { 0 },
52                      floatValue = 0,
53                      floatValues = { 0 },
54                      intValue = 0,
55                      intValues = { 0 },
56                      longValue = 0,
57                      longValues = { 0 },
58                      shortValue = 0,
59                      shortValues = { 0 },
60                      stooge = CURLY,
61                      stooges = { MOE, LARRY, SHEMP },
62                      string = "",
63                      strings = { "" },
64                      type = Object.class,
65                      types = { Object.class }
66              ),
67              nests = {
68                  @NestAnnotation(
69                          booleanValue = false,
70                          booleanValues = { false },
71                          byteValue = 0,
72                          byteValues = { 0 },
73                          charValue = 0,
74                          charValues = { 0 },
75                          doubleValue = 0,
76                          doubleValues = { 0 },
77                          floatValue = 0,
78                          floatValues = { 0 },
79                          intValue = 0,
80                          intValues = { 0 },
81                          longValue = 0,
82                          longValues = { 0 },
83                          shortValue = 0,
84                          shortValues = { 0 },
85                          stooge = CURLY,
86                          stooges = { MOE, LARRY, SHEMP },
87                          string = "",
88                          strings = { "" },
89                          type = Object[].class,
90                          types = { Object[].class }
91                  )
92              },
93              shortValue = 0,
94              shortValues = { 0 },
95              stooge = SHEMP,
96              stooges = { MOE, LARRY, CURLY },
97              string = "",
98              strings = { "" },
99              type = Object.class,
100             types = { Object.class }
101     )
102     public Object dummy1;
103 
104     @TestAnnotation(
105             booleanValue = false,
106             booleanValues = { false },
107             byteValue = 0,
108             byteValues = { 0 },
109             charValue = 0,
110             charValues = { 0 },
111             doubleValue = 0,
112             doubleValues = { 0 },
113             floatValue = 0,
114             floatValues = { 0 },
115             intValue = 0,
116             intValues = { 0 },
117             longValue = 0,
118             longValues = { 0 },
119             nest = @NestAnnotation(
120                     booleanValue = false,
121                     booleanValues = { false },
122                     byteValue = 0,
123                     byteValues = { 0 },
124                     charValue = 0,
125                     charValues = { 0 },
126                     doubleValue = 0,
127                     doubleValues = { 0 },
128                     floatValue = 0,
129                     floatValues = { 0 },
130                     intValue = 0,
131                     intValues = { 0 },
132                     longValue = 0,
133                     longValues = { 0 },
134                     shortValue = 0,
135                     shortValues = { 0 },
136                     stooge = CURLY,
137                     stooges = { MOE, LARRY, SHEMP },
138                     string = "",
139                     strings = { "" },
140                     type = Object.class,
141                     types = { Object.class }
142             ),
143             nests = {
144                 @NestAnnotation(
145                         booleanValue = false,
146                         booleanValues = { false },
147                         byteValue = 0,
148                         byteValues = { 0 },
149                         charValue = 0,
150                         charValues = { 0 },
151                         doubleValue = 0,
152                         doubleValues = { 0 },
153                         floatValue = 0,
154                         floatValues = { 0 },
155                         intValue = 0,
156                         intValues = { 0 },
157                         longValue = 0,
158                         longValues = { 0 },
159                         shortValue = 0,
160                         shortValues = { 0 },
161                         stooge = CURLY,
162                         stooges = { MOE, LARRY, SHEMP },
163                         string = "",
164                         strings = { "" },
165                         type = Object[].class,
166                         types = { Object[].class }
167                 ),
168                 //add a second NestAnnotation:
169                 @NestAnnotation(
170                         booleanValue = false,
171                         booleanValues = { false },
172                         byteValue = 0,
173                         byteValues = { 0 },
174                         charValue = 0,
175                         charValues = { 0 },
176                         doubleValue = 0,
177                         doubleValues = { 0 },
178                         floatValue = 0,
179                         floatValues = { 0 },
180                         intValue = 0,
181                         intValues = { 0 },
182                         longValue = 0,
183                         longValues = { 0 },
184                         shortValue = 0,
185                         shortValues = { 0 },
186                         stooge = CURLY,
187                         stooges = { MOE, LARRY, SHEMP },
188                         string = "",
189                         strings = { "" },
190                         type = Object[].class,
191                         types = { Object[].class }
192                 )
193             },
194             shortValue = 0,
195             shortValues = { 0 },
196             stooge = SHEMP,
197             stooges = { MOE, LARRY, CURLY },
198             string = "",
199             strings = { "" },
200             type = Object.class,
201             types = { Object.class }
202     )
203     public Object dummy2;
204 
205     @Target(FIELD)
206     public @interface TestAnnotation {
207         String string();
208         String[] strings();
209         Class<?> type();
210         Class<?>[] types();
211         byte byteValue();
212         byte[] byteValues();
213         short shortValue();
214         short[] shortValues();
215         int intValue();
216         int[] intValues();
217         char charValue();
218         char[] charValues();
219         long longValue();
220         long[] longValues();
221         float floatValue();
222         float[] floatValues();
223         double doubleValue();
224         double[] doubleValues();
225         boolean booleanValue();
226         boolean[] booleanValues();
227         Stooge stooge();
228         Stooge[] stooges();
229         NestAnnotation nest();
230         NestAnnotation[] nests();
231     }
232 
233     public @interface NestAnnotation {
234         String string();
235         String[] strings();
236         Class<?> type();
237         Class<?>[] types();
238         byte byteValue();
239         byte[] byteValues();
240         short shortValue();
241         short[] shortValues();
242         int intValue();
243         int[] intValues();
244         char charValue();
245         char[] charValues();
246         long longValue();
247         long[] longValues();
248         float floatValue();
249         float[] floatValues();
250         double doubleValue();
251         double[] doubleValues();
252         boolean booleanValue();
253         boolean[] booleanValues();
254         Stooge stooge();
255         Stooge[] stooges();
256     }
257 
258     public static enum Stooge {
259         MOE, LARRY, CURLY, SHEMP, JOE;
260     }
261 
262 }