AnnotationUtils.java
10.5 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
package org.apache.commons.lang3;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class AnnotationUtils
{
private static final ToStringStyle a = new ToStringStyle()
{
private static final long serialVersionUID = 1L;
protected final void appendDetail(StringBuffer paramAnonymousStringBuffer, String paramAnonymousString, Object paramAnonymousObject)
{
Object localObject = paramAnonymousObject;
if ((paramAnonymousObject instanceof Annotation)) {
localObject = AnnotationUtils.toString((Annotation)paramAnonymousObject);
}
super.appendDetail(paramAnonymousStringBuffer, paramAnonymousString, localObject);
}
protected final String getShortClassName(Class<?> paramAnonymousClass)
{
Iterator localIterator = ClassUtils.getAllInterfaces(paramAnonymousClass).iterator();
do
{
if (!localIterator.hasNext()) {
break;
}
paramAnonymousClass = (Class)localIterator.next();
} while (!Annotation.class.isAssignableFrom(paramAnonymousClass));
for (;;)
{
if (paramAnonymousClass == null) {}
for (paramAnonymousClass = "";; paramAnonymousClass = paramAnonymousClass.getName()) {
return new StringBuilder(paramAnonymousClass).insert(0, '@').toString();
}
paramAnonymousClass = null;
}
}
};
public static boolean equals(Annotation paramAnnotation1, Annotation paramAnnotation2)
{
if (paramAnnotation1 == paramAnnotation2) {
return true;
}
if ((paramAnnotation1 == null) || (paramAnnotation2 == null)) {
return false;
}
Object localObject1 = paramAnnotation1.annotationType();
Object localObject2 = paramAnnotation2.annotationType();
Validate.notNull(localObject1, "Annotation %s with null annotationType()", new Object[] { paramAnnotation1 });
Validate.notNull(localObject2, "Annotation %s with null annotationType()", new Object[] { paramAnnotation2 });
if (!localObject1.equals(localObject2)) {
return false;
}
label225:
label609:
label616:
label632:
label637:
label644:
label648:
for (;;)
{
Object localObject3;
boolean bool;
int j;
try
{
localObject1 = ((Class)localObject1).getDeclaredMethods();
int k = localObject1.length;
int i = 0;
if (i < k)
{
Class localClass = localObject1[i];
if ((localClass.getParameterTypes().length == 0) && (isValidAnnotationMemberType(localClass.getReturnType())))
{
localObject3 = localClass.invoke(paramAnnotation1, new Object[0]);
localObject2 = localClass.invoke(paramAnnotation2, new Object[0]);
localClass = localClass.getReturnType();
if (localObject3 != localObject2) {
break label616;
}
bool = true;
break label609;
if (localClass.isArray())
{
localClass = localClass.getComponentType();
if (localClass.isAnnotation())
{
localObject3 = (Annotation[])localObject3;
localObject2 = (Annotation[])localObject2;
if (localObject3.length == localObject2.length) {
break label632;
}
bool = false;
break label609;
if (j >= localObject3.length) {
break label644;
}
if (equals(localObject3[j], localObject2[j])) {
break label637;
}
bool = false;
}
else if (localClass.equals(Byte.TYPE))
{
bool = Arrays.equals((byte[])localObject3, (byte[])localObject2);
}
else if (localClass.equals(Short.TYPE))
{
bool = Arrays.equals((short[])localObject3, (short[])localObject2);
}
else if (localClass.equals(Integer.TYPE))
{
bool = Arrays.equals((int[])localObject3, (int[])localObject2);
}
else if (localClass.equals(Character.TYPE))
{
bool = Arrays.equals((char[])localObject3, (char[])localObject2);
}
else if (localClass.equals(Long.TYPE))
{
bool = Arrays.equals((long[])localObject3, (long[])localObject2);
}
else if (localClass.equals(Float.TYPE))
{
bool = Arrays.equals((float[])localObject3, (float[])localObject2);
}
else if (localClass.equals(Double.TYPE))
{
bool = Arrays.equals((double[])localObject3, (double[])localObject2);
}
else if (localClass.equals(Boolean.TYPE))
{
bool = Arrays.equals((boolean[])localObject3, (boolean[])localObject2);
}
else
{
bool = Arrays.equals((Object[])localObject3, (Object[])localObject2);
}
}
else if (localClass.isAnnotation())
{
bool = equals((Annotation)localObject3, (Annotation)localObject2);
}
else
{
bool = localObject3.equals(localObject2);
}
}
else
{
i += 1;
}
}
else
{
return true;
}
}
catch (IllegalAccessException paramAnnotation1)
{
return false;
}
catch (InvocationTargetException paramAnnotation1)
{
return false;
}
for (;;)
{
if (bool) {
break label648;
}
return false;
if ((localObject3 != null) && (localObject2 != null)) {
break;
}
bool = false;
continue;
j = 0;
break label225;
j += 1;
break label225;
bool = true;
}
}
}
public static int hashCode(Annotation paramAnnotation)
{
Method[] arrayOfMethod = paramAnnotation.annotationType().getDeclaredMethods();
int m = arrayOfMethod.length;
int j = 0;
int k = 0;
for (;;)
{
int n;
int i;
if (j < m)
{
Object localObject2 = arrayOfMethod[j];
try
{
localObject1 = ((Method)localObject2).invoke(paramAnnotation, new Object[0]);
if (localObject1 == null) {
throw new IllegalStateException(String.format("Annotation method %s returned null", new Object[] { localObject2 }));
}
}
catch (RuntimeException paramAnnotation)
{
Object localObject1;
throw paramAnnotation;
n = ((Method)localObject2).getName().hashCode() * 127;
if (localObject1.getClass().isArray())
{
localObject2 = localObject1.getClass().getComponentType();
if (localObject2.equals(Byte.TYPE))
{
i = Arrays.hashCode((byte[])localObject1);
break label380;
}
if (localObject2.equals(Short.TYPE))
{
i = Arrays.hashCode((short[])localObject1);
break label380;
}
if (localObject2.equals(Integer.TYPE))
{
i = Arrays.hashCode((int[])localObject1);
break label380;
}
if (localObject2.equals(Character.TYPE))
{
i = Arrays.hashCode((char[])localObject1);
break label380;
}
if (localObject2.equals(Long.TYPE))
{
i = Arrays.hashCode((long[])localObject1);
break label380;
}
if (localObject2.equals(Float.TYPE))
{
i = Arrays.hashCode((float[])localObject1);
break label380;
}
if (localObject2.equals(Double.TYPE))
{
i = Arrays.hashCode((double[])localObject1);
break label380;
}
if (localObject2.equals(Boolean.TYPE))
{
i = Arrays.hashCode((boolean[])localObject1);
break label380;
}
i = Arrays.hashCode((Object[])localObject1);
break label380;
}
if ((localObject1 instanceof Annotation))
{
i = hashCode((Annotation)localObject1) ^ n;
}
else
{
i = localObject1.hashCode();
i ^= n;
}
}
catch (Exception paramAnnotation)
{
throw new RuntimeException(paramAnnotation);
}
}
return k;
label380:
i ^= n;
k += i;
j += 1;
}
}
public static boolean isValidAnnotationMemberType(Class<?> paramClass)
{
if (paramClass == null) {}
Object localObject;
do
{
return false;
localObject = paramClass;
if (paramClass.isArray()) {
localObject = paramClass.getComponentType();
}
} while ((!((Class)localObject).isPrimitive()) && (!((Class)localObject).isEnum()) && (!((Class)localObject).isAnnotation()) && (!String.class.equals(localObject)) && (!Class.class.equals(localObject)));
return true;
}
public static String toString(Annotation paramAnnotation)
{
int i = 0;
ToStringBuilder localToStringBuilder = new ToStringBuilder(paramAnnotation, a);
Method[] arrayOfMethod = paramAnnotation.annotationType().getDeclaredMethods();
int j = arrayOfMethod.length;
while (i < j)
{
Method localMethod = arrayOfMethod[i];
if (localMethod.getParameterTypes().length <= 0) {}
try
{
localToStringBuilder.append(localMethod.getName(), localMethod.invoke(paramAnnotation, new Object[0]));
i += 1;
}
catch (RuntimeException paramAnnotation)
{
throw paramAnnotation;
}
catch (Exception paramAnnotation)
{
throw new RuntimeException(paramAnnotation);
}
}
return localToStringBuilder.build();
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/org/apache/commons/lang3/AnnotationUtils.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/