what-the-bank/sources/com/facetec/sdk/eq.java

298 lines
9.9 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.facetec.sdk;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
/* loaded from: classes.dex */
public final class eq {
private final Map<Type, dz<?>> b;
private final fx e = fx.d();
public eq(Map<Type, dz<?>> map) {
this.b = map;
}
public final <T> fc<T> d(fv<T> fvVar) {
fc<T> fcVar;
Type b = fvVar.b();
Class<? super T> a = fvVar.a();
dz<?> dzVar = this.b.get(b);
if (dzVar != null) {
return new fc<T>(this, dzVar, b) { // from class: com.facetec.sdk.eq.2
private Type a;
private dz b;
private eq c;
{
this.c = this;
this.b = dzVar;
this.a = b;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) this.b.b();
}
};
}
dz<?> dzVar2 = this.b.get(a);
if (dzVar2 != null) {
return new fc<T>(this, dzVar2, b) { // from class: com.facetec.sdk.eq.7
private Type b;
private dz d;
private eq e;
{
this.e = this;
this.d = dzVar2;
this.b = b;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) this.d.b();
}
};
}
fc<T> d = d(a);
if (d != null) {
return d;
}
if (Collection.class.isAssignableFrom(a)) {
if (SortedSet.class.isAssignableFrom(a)) {
fcVar = new fc<T>(this) { // from class: com.facetec.sdk.eq.8
private eq b;
{
this.b = this;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) new TreeSet();
}
};
} else if (EnumSet.class.isAssignableFrom(a)) {
fcVar = new fc<T>(this, b) { // from class: com.facetec.sdk.eq.6
private eq b;
private Type d;
{
this.b = this;
this.d = b;
}
@Override // com.facetec.sdk.fc
public final T c() {
Type type = this.d;
if (type instanceof ParameterizedType) {
Type type2 = ((ParameterizedType) type).getActualTypeArguments()[0];
if (type2 instanceof Class) {
return (T) EnumSet.noneOf((Class) type2);
}
StringBuilder sb = new StringBuilder("Invalid EnumSet type: ");
sb.append(this.d.toString());
throw new ed(sb.toString());
}
StringBuilder sb2 = new StringBuilder("Invalid EnumSet type: ");
sb2.append(this.d.toString());
throw new ed(sb2.toString());
}
};
} else if (Set.class.isAssignableFrom(a)) {
fcVar = new fc<T>(this) { // from class: com.facetec.sdk.eq.15
private eq d;
{
this.d = this;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) new LinkedHashSet();
}
};
} else if (Queue.class.isAssignableFrom(a)) {
fcVar = new fc<T>(this) { // from class: com.facetec.sdk.eq.13
private eq b;
{
this.b = this;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) new ArrayDeque();
}
};
} else {
fcVar = new fc<T>(this) { // from class: com.facetec.sdk.eq.14
private eq c;
{
this.c = this;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) new ArrayList();
}
};
}
} else if (!Map.class.isAssignableFrom(a)) {
fcVar = null;
} else if (ConcurrentNavigableMap.class.isAssignableFrom(a)) {
fcVar = new fc<T>(this) { // from class: com.facetec.sdk.eq.11
private eq c;
{
this.c = this;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) new ConcurrentSkipListMap();
}
};
} else if (ConcurrentMap.class.isAssignableFrom(a)) {
fcVar = new fc<T>(this) { // from class: com.facetec.sdk.eq.4
private eq a;
{
this.a = this;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) new ConcurrentHashMap();
}
};
} else if (SortedMap.class.isAssignableFrom(a)) {
fcVar = new fc<T>(this) { // from class: com.facetec.sdk.eq.5
private eq a;
{
this.a = this;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) new TreeMap();
}
};
} else if ((b instanceof ParameterizedType) && !String.class.isAssignableFrom(fv.b(((ParameterizedType) b).getActualTypeArguments()[0]).a())) {
fcVar = new fc<T>(this) { // from class: com.facetec.sdk.eq.3
private eq c;
{
this.c = this;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) new LinkedHashMap();
}
};
} else {
fcVar = new fc<T>(this) { // from class: com.facetec.sdk.eq.1
private eq c;
{
this.c = this;
}
@Override // com.facetec.sdk.fc
public final T c() {
return (T) new ey();
}
};
}
return fcVar != null ? fcVar : new fc<T>(this, a, b) { // from class: com.facetec.sdk.eq.10
private Type a;
private eq b;
private final fb c = fb.a();
private Class e;
{
this.b = this;
this.e = a;
this.a = b;
}
@Override // com.facetec.sdk.fc
public final T c() {
try {
return (T) this.c.b(this.e);
} catch (Exception e) {
StringBuilder sb = new StringBuilder("Unable to invoke no-args constructor for ");
sb.append(this.a);
sb.append(". Registering an InstanceCreator with Gson for this type may fix this problem.");
throw new RuntimeException(sb.toString(), e);
}
}
};
}
private <T> fc<T> d(Class<? super T> cls) {
try {
Constructor<? super T> declaredConstructor = cls.getDeclaredConstructor(new Class[0]);
if (!declaredConstructor.isAccessible()) {
this.e.c(declaredConstructor);
}
return new fc<T>(this, declaredConstructor) { // from class: com.facetec.sdk.eq.9
private eq a;
private Constructor e;
{
this.a = this;
this.e = declaredConstructor;
}
@Override // com.facetec.sdk.fc
public final T c() {
try {
return (T) this.e.newInstance(null);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
} catch (InstantiationException e2) {
StringBuilder sb = new StringBuilder("Failed to invoke ");
sb.append(this.e);
sb.append(" with no args");
throw new RuntimeException(sb.toString(), e2);
} catch (InvocationTargetException e3) {
StringBuilder sb2 = new StringBuilder("Failed to invoke ");
sb2.append(this.e);
sb2.append(" with no args");
throw new RuntimeException(sb2.toString(), e3.getTargetException());
}
}
};
} catch (NoSuchMethodException unused) {
return null;
}
}
public final String toString() {
return this.b.toString();
}
}