140 lines
4.3 KiB
Java
140 lines
4.3 KiB
Java
package com.google.gson.internal;
|
|
|
|
import c.i.d.a;
|
|
import c.i.d.o;
|
|
import c.i.d.p.c;
|
|
import c.i.d.p.d;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.TypeAdapter;
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.google.gson.stream.JsonReader;
|
|
import com.google.gson.stream.JsonWriter;
|
|
import java.io.IOException;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
public final class Excluder implements o, Cloneable {
|
|
public static final Excluder i = new Excluder();
|
|
public double j = -1.0d;
|
|
public int k = 136;
|
|
public boolean l = true;
|
|
public List<a> m = Collections.emptyList();
|
|
public List<a> n = Collections.emptyList();
|
|
|
|
/* renamed from: com.google.gson.internal.Excluder$1 reason: invalid class name */
|
|
public class AnonymousClass1 extends TypeAdapter<T> {
|
|
public TypeAdapter<T> a;
|
|
public final /* synthetic */ boolean b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final /* synthetic */ boolean f2357c;
|
|
public final /* synthetic */ Gson d;
|
|
public final /* synthetic */ TypeToken e;
|
|
|
|
public AnonymousClass1(boolean z2, boolean z3, Gson gson, TypeToken typeToken) {
|
|
this.b = z2;
|
|
this.f2357c = z3;
|
|
this.d = gson;
|
|
this.e = typeToken;
|
|
}
|
|
|
|
/* JADX WARNING: Unknown variable types count: 1 */
|
|
@Override // com.google.gson.TypeAdapter
|
|
public T read(JsonReader jsonReader) throws IOException {
|
|
if (this.b) {
|
|
jsonReader.U();
|
|
return null;
|
|
}
|
|
TypeAdapter typeAdapter = this.a;
|
|
if (typeAdapter == null) {
|
|
typeAdapter = this.d.j(Excluder.this, this.e);
|
|
this.a = typeAdapter;
|
|
}
|
|
return typeAdapter.read(jsonReader);
|
|
}
|
|
|
|
@Override // com.google.gson.TypeAdapter
|
|
public void write(JsonWriter jsonWriter, T t) throws IOException {
|
|
if (this.f2357c) {
|
|
jsonWriter.s();
|
|
return;
|
|
}
|
|
TypeAdapter typeAdapter = this.a;
|
|
if (typeAdapter == null) {
|
|
typeAdapter = this.d.j(Excluder.this, this.e);
|
|
this.a = typeAdapter;
|
|
}
|
|
typeAdapter.write(jsonWriter, t);
|
|
}
|
|
}
|
|
|
|
public final boolean b(Class<?> cls) {
|
|
if (this.j == -1.0d || i((c) cls.getAnnotation(c.class), (d) cls.getAnnotation(d.class))) {
|
|
return (!this.l && h(cls)) || g(cls);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // java.lang.Object
|
|
public Object clone() throws CloneNotSupportedException {
|
|
try {
|
|
return (Excluder) super.clone();
|
|
} catch (CloneNotSupportedException e) {
|
|
throw new AssertionError(e);
|
|
}
|
|
}
|
|
|
|
@Override // c.i.d.o
|
|
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
|
Class<? super T> rawType = typeToken.getRawType();
|
|
boolean b = b(rawType);
|
|
boolean z2 = b || f(rawType, true);
|
|
boolean z3 = b || f(rawType, false);
|
|
if (z2 || z3) {
|
|
return new AnonymousClass1(z3, z2, gson, typeToken);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final boolean f(Class<?> cls, boolean z2) {
|
|
for (a aVar : z2 ? this.m : this.n) {
|
|
if (aVar.b(cls)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final boolean g(Class<?> cls) {
|
|
return !Enum.class.isAssignableFrom(cls) && (cls.isAnonymousClass() || cls.isLocalClass());
|
|
}
|
|
|
|
public final boolean h(Class<?> cls) {
|
|
if (cls.isMemberClass()) {
|
|
if (!((cls.getModifiers() & 8) != 0)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final boolean i(c cVar, d dVar) {
|
|
if (!(cVar == null || cVar.value() <= this.j)) {
|
|
return false;
|
|
}
|
|
return dVar == null || (dVar.value() > this.j ? 1 : (dVar.value() == this.j ? 0 : -1)) > 0;
|
|
}
|
|
|
|
public Excluder j(int... iArr) {
|
|
try {
|
|
Excluder excluder = (Excluder) super.clone();
|
|
excluder.k = 0;
|
|
for (int i2 : iArr) {
|
|
excluder.k = i2 | excluder.k;
|
|
}
|
|
return excluder;
|
|
} catch (CloneNotSupportedException e) {
|
|
throw new AssertionError(e);
|
|
}
|
|
}
|
|
}
|