what-the-bank/sources/o/C13100fQn.java

219 lines
7.8 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapter;
import com.google.gson.internal.bind.util.ISO8601Utils;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
import org.threeten.bp.OffsetDateTime;
/* renamed from: o.fQn, reason: case insensitive filesystem */
/* loaded from: classes5.dex */
public final class C13100fQn {
Gson b;
private boolean d = false;
private IeS e = new IeS();
private RVV a = new RVV();
private LWm c = new LWm();
private Sts f = new Sts(this);
/* renamed from: o.fQn$IeS */
/* loaded from: classes5.dex */
public static class IeS extends TypeAdapter<Date> {
private DateFormat e;
@Override // com.google.gson.TypeAdapter
public final /* synthetic */ void write(JsonWriter jsonWriter, Date date) throws IOException {
Date date2 = date;
if (date2 == null) {
jsonWriter.nullValue();
} else {
jsonWriter.value(ISO8601Utils.format(date2, true));
}
}
/* JADX INFO: Access modifiers changed from: private */
@Override // com.google.gson.TypeAdapter
/* renamed from: b, reason: merged with bridge method [inline-methods] */
public Date read2(JsonReader jsonReader) throws IOException {
try {
if (AnonymousClass2.b[jsonReader.peek().ordinal()] == 1) {
jsonReader.nextNull();
return null;
}
try {
return ISO8601Utils.parse(jsonReader.nextString(), new ParsePosition(0));
} catch (ParseException e) {
throw new JsonParseException(e);
}
} catch (IllegalArgumentException e2) {
throw new JsonParseException(e2);
}
}
}
/* renamed from: o.fQn$LWm */
/* loaded from: classes5.dex */
public static class LWm extends TypeAdapter<OffsetDateTime> {
private C15554gto a;
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public final /* synthetic */ OffsetDateTime read2(JsonReader jsonReader) throws IOException {
if (AnonymousClass2.b[jsonReader.peek().ordinal()] != 1) {
return OffsetDateTime.parse(Pattern.compile("([+-])(\\d{2})(\\d{2})$").matcher(jsonReader.nextString()).replaceAll("$1$2:$3"), this.a);
}
jsonReader.nextNull();
return null;
}
@Override // com.google.gson.TypeAdapter
public final /* synthetic */ void write(JsonWriter jsonWriter, OffsetDateTime offsetDateTime) throws IOException {
OffsetDateTime offsetDateTime2 = offsetDateTime;
if (offsetDateTime2 == null) {
jsonWriter.nullValue();
} else {
jsonWriter.value(this.a.format(offsetDateTime2));
}
}
private LWm(C15554gto c15554gto) {
this.a = c15554gto;
}
public LWm() {
this(C15554gto.ISO_OFFSET_DATE_TIME);
}
}
/* renamed from: o.fQn$RVV */
/* loaded from: classes5.dex */
public static class RVV extends TypeAdapter<java.sql.Date> {
private DateFormat d;
@Override // com.google.gson.TypeAdapter
public final /* synthetic */ void write(JsonWriter jsonWriter, java.sql.Date date) throws IOException {
java.sql.Date date2 = date;
if (date2 == null) {
jsonWriter.nullValue();
} else {
jsonWriter.value(date2.toString());
}
}
/* JADX INFO: Access modifiers changed from: private */
@Override // com.google.gson.TypeAdapter
/* renamed from: d, reason: merged with bridge method [inline-methods] */
public java.sql.Date read2(JsonReader jsonReader) throws IOException {
if (AnonymousClass2.b[jsonReader.peek().ordinal()] == 1) {
jsonReader.nextNull();
return null;
}
try {
return new java.sql.Date(ISO8601Utils.parse(jsonReader.nextString(), new ParsePosition(0)).getTime());
} catch (ParseException e) {
throw new JsonParseException(e);
}
}
}
/* renamed from: o.fQn$Sts */
/* loaded from: classes5.dex */
public class Sts extends TypeAdapter<C15520gsp> {
private C15554gto b;
private C13100fQn d;
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public final /* synthetic */ C15520gsp read2(JsonReader jsonReader) throws IOException {
if (AnonymousClass2.b[jsonReader.peek().ordinal()] != 1) {
return C15520gsp.parse(jsonReader.nextString(), this.b);
}
jsonReader.nextNull();
return null;
}
@Override // com.google.gson.TypeAdapter
public final /* synthetic */ void write(JsonWriter jsonWriter, C15520gsp c15520gsp) throws IOException {
C15520gsp c15520gsp2 = c15520gsp;
if (c15520gsp2 == null) {
jsonWriter.nullValue();
} else {
jsonWriter.value(this.b.format(c15520gsp2));
}
}
private Sts(C13100fQn c13100fQn, C15554gto c15554gto) {
this.d = c13100fQn;
this.b = c15554gto;
}
public Sts(C13100fQn c13100fQn) {
this(c13100fQn, C15554gto.ISO_LOCAL_DATE);
}
}
public C13100fQn() {
C13135fRq c13135fRq = new C13135fRq();
Collections.newSetFromMap(new ConcurrentHashMap());
GsonBuilder gsonBuilder = new GsonBuilder();
boolean z = c13135fRq.a;
boolean z2 = c13135fRq.b;
Iterator<Class> it = c13135fRq.h.iterator();
while (it.hasNext()) {
C13138fRt c13138fRt = c13135fRq.e.get(it.next());
Object obj = c13138fRt.c;
gsonBuilder.registerTypeAdapterFactory(new fRB(c13138fRt));
}
for (Map.Entry<Class, Enum> entry : c13135fRq.c.entrySet()) {
gsonBuilder.registerTypeAdapterFactory(new C13141fRx(entry.getKey(), entry.getValue()));
}
EnumC13139fRu enumC13139fRu = c13135fRq.d;
gsonBuilder.registerTypeAdapterFactory(new C13140fRv());
gsonBuilder.registerTypeAdapterFactory(new fRC(c13135fRq.f));
this.b = gsonBuilder.registerTypeAdapter(Date.class, this.e).registerTypeAdapter(java.sql.Date.class, this.a).registerTypeAdapter(OffsetDateTime.class, this.c).registerTypeAdapter(C15520gsp.class, this.f).create();
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.fQn$2, reason: invalid class name */
/* loaded from: classes5.dex */
public static /* synthetic */ class AnonymousClass2 {
static final int[] b;
static {
int[] iArr = new int[JsonToken.values().length];
b = iArr;
try {
iArr[JsonToken.NULL.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
}
}
/* JADX WARN: Multi-variable type inference failed */
public final <T> T b(String str, Type type) {
try {
return (T) this.b.fromJson(str, type);
} catch (JsonParseException e) {
if (type.equals(String.class)) {
return str;
}
throw e;
}
}
}