edu.illinois.cs.cs125.questioner.lib.moshi.MethodInfoJsonAdapter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lib Show documentation
Show all versions of lib Show documentation
Question authoring library for CS 124.
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "UNUSED_PARAMETER", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package edu.illinois.cs.cs125.questioner.lib.moshi
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.squareup.moshi.JsonWriter
import com.squareup.moshi.Moshi
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.emptySet
import kotlin.text.buildString
public class MethodInfoJsonAdapter(
moshi: Moshi,
) : JsonAdapter() {
private val options: JsonReader.Options = JsonReader.Options.of("className", "methodName",
"descriptor")
private val stringAdapter: JsonAdapter = moshi.adapter(String::class.java, emptySet(),
"className")
public override fun toString(): String = buildString(32) {
append("GeneratedJsonAdapter(").append("MethodInfo").append(')') }
public override fun fromJson(reader: JsonReader): MethodInfo {
var className: String? = null
var methodName: String? = null
var descriptor: String? = null
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> className = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("className",
"className", reader)
1 -> methodName = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("methodName",
"methodName", reader)
2 -> descriptor = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("descriptor",
"descriptor", reader)
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
return MethodInfo(
className = className ?: throw Util.missingProperty("className", "className", reader),
methodName = methodName ?: throw Util.missingProperty("methodName", "methodName", reader),
descriptor = descriptor ?: throw Util.missingProperty("descriptor", "descriptor", reader)
)
}
public override fun toJson(writer: JsonWriter, value_: MethodInfo?): Unit {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("className")
stringAdapter.toJson(writer, value_.className)
writer.name("methodName")
stringAdapter.toJson(writer, value_.methodName)
writer.name("descriptor")
stringAdapter.toJson(writer, value_.descriptor)
writer.endObject()
}
}