Excluder.java
6.92 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
package com.google.gson.internal;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.Since;
import com.google.gson.annotations.Until;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public final class Excluder
implements TypeAdapterFactory, Cloneable
{
public static final Excluder DEFAULT = new Excluder();
private double a = -1.0D;
private int b = 136;
private boolean c = true;
private boolean d;
private List<ExclusionStrategy> e = Collections.emptyList();
private List<ExclusionStrategy> f = Collections.emptyList();
private boolean a(Since paramSince, Until paramUntil)
{
if ((paramSince != null) && (paramSince.value() > this.a))
{
i = 0;
if (i == 0) {
break label60;
}
if ((paramUntil == null) || (paramUntil.value() > this.a)) {
break label55;
}
}
label55:
for (int i = 0;; i = 1)
{
if (i == 0) {
break label60;
}
return true;
i = 1;
break;
}
label60:
return false;
}
private static boolean a(Class<?> paramClass)
{
return (!Enum.class.isAssignableFrom(paramClass)) && ((paramClass.isAnonymousClass()) || (paramClass.isLocalClass()));
}
private static boolean b(Class<?> paramClass)
{
if (paramClass.isMemberClass())
{
if ((paramClass.getModifiers() & 0x8) != 0) {}
for (int i = 1; i == 0; i = 0) {
return true;
}
}
return false;
}
protected final Excluder clone()
{
try
{
Excluder localExcluder = (Excluder)super.clone();
return localExcluder;
}
catch (CloneNotSupportedException localCloneNotSupportedException)
{
throw new AssertionError();
}
}
public final <T> TypeAdapter<T> create(final Gson paramGson, final TypeToken<T> paramTypeToken)
{
Class localClass = paramTypeToken.getRawType();
final boolean bool1 = excludeClass(localClass, true);
final boolean bool2 = excludeClass(localClass, false);
if ((!bool1) && (!bool2)) {
return null;
}
new TypeAdapter()
{
private TypeAdapter<T> f;
private TypeAdapter<T> a()
{
TypeAdapter localTypeAdapter = this.f;
if (localTypeAdapter != null) {
return localTypeAdapter;
}
localTypeAdapter = paramGson.getDelegateAdapter(Excluder.this, paramTypeToken);
this.f = localTypeAdapter;
return localTypeAdapter;
}
public final T read(JsonReader paramAnonymousJsonReader)
throws IOException
{
if (bool2)
{
paramAnonymousJsonReader.skipValue();
return null;
}
return (T)a().read(paramAnonymousJsonReader);
}
public final void write(JsonWriter paramAnonymousJsonWriter, T paramAnonymousT)
throws IOException
{
if (bool1)
{
paramAnonymousJsonWriter.nullValue();
return;
}
a().write(paramAnonymousJsonWriter, paramAnonymousT);
}
};
}
public final Excluder disableInnerClassSerialization()
{
Excluder localExcluder = clone();
localExcluder.c = false;
return localExcluder;
}
public final boolean excludeClass(Class<?> paramClass, boolean paramBoolean)
{
if ((this.a != -1.0D) && (!a((Since)paramClass.getAnnotation(Since.class), (Until)paramClass.getAnnotation(Until.class)))) {
return true;
}
if ((!this.c) && (b(paramClass))) {
return true;
}
if (a(paramClass)) {
return true;
}
if (paramBoolean) {}
for (Object localObject = this.e;; localObject = this.f)
{
localObject = ((List)localObject).iterator();
do
{
if (!((Iterator)localObject).hasNext()) {
break;
}
} while (!((ExclusionStrategy)((Iterator)localObject).next()).shouldSkipClass(paramClass));
return true;
}
return false;
}
public final boolean excludeField(Field paramField, boolean paramBoolean)
{
if ((this.b & paramField.getModifiers()) != 0) {
return true;
}
if ((this.a != -1.0D) && (!a((Since)paramField.getAnnotation(Since.class), (Until)paramField.getAnnotation(Until.class)))) {
return true;
}
if (paramField.isSynthetic()) {
return true;
}
if (this.d)
{
localObject = (Expose)paramField.getAnnotation(Expose.class);
if (localObject != null)
{
if (!paramBoolean) {
break label97;
}
if (((Expose)localObject).serialize()) {
break label106;
}
}
label97:
while (!((Expose)localObject).deserialize()) {
return true;
}
}
label106:
if ((!this.c) && (b(paramField.getType()))) {
return true;
}
if (a(paramField.getType())) {
return true;
}
if (paramBoolean) {}
for (Object localObject = this.e; !((List)localObject).isEmpty(); localObject = this.f)
{
paramField = new FieldAttributes(paramField);
localObject = ((List)localObject).iterator();
do
{
if (!((Iterator)localObject).hasNext()) {
break;
}
} while (!((ExclusionStrategy)((Iterator)localObject).next()).shouldSkipField(paramField));
return true;
}
return false;
}
public final Excluder excludeFieldsWithoutExposeAnnotation()
{
Excluder localExcluder = clone();
localExcluder.d = true;
return localExcluder;
}
public final Excluder withExclusionStrategy(ExclusionStrategy paramExclusionStrategy, boolean paramBoolean1, boolean paramBoolean2)
{
Excluder localExcluder = clone();
if (paramBoolean1)
{
localExcluder.e = new ArrayList(this.e);
localExcluder.e.add(paramExclusionStrategy);
}
if (paramBoolean2)
{
localExcluder.f = new ArrayList(this.f);
localExcluder.f.add(paramExclusionStrategy);
}
return localExcluder;
}
public final Excluder withModifiers(int... paramVarArgs)
{
int i = 0;
Excluder localExcluder = clone();
localExcluder.b = 0;
int j = paramVarArgs.length;
while (i < j)
{
localExcluder.b = (paramVarArgs[i] | localExcluder.b);
i += 1;
}
return localExcluder;
}
public final Excluder withVersion(double paramDouble)
{
Excluder localExcluder = clone();
localExcluder.a = paramDouble;
return localExcluder;
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/gson/internal/Excluder.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/