72 lines
2.5 KiB
Java
72 lines
2.5 KiB
Java
package com.discord.api.user;
|
|
|
|
import com.google.gson.TypeAdapter;
|
|
import com.google.gson.stream.JsonReader;
|
|
import com.google.gson.stream.JsonToken;
|
|
import com.google.gson.stream.JsonWriter;
|
|
import d0.z.d.m;
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
/* compiled from: NsfwAllowance.kt */
|
|
public final class NsfwAllowanceTypeAdapter extends TypeAdapter<NsfwAllowance> {
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
static {
|
|
NsfwAllowance.values();
|
|
int[] iArr = new int[3];
|
|
$EnumSwitchMapping$0 = iArr;
|
|
iArr[NsfwAllowance.UNKNOWN.ordinal()] = 1;
|
|
iArr[NsfwAllowance.ALLOWED.ordinal()] = 2;
|
|
iArr[NsfwAllowance.DISALLOWED.ordinal()] = 3;
|
|
}
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
@Override // com.google.gson.TypeAdapter
|
|
public NsfwAllowance read(JsonReader jsonReader) {
|
|
Boolean bool;
|
|
m.checkNotNullParameter(jsonReader, "in");
|
|
m.checkNotNullParameter(jsonReader, "$this$nextBooleanOrNull");
|
|
if (jsonReader.N() == JsonToken.NULL) {
|
|
jsonReader.H();
|
|
bool = null;
|
|
} else {
|
|
bool = Boolean.valueOf(jsonReader.w());
|
|
}
|
|
if (m.areEqual(bool, Boolean.TRUE)) {
|
|
return NsfwAllowance.ALLOWED;
|
|
}
|
|
if (m.areEqual(bool, Boolean.FALSE)) {
|
|
return NsfwAllowance.DISALLOWED;
|
|
}
|
|
if (bool == null) {
|
|
return NsfwAllowance.UNKNOWN;
|
|
}
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [com.google.gson.stream.JsonWriter, java.lang.Object] */
|
|
@Override // com.google.gson.TypeAdapter
|
|
public void write(JsonWriter jsonWriter, NsfwAllowance nsfwAllowance) {
|
|
Boolean bool;
|
|
NsfwAllowance nsfwAllowance2 = nsfwAllowance;
|
|
m.checkNotNullParameter(jsonWriter, "out");
|
|
if (nsfwAllowance2 != null) {
|
|
int ordinal = nsfwAllowance2.ordinal();
|
|
if (ordinal == 0) {
|
|
bool = null;
|
|
} else if (ordinal == 1) {
|
|
bool = Boolean.TRUE;
|
|
} else if (ordinal == 2) {
|
|
bool = Boolean.FALSE;
|
|
} else {
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
jsonWriter.C(bool);
|
|
return;
|
|
}
|
|
jsonWriter.s();
|
|
}
|
|
}
|