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

de.gesellix.docker.remote.api.SystemVersionJsonAdapter.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.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.MutableList
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString

public class SystemVersionJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("Platform", "Components",
      "Version", "ApiVersion", "MinAPIVersion", "GitCommit", "GoVersion", "Os", "Arch",
      "KernelVersion", "Experimental", "BuildTime")

  private val nullableSystemVersionPlatformAdapter: JsonAdapter =
      moshi.adapter(SystemVersionPlatform::class.java, emptySet(), "platform")

  private val nullableMutableListOfSystemVersionComponentsInnerAdapter:
      JsonAdapter?> =
      moshi.adapter(Types.newParameterizedType(MutableList::class.java,
      SystemVersionComponentsInner::class.java), emptySet(), "components")

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

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

  @Volatile
  private var constructorRef: Constructor? = null

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

  public override fun fromJson(reader: JsonReader): SystemVersion {
    var platform: SystemVersionPlatform? = null
    var components: MutableList? = null
    var version: String? = null
    var apiVersion: String? = null
    var minAPIVersion: String? = null
    var gitCommit: String? = null
    var goVersion: String? = null
    var os: String? = null
    var arch: String? = null
    var kernelVersion: String? = null
    var experimental: Boolean? = null
    var buildTime: String? = null
    var mask0 = -1
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          platform = nullableSystemVersionPlatformAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 0).inv()
          mask0 = mask0 and 0xfffffffe.toInt()
        }
        1 -> {
          components = nullableMutableListOfSystemVersionComponentsInnerAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 1).inv()
          mask0 = mask0 and 0xfffffffd.toInt()
        }
        2 -> {
          version = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 2).inv()
          mask0 = mask0 and 0xfffffffb.toInt()
        }
        3 -> {
          apiVersion = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 3).inv()
          mask0 = mask0 and 0xfffffff7.toInt()
        }
        4 -> {
          minAPIVersion = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 4).inv()
          mask0 = mask0 and 0xffffffef.toInt()
        }
        5 -> {
          gitCommit = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 5).inv()
          mask0 = mask0 and 0xffffffdf.toInt()
        }
        6 -> {
          goVersion = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 6).inv()
          mask0 = mask0 and 0xffffffbf.toInt()
        }
        7 -> {
          os = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 7).inv()
          mask0 = mask0 and 0xffffff7f.toInt()
        }
        8 -> {
          arch = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 8).inv()
          mask0 = mask0 and 0xfffffeff.toInt()
        }
        9 -> {
          kernelVersion = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 9).inv()
          mask0 = mask0 and 0xfffffdff.toInt()
        }
        10 -> {
          experimental = nullableBooleanAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 10).inv()
          mask0 = mask0 and 0xfffffbff.toInt()
        }
        11 -> {
          buildTime = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 11).inv()
          mask0 = mask0 and 0xfffff7ff.toInt()
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    if (mask0 == 0xfffff000.toInt()) {
      // All parameters with defaults are set, invoke the constructor directly
      return  SystemVersion(
          platform = platform,
          components = components,
          version = version,
          apiVersion = apiVersion,
          minAPIVersion = minAPIVersion,
          gitCommit = gitCommit,
          goVersion = goVersion,
          os = os,
          arch = arch,
          kernelVersion = kernelVersion,
          experimental = experimental,
          buildTime = buildTime
      )
    } else {
      // Reflectively invoke the synthetic defaults constructor
      @Suppress("UNCHECKED_CAST")
      val localConstructor: Constructor = this.constructorRef ?:
          SystemVersion::class.java.getDeclaredConstructor(SystemVersionPlatform::class.java,
          MutableList::class.java, String::class.java, String::class.java, String::class.java,
          String::class.java, String::class.java, String::class.java, String::class.java,
          String::class.java, Boolean::class.javaObjectType, String::class.java,
          Int::class.javaPrimitiveType, Util.DEFAULT_CONSTRUCTOR_MARKER).also {
          this.constructorRef = it }
      return localConstructor.newInstance(
          platform,
          components,
          version,
          apiVersion,
          minAPIVersion,
          gitCommit,
          goVersion,
          os,
          arch,
          kernelVersion,
          experimental,
          buildTime,
          mask0,
          /* DefaultConstructorMarker */ null
      )
    }
  }

  public override fun toJson(writer: JsonWriter, value_: SystemVersion?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("Platform")
    nullableSystemVersionPlatformAdapter.toJson(writer, value_.platform)
    writer.name("Components")
    nullableMutableListOfSystemVersionComponentsInnerAdapter.toJson(writer, value_.components)
    writer.name("Version")
    nullableStringAdapter.toJson(writer, value_.version)
    writer.name("ApiVersion")
    nullableStringAdapter.toJson(writer, value_.apiVersion)
    writer.name("MinAPIVersion")
    nullableStringAdapter.toJson(writer, value_.minAPIVersion)
    writer.name("GitCommit")
    nullableStringAdapter.toJson(writer, value_.gitCommit)
    writer.name("GoVersion")
    nullableStringAdapter.toJson(writer, value_.goVersion)
    writer.name("Os")
    nullableStringAdapter.toJson(writer, value_.os)
    writer.name("Arch")
    nullableStringAdapter.toJson(writer, value_.arch)
    writer.name("KernelVersion")
    nullableStringAdapter.toJson(writer, value_.kernelVersion)
    writer.name("Experimental")
    nullableBooleanAdapter.toJson(writer, value_.experimental)
    writer.name("BuildTime")
    nullableStringAdapter.toJson(writer, value_.buildTime)
    writer.endObject()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy