All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edu.illinois.cs.cs125.questioner.lib.TestResults_ComplexityComparisonJsonAdapter.kt Maven / Gradle / Ivy

There is a newer version: 2024.9.0
Show newest version
// 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

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 java.lang.reflect.Constructor
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString

public class TestResults_ComplexityComparisonJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("solution", "submission", "limit",
      "increase", "failed")

  private val intAdapter: JsonAdapter = moshi.adapter(Int::class.java, emptySet(), "solution")

  private val booleanAdapter: JsonAdapter = moshi.adapter(Boolean::class.java, emptySet(),
      "failed")

  @Volatile
  private var constructorRef: Constructor? = null

  public override fun toString(): String = buildString(54) {
      append("GeneratedJsonAdapter(").append("TestResults.ComplexityComparison").append(')') }

  public override fun fromJson(reader: JsonReader): TestResults.ComplexityComparison {
    var solution: Int? = null
    var submission: Int? = null
    var limit: Int? = null
    var increase: Int? = 0
    var failed: Boolean? = false
    var mask0 = -1
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> solution = intAdapter.fromJson(reader) ?: throw Util.unexpectedNull("solution",
            "solution", reader)
        1 -> submission = intAdapter.fromJson(reader) ?: throw Util.unexpectedNull("submission",
            "submission", reader)
        2 -> limit = intAdapter.fromJson(reader) ?: throw Util.unexpectedNull("limit", "limit",
            reader)
        3 -> {
          increase = intAdapter.fromJson(reader) ?: throw Util.unexpectedNull("increase",
              "increase", reader)
          // $mask = $mask and (1 shl 3).inv()
          mask0 = mask0 and 0xfffffff7.toInt()
        }
        4 -> {
          failed = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("failed", "failed",
              reader)
          // $mask = $mask and (1 shl 4).inv()
          mask0 = mask0 and 0xffffffef.toInt()
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    if (mask0 == 0xffffffe7.toInt()) {
      // All parameters with defaults are set, invoke the constructor directly
      return  TestResults.ComplexityComparison(
          solution = solution ?: throw Util.missingProperty("solution", "solution", reader),
          submission = submission ?: throw Util.missingProperty("submission", "submission", reader),
          limit = limit ?: throw Util.missingProperty("limit", "limit", reader),
          increase = increase as Int,
          failed = failed as Boolean
      )
    } else {
      // Reflectively invoke the synthetic defaults constructor
      @Suppress("UNCHECKED_CAST")
      val localConstructor: Constructor = this.constructorRef ?:
          TestResults.ComplexityComparison::class.java.getDeclaredConstructor(Int::class.javaPrimitiveType,
          Int::class.javaPrimitiveType, Int::class.javaPrimitiveType, Int::class.javaPrimitiveType,
          Boolean::class.javaPrimitiveType, Int::class.javaPrimitiveType,
          Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
      return localConstructor.newInstance(
          solution ?: throw Util.missingProperty("solution", "solution", reader),
          submission ?: throw Util.missingProperty("submission", "submission", reader),
          limit ?: throw Util.missingProperty("limit", "limit", reader),
          increase,
          failed,
          mask0,
          /* DefaultConstructorMarker */ null
      )
    }
  }

  public override fun toJson(writer: JsonWriter, value_: TestResults.ComplexityComparison?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("solution")
    intAdapter.toJson(writer, value_.solution)
    writer.name("submission")
    intAdapter.toJson(writer, value_.submission)
    writer.name("limit")
    intAdapter.toJson(writer, value_.limit)
    writer.name("increase")
    intAdapter.toJson(writer, value_.increase)
    writer.name("failed")
    booleanAdapter.toJson(writer, value_.failed)
    writer.endObject()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy