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

de.gesellix.docker.remote.api.ImageSummaryJsonAdapter.kt Maven / Gradle / Ivy

There is a newer version: 2024-11-04T20-53-00
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 de.gesellix.docker.remote.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.Types
import com.squareup.moshi.`internal`.Util
import java.lang.NullPointerException
import java.lang.reflect.Constructor
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.MutableList
import kotlin.collections.MutableMap
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString

public class ImageSummaryJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("Id", "ParentId", "Created",
      "Size", "SharedSize", "Containers", "RepoTags", "RepoDigests", "VirtualSize", "Labels")

  private val stringAdapter: JsonAdapter = moshi.adapter(String::class.java, emptySet(),
      "id")

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

  private val longAdapter: JsonAdapter = moshi.adapter(Long::class.java, emptySet(),
      "propertySize")

  private val nullableMutableListOfStringAdapter: JsonAdapter?> =
      moshi.adapter(Types.newParameterizedType(MutableList::class.java, String::class.java),
      emptySet(), "repoTags")

  private val nullableLongAdapter: JsonAdapter = moshi.adapter(Long::class.javaObjectType,
      emptySet(), "virtualSize")

  private val nullableMutableMapOfStringStringAdapter: JsonAdapter?> =
      moshi.adapter(Types.newParameterizedType(MutableMap::class.java, String::class.java,
      String::class.java), emptySet(), "labels")

  @Volatile
  private var constructorRef: Constructor? = null

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

  public override fun fromJson(reader: JsonReader): ImageSummary {
    var id: String? = null
    var parentId: String? = null
    var created: Int? = null
    var propertySize: Long? = null
    var sharedSize: Long? = null
    var containers: Int? = null
    var repoTags: MutableList? = null
    var repoDigests: MutableList? = null
    var virtualSize: Long? = null
    var labels: MutableMap? = null
    var mask0 = -1
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> id = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("id", "Id", reader)
        1 -> parentId = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("parentId",
            "ParentId", reader)
        2 -> created = intAdapter.fromJson(reader) ?: throw Util.unexpectedNull("created",
            "Created", reader)
        3 -> propertySize = longAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("propertySize", "Size", reader)
        4 -> sharedSize = longAdapter.fromJson(reader) ?: throw Util.unexpectedNull("sharedSize",
            "SharedSize", reader)
        5 -> containers = intAdapter.fromJson(reader) ?: throw Util.unexpectedNull("containers",
            "Containers", reader)
        6 -> {
          repoTags = nullableMutableListOfStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 6).inv()
          mask0 = mask0 and 0xffffffbf.toInt()
        }
        7 -> {
          repoDigests = nullableMutableListOfStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 7).inv()
          mask0 = mask0 and 0xffffff7f.toInt()
        }
        8 -> {
          virtualSize = nullableLongAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 8).inv()
          mask0 = mask0 and 0xfffffeff.toInt()
        }
        9 -> {
          labels = nullableMutableMapOfStringStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 9).inv()
          mask0 = mask0 and 0xfffffdff.toInt()
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    if (mask0 == 0xfffffc3f.toInt()) {
      // All parameters with defaults are set, invoke the constructor directly
      return  ImageSummary(
          id = id ?: throw Util.missingProperty("id", "Id", reader),
          parentId = parentId ?: throw Util.missingProperty("parentId", "ParentId", reader),
          created = created ?: throw Util.missingProperty("created", "Created", reader),
          propertySize = propertySize ?: throw Util.missingProperty("propertySize", "Size", reader),
          sharedSize = sharedSize ?: throw Util.missingProperty("sharedSize", "SharedSize", reader),
          containers = containers ?: throw Util.missingProperty("containers", "Containers", reader),
          repoTags = repoTags,
          repoDigests = repoDigests,
          virtualSize = virtualSize,
          labels = labels
      )
    } else {
      // Reflectively invoke the synthetic defaults constructor
      @Suppress("UNCHECKED_CAST")
      val localConstructor: Constructor = this.constructorRef ?:
          ImageSummary::class.java.getDeclaredConstructor(String::class.java, String::class.java,
          Int::class.javaPrimitiveType, Long::class.javaPrimitiveType,
          Long::class.javaPrimitiveType, Int::class.javaPrimitiveType, MutableList::class.java,
          MutableList::class.java, Long::class.javaObjectType, MutableMap::class.java,
          Int::class.javaPrimitiveType, Util.DEFAULT_CONSTRUCTOR_MARKER).also {
          this.constructorRef = it }
      return localConstructor.newInstance(
          id ?: throw Util.missingProperty("id", "Id", reader),
          parentId ?: throw Util.missingProperty("parentId", "ParentId", reader),
          created ?: throw Util.missingProperty("created", "Created", reader),
          propertySize ?: throw Util.missingProperty("propertySize", "Size", reader),
          sharedSize ?: throw Util.missingProperty("sharedSize", "SharedSize", reader),
          containers ?: throw Util.missingProperty("containers", "Containers", reader),
          repoTags,
          repoDigests,
          virtualSize,
          labels,
          mask0,
          /* DefaultConstructorMarker */ null
      )
    }
  }

  public override fun toJson(writer: JsonWriter, value_: ImageSummary?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("Id")
    stringAdapter.toJson(writer, value_.id)
    writer.name("ParentId")
    stringAdapter.toJson(writer, value_.parentId)
    writer.name("Created")
    intAdapter.toJson(writer, value_.created)
    writer.name("Size")
    longAdapter.toJson(writer, value_.propertySize)
    writer.name("SharedSize")
    longAdapter.toJson(writer, value_.sharedSize)
    writer.name("Containers")
    intAdapter.toJson(writer, value_.containers)
    writer.name("RepoTags")
    nullableMutableListOfStringAdapter.toJson(writer, value_.repoTags)
    writer.name("RepoDigests")
    nullableMutableListOfStringAdapter.toJson(writer, value_.repoDigests)
    writer.name("VirtualSize")
    nullableLongAdapter.toJson(writer, value_.virtualSize)
    writer.name("Labels")
    nullableMutableMapOfStringStringAdapter.toJson(writer, value_.labels)
    writer.endObject()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy