discord-jadx/app/src/main/java/com/google/gson/JsonElement.java

43 lines
1.2 KiB
Java

package com.google.gson;
import c.i.d.k;
import com.google.gson.internal.bind.TypeAdapters;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.io.StringWriter;
public abstract class JsonElement {
public int c() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public JsonObject d() {
if (this instanceof JsonObject) {
return (JsonObject) this;
}
throw new IllegalStateException("Not a JSON Object: " + this);
}
public k e() {
if (this instanceof k) {
return (k) this;
}
throw new IllegalStateException("Not a JSON Primitive: " + this);
}
public String g() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public String toString() {
try {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = new JsonWriter(stringWriter);
jsonWriter.p = true;
TypeAdapters.X.write(jsonWriter, this);
return stringWriter.toString();
} catch (IOException e) {
throw new AssertionError(e);
}
}
}