discord-jadx/app/src/main/java/com/discord/api/guildjoinrequest/ApplicationStatusTypeAdapter.java
2021-06-27 22:44:35 +02:00

61 lines
2.4 KiB
Java

package com.discord.api.guildjoinrequest;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import d0.z.d.m;
import java.util.Locale;
import java.util.Objects;
/* compiled from: ApplicationStatus.kt */
public final class ApplicationStatusTypeAdapter extends TypeAdapter<ApplicationStatus> {
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // com.google.gson.TypeAdapter
public ApplicationStatus read(JsonReader jsonReader) {
m.checkNotNullParameter(jsonReader, "in");
String K = jsonReader.K();
if (K != null) {
switch (K.hashCode()) {
case -1179202463:
if (K.equals("STARTED")) {
return ApplicationStatus.STARTED;
}
break;
case 35394935:
if (K.equals("PENDING")) {
return ApplicationStatus.PENDING;
}
break;
case 174130302:
if (K.equals("REJECTED")) {
return ApplicationStatus.REJECTED;
}
break;
case 1967871671:
if (K.equals("APPROVED")) {
return ApplicationStatus.APPROVED;
}
break;
}
}
return ApplicationStatus.UNKNOWN;
}
/* 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, ApplicationStatus applicationStatus) {
ApplicationStatus applicationStatus2 = applicationStatus;
m.checkNotNullParameter(jsonWriter, "out");
if (applicationStatus2 != null) {
String name = applicationStatus2.name();
Locale locale = Locale.ROOT;
m.checkNotNullExpressionValue(locale, "Locale.ROOT");
Objects.requireNonNull(name, "null cannot be cast to non-null type java.lang.String");
String upperCase = name.toUpperCase(locale);
m.checkNotNullExpressionValue(upperCase, "(this as java.lang.String).toUpperCase(locale)");
jsonWriter.H(upperCase);
return;
}
jsonWriter.s();
}
}