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

edu.illinois.cs.cs125.questioner.lib.TestTestResultsJsonAdapter.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.Types
import com.squareup.moshi.`internal`.Util
import edu.illinois.cs.cs125.jeed.core.Sandbox
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.MutableSet
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString

public class TestTestResultsJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("language", "completedSteps",
      "complete", "failedSteps", "failed", "skippedSteps", "timeout", "lineCountTimeout",
      "completed", "succeeded", "failedLinting")

  private val languageAdapter: JsonAdapter = moshi.adapter(Language::class.java,
      emptySet(), "language")

  private val mutableSetOfStepAdapter: JsonAdapter> =
      moshi.adapter(Types.newParameterizedType(MutableSet::class.java,
      TestTestResults.Step::class.java), emptySet(), "completedSteps")

  private val completedTasksAdapter: JsonAdapter =
      moshi.adapter(TestTestResults.CompletedTasks::class.java, emptySet(), "complete")

  private val failedTasksAdapter: JsonAdapter =
      moshi.adapter(TestTestResults.FailedTasks::class.java, emptySet(), "failed")

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

  private val nullableBooleanAdapter: JsonAdapter =
      moshi.adapter(Boolean::class.javaObjectType, emptySet(), "failedLinting")

  @Volatile
  private var constructorRef: Constructor? = null

  public override fun toString(): String = buildString(37) {
      append("GeneratedJsonAdapter(").append("TestTestResults").append(')') }

  public override fun fromJson(reader: JsonReader): TestTestResults {
    var language: Language? = null
    var completedSteps: MutableSet? = null
    var complete: TestTestResults.CompletedTasks? = null
    var failedSteps: MutableSet? = null
    var failed: TestTestResults.FailedTasks? = null
    var skippedSteps: MutableSet? = null
    var timeout: Boolean? = false
    var lineCountTimeout: Boolean? = false
    var completed: Boolean? = null
    var succeeded: Boolean? = null
    var failedLinting: Boolean? = null
    var failedLintingSet: Boolean = false
    var mask0 = -1
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> language = languageAdapter.fromJson(reader) ?: throw Util.unexpectedNull("language",
            "language", reader)
        1 -> {
          completedSteps = mutableSetOfStepAdapter.fromJson(reader) ?:
              throw Util.unexpectedNull("completedSteps", "completedSteps", reader)
          // $mask = $mask and (1 shl 1).inv()
          mask0 = mask0 and 0xfffffffd.toInt()
        }
        2 -> {
          complete = completedTasksAdapter.fromJson(reader) ?: throw Util.unexpectedNull("complete",
              "complete", reader)
          // $mask = $mask and (1 shl 2).inv()
          mask0 = mask0 and 0xfffffffb.toInt()
        }
        3 -> {
          failedSteps = mutableSetOfStepAdapter.fromJson(reader) ?:
              throw Util.unexpectedNull("failedSteps", "failedSteps", reader)
          // $mask = $mask and (1 shl 3).inv()
          mask0 = mask0 and 0xfffffff7.toInt()
        }
        4 -> {
          failed = failedTasksAdapter.fromJson(reader) ?: throw Util.unexpectedNull("failed",
              "failed", reader)
          // $mask = $mask and (1 shl 4).inv()
          mask0 = mask0 and 0xffffffef.toInt()
        }
        5 -> {
          skippedSteps = mutableSetOfStepAdapter.fromJson(reader) ?:
              throw Util.unexpectedNull("skippedSteps", "skippedSteps", reader)
          // $mask = $mask and (1 shl 5).inv()
          mask0 = mask0 and 0xffffffdf.toInt()
        }
        6 -> {
          timeout = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("timeout",
              "timeout", reader)
          // $mask = $mask and (1 shl 6).inv()
          mask0 = mask0 and 0xffffffbf.toInt()
        }
        7 -> {
          lineCountTimeout = booleanAdapter.fromJson(reader) ?:
              throw Util.unexpectedNull("lineCountTimeout", "lineCountTimeout", reader)
          // $mask = $mask and (1 shl 7).inv()
          mask0 = mask0 and 0xffffff7f.toInt()
        }
        8 -> completed = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("completed",
            "completed", reader)
        9 -> succeeded = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("succeeded",
            "succeeded", reader)
        10 -> {
          failedLinting = nullableBooleanAdapter.fromJson(reader)
          failedLintingSet = true
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    val result: TestTestResults
    if (mask0 == 0xffffff01.toInt()) {
      // All parameters with defaults are set, invoke the constructor directly
      result =  TestTestResults(
          language = language ?: throw Util.missingProperty("language", "language", reader),
          completedSteps = completedSteps as MutableSet,
          complete = complete as TestTestResults.CompletedTasks,
          failedSteps = failedSteps as MutableSet,
          failed = failed as TestTestResults.FailedTasks,
          skippedSteps = skippedSteps as MutableSet,
          timeout = timeout as Boolean,
          lineCountTimeout = lineCountTimeout as Boolean
      )
    } else {
      // Reflectively invoke the synthetic defaults constructor
      @Suppress("UNCHECKED_CAST")
      val localConstructor: Constructor = this.constructorRef ?:
          TestTestResults::class.java.getDeclaredConstructor(Language::class.java,
          MutableSet::class.java, TestTestResults.CompletedTasks::class.java,
          MutableSet::class.java, TestTestResults.FailedTasks::class.java, MutableSet::class.java,
          Boolean::class.javaPrimitiveType, Boolean::class.javaPrimitiveType,
          Sandbox.TaskResults::class.java, Int::class.javaPrimitiveType,
          Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
      result = localConstructor.newInstance(
          language ?: throw Util.missingProperty("language", "language", reader),
          completedSteps,
          complete,
          failedSteps,
          failed,
          skippedSteps,
          timeout,
          lineCountTimeout,
          /* taskResults */ null,
          mask0,
          /* DefaultConstructorMarker */ null
      )
    }
    result.completed = completed ?: result.completed
    result.succeeded = succeeded ?: result.succeeded
    if (failedLintingSet) {
      result.failedLinting = failedLinting
    }
    return result
  }

  public override fun toJson(writer: JsonWriter, value_: TestTestResults?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("language")
    languageAdapter.toJson(writer, value_.language)
    writer.name("completedSteps")
    mutableSetOfStepAdapter.toJson(writer, value_.completedSteps)
    writer.name("complete")
    completedTasksAdapter.toJson(writer, value_.complete)
    writer.name("failedSteps")
    mutableSetOfStepAdapter.toJson(writer, value_.failedSteps)
    writer.name("failed")
    failedTasksAdapter.toJson(writer, value_.failed)
    writer.name("skippedSteps")
    mutableSetOfStepAdapter.toJson(writer, value_.skippedSteps)
    writer.name("timeout")
    booleanAdapter.toJson(writer, value_.timeout)
    writer.name("lineCountTimeout")
    booleanAdapter.toJson(writer, value_.lineCountTimeout)
    writer.name("completed")
    booleanAdapter.toJson(writer, value_.completed)
    writer.name("succeeded")
    booleanAdapter.toJson(writer, value_.succeeded)
    writer.name("failedLinting")
    nullableBooleanAdapter.toJson(writer, value_.failedLinting)
    writer.endObject()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy