main.app.cash.better.dynamic.features.codegen.api.FeatureImplementationJsonAdapter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codegen-api Show documentation
Show all versions of codegen-api Show documentation
Internal APIs for the Better Dynamic Features code generator
// Code generated by moshi-kotlin-codegen. Do not edit.
@file:Suppress("DEPRECATION", "unused", "ClassName", "REDUNDANT_PROJECTION",
"RedundantExplicitType", "LocalVariableName", "RedundantVisibilityModifier",
"PLATFORM_CLASS_MAPPED_TO_KOTLIN", "IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION")
package app.cash.better.`dynamic`.features.codegen.api
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 FeatureImplementationJsonAdapter(
moshi: Moshi,
) : JsonAdapter() {
private val options: JsonReader.Options = JsonReader.Options.of("qualifiedName", "parentClass")
private val stringAdapter: JsonAdapter = moshi.adapter(String::class.java, emptySet(),
"qualifiedName")
private val featureApiAdapter: JsonAdapter = moshi.adapter(FeatureApi::class.java,
emptySet(), "parentClass")
public override fun toString(): String = buildString(43) {
append("GeneratedJsonAdapter(").append("FeatureImplementation").append(')') }
public override fun fromJson(reader: JsonReader): FeatureImplementation {
var qualifiedName: String? = null
var parentClass: FeatureApi? = null
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> qualifiedName = stringAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("qualifiedName", "qualifiedName", reader)
1 -> parentClass = featureApiAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("parentClass", "parentClass", reader)
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
return FeatureImplementation(
qualifiedName = qualifiedName ?: throw Util.missingProperty("qualifiedName",
"qualifiedName", reader),
parentClass = parentClass ?: throw Util.missingProperty("parentClass", "parentClass",
reader)
)
}
public override fun toJson(writer: JsonWriter, value_: FeatureImplementation?): Unit {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("qualifiedName")
stringAdapter.toJson(writer, value_.qualifiedName)
writer.name("parentClass")
featureApiAdapter.toJson(writer, value_.parentClass)
writer.endObject()
}
}