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

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

There is a newer version: 2024-09-15T19-05-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.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 TaskSpecContainerSpecJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("Image", "Labels", "Command",
      "Args", "Hostname", "Env", "Dir", "User", "Groups", "Privileges", "TTY", "OpenStdin",
      "ReadOnly", "Mounts", "StopSignal", "StopGracePeriod", "HealthCheck", "Hosts", "DNSConfig",
      "Secrets", "Configs", "Isolation", "Init", "Sysctls", "CapabilityAdd", "CapabilityDrop",
      "Ulimits")

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

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

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

  private val nullableTaskSpecContainerSpecPrivilegesAdapter:
      JsonAdapter =
      moshi.adapter(TaskSpecContainerSpecPrivileges::class.java, emptySet(), "privileges")

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

  private val nullableMutableListOfMountAdapter: JsonAdapter?> =
      moshi.adapter(Types.newParameterizedType(MutableList::class.java, Mount::class.java),
      emptySet(), "mounts")

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

  private val nullableHealthConfigAdapter: JsonAdapter =
      moshi.adapter(HealthConfig::class.java, emptySet(), "healthCheck")

  private val nullableTaskSpecContainerSpecDNSConfigAdapter:
      JsonAdapter =
      moshi.adapter(TaskSpecContainerSpecDNSConfig::class.java, emptySet(), "dnSConfig")

  private val nullableMutableListOfTaskSpecContainerSpecSecretsInnerAdapter:
      JsonAdapter?> =
      moshi.adapter(Types.newParameterizedType(MutableList::class.java,
      TaskSpecContainerSpecSecretsInner::class.java), emptySet(), "secrets")

  private val nullableMutableListOfTaskSpecContainerSpecConfigsInnerAdapter:
      JsonAdapter?> =
      moshi.adapter(Types.newParameterizedType(MutableList::class.java,
      TaskSpecContainerSpecConfigsInner::class.java), emptySet(), "configs")

  private val nullableIsolationAdapter: JsonAdapter =
      moshi.adapter(TaskSpecContainerSpec.Isolation::class.java, emptySet(), "isolation")

  private val nullableMutableListOfResourcesUlimitsInnerAdapter:
      JsonAdapter?> =
      moshi.adapter(Types.newParameterizedType(MutableList::class.java,
      ResourcesUlimitsInner::class.java), emptySet(), "ulimits")

  @Volatile
  private var constructorRef: Constructor? = null

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

  public override fun fromJson(reader: JsonReader): TaskSpecContainerSpec {
    var image: String? = null
    var labels: MutableMap? = null
    var command: MutableList? = null
    var args: MutableList? = null
    var hostname: String? = null
    var env: MutableList? = null
    var dir: String? = null
    var user: String? = null
    var groups: MutableList? = null
    var privileges: TaskSpecContainerSpecPrivileges? = null
    var TTY: Boolean? = null
    var openStdin: Boolean? = null
    var readOnly: Boolean? = null
    var mounts: MutableList? = null
    var stopSignal: String? = null
    var stopGracePeriod: Long? = null
    var healthCheck: HealthConfig? = null
    var hosts: MutableList? = null
    var dnSConfig: TaskSpecContainerSpecDNSConfig? = null
    var secrets: MutableList? = null
    var configs: MutableList? = null
    var isolation: TaskSpecContainerSpec.Isolation? = null
    var init_: Boolean? = null
    var sysctls: MutableMap? = null
    var capabilityAdd: MutableList? = null
    var capabilityDrop: MutableList? = null
    var ulimits: MutableList? = null
    var mask0 = -1
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> {
          image = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 0).inv()
          mask0 = mask0 and 0xfffffffe.toInt()
        }
        1 -> {
          labels = nullableMutableMapOfStringStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 1).inv()
          mask0 = mask0 and 0xfffffffd.toInt()
        }
        2 -> {
          command = nullableMutableListOfStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 2).inv()
          mask0 = mask0 and 0xfffffffb.toInt()
        }
        3 -> {
          args = nullableMutableListOfStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 3).inv()
          mask0 = mask0 and 0xfffffff7.toInt()
        }
        4 -> {
          hostname = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 4).inv()
          mask0 = mask0 and 0xffffffef.toInt()
        }
        5 -> {
          env = nullableMutableListOfStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 5).inv()
          mask0 = mask0 and 0xffffffdf.toInt()
        }
        6 -> {
          dir = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 6).inv()
          mask0 = mask0 and 0xffffffbf.toInt()
        }
        7 -> {
          user = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 7).inv()
          mask0 = mask0 and 0xffffff7f.toInt()
        }
        8 -> {
          groups = nullableMutableListOfStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 8).inv()
          mask0 = mask0 and 0xfffffeff.toInt()
        }
        9 -> {
          privileges = nullableTaskSpecContainerSpecPrivilegesAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 9).inv()
          mask0 = mask0 and 0xfffffdff.toInt()
        }
        10 -> {
          TTY = nullableBooleanAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 10).inv()
          mask0 = mask0 and 0xfffffbff.toInt()
        }
        11 -> {
          openStdin = nullableBooleanAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 11).inv()
          mask0 = mask0 and 0xfffff7ff.toInt()
        }
        12 -> {
          readOnly = nullableBooleanAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 12).inv()
          mask0 = mask0 and 0xffffefff.toInt()
        }
        13 -> {
          mounts = nullableMutableListOfMountAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 13).inv()
          mask0 = mask0 and 0xffffdfff.toInt()
        }
        14 -> {
          stopSignal = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 14).inv()
          mask0 = mask0 and 0xffffbfff.toInt()
        }
        15 -> {
          stopGracePeriod = nullableLongAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 15).inv()
          mask0 = mask0 and 0xffff7fff.toInt()
        }
        16 -> {
          healthCheck = nullableHealthConfigAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 16).inv()
          mask0 = mask0 and 0xfffeffff.toInt()
        }
        17 -> {
          hosts = nullableMutableListOfStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 17).inv()
          mask0 = mask0 and 0xfffdffff.toInt()
        }
        18 -> {
          dnSConfig = nullableTaskSpecContainerSpecDNSConfigAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 18).inv()
          mask0 = mask0 and 0xfffbffff.toInt()
        }
        19 -> {
          secrets = nullableMutableListOfTaskSpecContainerSpecSecretsInnerAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 19).inv()
          mask0 = mask0 and 0xfff7ffff.toInt()
        }
        20 -> {
          configs = nullableMutableListOfTaskSpecContainerSpecConfigsInnerAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 20).inv()
          mask0 = mask0 and 0xffefffff.toInt()
        }
        21 -> {
          isolation = nullableIsolationAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 21).inv()
          mask0 = mask0 and 0xffdfffff.toInt()
        }
        22 -> {
          init_ = nullableBooleanAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 22).inv()
          mask0 = mask0 and 0xffbfffff.toInt()
        }
        23 -> {
          sysctls = nullableMutableMapOfStringStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 23).inv()
          mask0 = mask0 and 0xff7fffff.toInt()
        }
        24 -> {
          capabilityAdd = nullableMutableListOfStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 24).inv()
          mask0 = mask0 and 0xfeffffff.toInt()
        }
        25 -> {
          capabilityDrop = nullableMutableListOfStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 25).inv()
          mask0 = mask0 and 0xfdffffff.toInt()
        }
        26 -> {
          ulimits = nullableMutableListOfResourcesUlimitsInnerAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 26).inv()
          mask0 = mask0 and 0xfbffffff.toInt()
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    if (mask0 == 0xf8000000.toInt()) {
      // All parameters with defaults are set, invoke the constructor directly
      return  TaskSpecContainerSpec(
          image = image,
          labels = labels,
          command = command,
          args = args,
          hostname = hostname,
          env = env,
          dir = dir,
          user = user,
          groups = groups,
          privileges = privileges,
          TTY = TTY,
          openStdin = openStdin,
          readOnly = readOnly,
          mounts = mounts,
          stopSignal = stopSignal,
          stopGracePeriod = stopGracePeriod,
          healthCheck = healthCheck,
          hosts = hosts,
          dnSConfig = dnSConfig,
          secrets = secrets,
          configs = configs,
          isolation = isolation,
          `init` = init_,
          sysctls = sysctls,
          capabilityAdd = capabilityAdd,
          capabilityDrop = capabilityDrop,
          ulimits = ulimits
      )
    } else {
      // Reflectively invoke the synthetic defaults constructor
      @Suppress("UNCHECKED_CAST")
      val localConstructor: Constructor = this.constructorRef ?:
          TaskSpecContainerSpec::class.java.getDeclaredConstructor(String::class.java,
          MutableMap::class.java, MutableList::class.java, MutableList::class.java,
          String::class.java, MutableList::class.java, String::class.java, String::class.java,
          MutableList::class.java, TaskSpecContainerSpecPrivileges::class.java,
          Boolean::class.javaObjectType, Boolean::class.javaObjectType,
          Boolean::class.javaObjectType, MutableList::class.java, String::class.java,
          Long::class.javaObjectType, HealthConfig::class.java, MutableList::class.java,
          TaskSpecContainerSpecDNSConfig::class.java, MutableList::class.java,
          MutableList::class.java, TaskSpecContainerSpec.Isolation::class.java,
          Boolean::class.javaObjectType, MutableMap::class.java, MutableList::class.java,
          MutableList::class.java, MutableList::class.java, Int::class.javaPrimitiveType,
          Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
      return localConstructor.newInstance(
          image,
          labels,
          command,
          args,
          hostname,
          env,
          dir,
          user,
          groups,
          privileges,
          TTY,
          openStdin,
          readOnly,
          mounts,
          stopSignal,
          stopGracePeriod,
          healthCheck,
          hosts,
          dnSConfig,
          secrets,
          configs,
          isolation,
          init_,
          sysctls,
          capabilityAdd,
          capabilityDrop,
          ulimits,
          mask0,
          /* DefaultConstructorMarker */ null
      )
    }
  }

  public override fun toJson(writer: JsonWriter, value_: TaskSpecContainerSpec?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("Image")
    nullableStringAdapter.toJson(writer, value_.image)
    writer.name("Labels")
    nullableMutableMapOfStringStringAdapter.toJson(writer, value_.labels)
    writer.name("Command")
    nullableMutableListOfStringAdapter.toJson(writer, value_.command)
    writer.name("Args")
    nullableMutableListOfStringAdapter.toJson(writer, value_.args)
    writer.name("Hostname")
    nullableStringAdapter.toJson(writer, value_.hostname)
    writer.name("Env")
    nullableMutableListOfStringAdapter.toJson(writer, value_.env)
    writer.name("Dir")
    nullableStringAdapter.toJson(writer, value_.dir)
    writer.name("User")
    nullableStringAdapter.toJson(writer, value_.user)
    writer.name("Groups")
    nullableMutableListOfStringAdapter.toJson(writer, value_.groups)
    writer.name("Privileges")
    nullableTaskSpecContainerSpecPrivilegesAdapter.toJson(writer, value_.privileges)
    writer.name("TTY")
    nullableBooleanAdapter.toJson(writer, value_.TTY)
    writer.name("OpenStdin")
    nullableBooleanAdapter.toJson(writer, value_.openStdin)
    writer.name("ReadOnly")
    nullableBooleanAdapter.toJson(writer, value_.readOnly)
    writer.name("Mounts")
    nullableMutableListOfMountAdapter.toJson(writer, value_.mounts)
    writer.name("StopSignal")
    nullableStringAdapter.toJson(writer, value_.stopSignal)
    writer.name("StopGracePeriod")
    nullableLongAdapter.toJson(writer, value_.stopGracePeriod)
    writer.name("HealthCheck")
    nullableHealthConfigAdapter.toJson(writer, value_.healthCheck)
    writer.name("Hosts")
    nullableMutableListOfStringAdapter.toJson(writer, value_.hosts)
    writer.name("DNSConfig")
    nullableTaskSpecContainerSpecDNSConfigAdapter.toJson(writer, value_.dnSConfig)
    writer.name("Secrets")
    nullableMutableListOfTaskSpecContainerSpecSecretsInnerAdapter.toJson(writer, value_.secrets)
    writer.name("Configs")
    nullableMutableListOfTaskSpecContainerSpecConfigsInnerAdapter.toJson(writer, value_.configs)
    writer.name("Isolation")
    nullableIsolationAdapter.toJson(writer, value_.isolation)
    writer.name("Init")
    nullableBooleanAdapter.toJson(writer, value_.`init`)
    writer.name("Sysctls")
    nullableMutableMapOfStringStringAdapter.toJson(writer, value_.sysctls)
    writer.name("CapabilityAdd")
    nullableMutableListOfStringAdapter.toJson(writer, value_.capabilityAdd)
    writer.name("CapabilityDrop")
    nullableMutableListOfStringAdapter.toJson(writer, value_.capabilityDrop)
    writer.name("Ulimits")
    nullableMutableListOfResourcesUlimitsInnerAdapter.toJson(writer, value_.ulimits)
    writer.endObject()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy