Initial import of ADIF API reverse-engineering toolkit
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
package retrofit2.converter.moshi;
|
||||
|
||||
import Z2.AbstractC0104l;
|
||||
import Z2.D;
|
||||
import Z2.G;
|
||||
import Z2.o;
|
||||
import e3.M;
|
||||
import e3.T;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import retrofit2.Converter;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public final class MoshiConverterFactory extends Converter.Factory {
|
||||
private final boolean failOnUnknown;
|
||||
private final boolean lenient;
|
||||
private final G moshi;
|
||||
private final boolean serializeNulls;
|
||||
|
||||
private MoshiConverterFactory(G g4, boolean z3, boolean z4, boolean z5) {
|
||||
this.moshi = g4;
|
||||
this.lenient = z3;
|
||||
this.failOnUnknown = z4;
|
||||
this.serializeNulls = z5;
|
||||
}
|
||||
|
||||
public static MoshiConverterFactory create() {
|
||||
return create(new G(new D()));
|
||||
}
|
||||
|
||||
private static Set<? extends Annotation> jsonAnnotations(Annotation[] annotationArr) {
|
||||
LinkedHashSet linkedHashSet = null;
|
||||
for (Annotation annotation : annotationArr) {
|
||||
if (annotation.annotationType().isAnnotationPresent(o.class)) {
|
||||
if (linkedHashSet == null) {
|
||||
linkedHashSet = new LinkedHashSet();
|
||||
}
|
||||
linkedHashSet.add(annotation);
|
||||
}
|
||||
}
|
||||
return linkedHashSet != null ? Collections.unmodifiableSet(linkedHashSet) : Collections.EMPTY_SET;
|
||||
}
|
||||
|
||||
public MoshiConverterFactory asLenient() {
|
||||
return new MoshiConverterFactory(this.moshi, true, this.failOnUnknown, this.serializeNulls);
|
||||
}
|
||||
|
||||
public MoshiConverterFactory failOnUnknown() {
|
||||
return new MoshiConverterFactory(this.moshi, this.lenient, true, this.serializeNulls);
|
||||
}
|
||||
|
||||
@Override // retrofit2.Converter.Factory
|
||||
public Converter<?, M> requestBodyConverter(Type type, Annotation[] annotationArr, Annotation[] annotationArr2, Retrofit retrofit) {
|
||||
AbstractC0104l c4 = this.moshi.c(type, jsonAnnotations(annotationArr), null);
|
||||
if (this.lenient) {
|
||||
c4 = c4.lenient();
|
||||
}
|
||||
if (this.failOnUnknown) {
|
||||
c4 = c4.failOnUnknown();
|
||||
}
|
||||
if (this.serializeNulls) {
|
||||
c4 = c4.serializeNulls();
|
||||
}
|
||||
return new MoshiRequestBodyConverter(c4);
|
||||
}
|
||||
|
||||
@Override // retrofit2.Converter.Factory
|
||||
public Converter<T, ?> responseBodyConverter(Type type, Annotation[] annotationArr, Retrofit retrofit) {
|
||||
AbstractC0104l c4 = this.moshi.c(type, jsonAnnotations(annotationArr), null);
|
||||
if (this.lenient) {
|
||||
c4 = c4.lenient();
|
||||
}
|
||||
if (this.failOnUnknown) {
|
||||
c4 = c4.failOnUnknown();
|
||||
}
|
||||
if (this.serializeNulls) {
|
||||
c4 = c4.serializeNulls();
|
||||
}
|
||||
return new MoshiResponseBodyConverter(c4);
|
||||
}
|
||||
|
||||
public MoshiConverterFactory withNullSerialization() {
|
||||
return new MoshiConverterFactory(this.moshi, this.lenient, this.failOnUnknown, true);
|
||||
}
|
||||
|
||||
public static MoshiConverterFactory create(G g4) {
|
||||
if (g4 != null) {
|
||||
return new MoshiConverterFactory(g4, false, false, false);
|
||||
}
|
||||
throw new NullPointerException("moshi == null");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package retrofit2.converter.moshi;
|
||||
|
||||
import Z2.AbstractC0104l;
|
||||
import Z2.t;
|
||||
import e3.A;
|
||||
import e3.M;
|
||||
import e3.z;
|
||||
import java.io.IOException;
|
||||
import java.util.regex.Pattern;
|
||||
import retrofit2.Converter;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
final class MoshiRequestBodyConverter<T> implements Converter<T, M> {
|
||||
private static final A MEDIA_TYPE;
|
||||
private final AbstractC0104l adapter;
|
||||
|
||||
static {
|
||||
Pattern pattern = A.f6197d;
|
||||
MEDIA_TYPE = z.a("application/json; charset=UTF-8");
|
||||
}
|
||||
|
||||
public MoshiRequestBodyConverter(AbstractC0104l abstractC0104l) {
|
||||
this.adapter = abstractC0104l;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // retrofit2.Converter
|
||||
public /* bridge */ /* synthetic */ M convert(Object obj) throws IOException {
|
||||
return convert((MoshiRequestBodyConverter<T>) obj);
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
/* JADX WARN: Type inference failed for: r0v0, types: [r3.i, java.lang.Object, r3.h] */
|
||||
@Override // retrofit2.Converter
|
||||
public M convert(T t2) throws IOException {
|
||||
?? obj = new Object();
|
||||
this.adapter.toJson(new t(obj), t2);
|
||||
return M.create(MEDIA_TYPE, obj.h(obj.f8284b));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package retrofit2.converter.moshi;
|
||||
|
||||
import Z2.AbstractC0104l;
|
||||
import Z2.q;
|
||||
import Z2.s;
|
||||
import e3.T;
|
||||
import f0.C0338b;
|
||||
import java.io.IOException;
|
||||
import r3.C0579k;
|
||||
import r3.InterfaceC0578j;
|
||||
import retrofit2.Converter;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
final class MoshiResponseBodyConverter<T> implements Converter<T, T> {
|
||||
private static final C0579k UTF8_BOM;
|
||||
private final AbstractC0104l adapter;
|
||||
|
||||
static {
|
||||
C0579k c0579k = C0579k.f8285d;
|
||||
UTF8_BOM = C0338b.m("EFBBBF");
|
||||
}
|
||||
|
||||
public MoshiResponseBodyConverter(AbstractC0104l abstractC0104l) {
|
||||
this.adapter = abstractC0104l;
|
||||
}
|
||||
|
||||
@Override // retrofit2.Converter
|
||||
public T convert(T t2) throws IOException {
|
||||
InterfaceC0578j source = t2.source();
|
||||
try {
|
||||
if (source.H(UTF8_BOM)) {
|
||||
source.l(r1.d());
|
||||
}
|
||||
s sVar = new s(source);
|
||||
T t4 = (T) this.adapter.fromJson(sVar);
|
||||
if (sVar.f0() == q.f2278j) {
|
||||
t2.close();
|
||||
return t4;
|
||||
}
|
||||
throw new RuntimeException("JSON document was not fully consumed.");
|
||||
} catch (Throwable th) {
|
||||
t2.close();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@EverythingIsNonNull
|
||||
package retrofit2.converter.moshi;
|
||||
|
||||
import retrofit2.internal.EverythingIsNonNull;
|
||||
|
||||
Reference in New Issue
Block a user