51 lines
1.7 KiB
Java
51 lines
1.7 KiB
Java
|
package o;
|
||
|
|
||
|
import com.google.gson.Gson;
|
||
|
import com.google.gson.TypeAdapter;
|
||
|
import com.google.gson.TypeAdapterFactory;
|
||
|
import com.google.gson.reflect.TypeToken;
|
||
|
import com.google.gson.stream.JsonReader;
|
||
|
import com.google.gson.stream.JsonWriter;
|
||
|
import java.io.IOException;
|
||
|
import java.lang.Enum;
|
||
|
|
||
|
/* renamed from: o.fRx, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes6.dex */
|
||
|
public final class C13141fRx<T extends Enum> implements TypeAdapterFactory {
|
||
|
private final Class<T> b;
|
||
|
private final T c;
|
||
|
|
||
|
public C13141fRx(Class<T> cls, T t) {
|
||
|
this.b = cls;
|
||
|
this.c = t;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.gson.TypeAdapterFactory
|
||
|
public final <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
||
|
if (this.b.isAssignableFrom(typeToken.getRawType())) {
|
||
|
return new fRA(new TypeAdapter<T>(this, gson.getDelegateAdapter(this, typeToken)) { // from class: o.fRx.1
|
||
|
private TypeAdapter a;
|
||
|
private C13141fRx b;
|
||
|
|
||
|
{
|
||
|
this.b = this;
|
||
|
this.a = r2;
|
||
|
}
|
||
|
|
||
|
@Override // com.google.gson.TypeAdapter
|
||
|
public final void write(JsonWriter jsonWriter, T t) throws IOException {
|
||
|
this.a.write(jsonWriter, t);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.gson.TypeAdapter
|
||
|
/* renamed from: read */
|
||
|
public final T read2(JsonReader jsonReader) throws IOException {
|
||
|
T t = (T) this.a.read2(jsonReader);
|
||
|
return t == null ? (T) this.b.c : t;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
}
|