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

de.gesellix.docker.remote.api.PluginConfigJsonAdapter.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 PluginConfigJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("Description", "Documentation",
      "Interface", "Entrypoint", "WorkDir", "Network", "Linux", "PropagatedMount", "IpcHost",
      "PidHost", "Mounts", "Env", "Args", "DockerVersion", "User", "rootfs")

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

  private val pluginConfigInterfaceAdapter: JsonAdapter =
      moshi.adapter(PluginConfigInterface::class.java, emptySet(), "interface")

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

  private val pluginConfigNetworkAdapter: JsonAdapter =
      moshi.adapter(PluginConfigNetwork::class.java, emptySet(), "network")

  private val pluginConfigLinuxAdapter: JsonAdapter =
      moshi.adapter(PluginConfigLinux::class.java, emptySet(), "linux")

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

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

  private val mutableListOfPluginEnvAdapter: JsonAdapter> =
      moshi.adapter(Types.newParameterizedType(MutableList::class.java, PluginEnv::class.java),
      emptySet(), "env")

  private val pluginConfigArgsAdapter: JsonAdapter =
      moshi.adapter(PluginConfigArgs::class.java, emptySet(), "args")

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

  private val nullablePluginConfigUserAdapter: JsonAdapter =
      moshi.adapter(PluginConfigUser::class.java, emptySet(), "user")

  private val nullablePluginConfigRootfsAdapter: JsonAdapter =
      moshi.adapter(PluginConfigRootfs::class.java, emptySet(), "rootfs")

  @Volatile
  private var constructorRef: Constructor? = null

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

  public override fun fromJson(reader: JsonReader): PluginConfig {
    var description: String? = null
    var documentation: String? = null
    var interface_: PluginConfigInterface? = null
    var entrypoint: MutableList? = null
    var workDir: String? = null
    var network: PluginConfigNetwork? = null
    var linux: PluginConfigLinux? = null
    var propagatedMount: String? = null
    var ipcHost: Boolean? = null
    var pidHost: Boolean? = null
    var mounts: MutableList? = null
    var env: MutableList? = null
    var args: PluginConfigArgs? = null
    var dockerVersion: String? = null
    var user: PluginConfigUser? = null
    var rootfs: PluginConfigRootfs? = null
    var mask0 = -1
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> description = stringAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("description", "Description", reader)
        1 -> documentation = stringAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("documentation", "Documentation", reader)
        2 -> interface_ = pluginConfigInterfaceAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("interface_", "Interface", reader)
        3 -> entrypoint = mutableListOfStringAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("entrypoint", "Entrypoint", reader)
        4 -> workDir = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("workDir",
            "WorkDir", reader)
        5 -> network = pluginConfigNetworkAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("network", "Network", reader)
        6 -> linux = pluginConfigLinuxAdapter.fromJson(reader) ?: throw Util.unexpectedNull("linux",
            "Linux", reader)
        7 -> propagatedMount = stringAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("propagatedMount", "PropagatedMount", reader)
        8 -> ipcHost = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("ipcHost",
            "IpcHost", reader)
        9 -> pidHost = booleanAdapter.fromJson(reader) ?: throw Util.unexpectedNull("pidHost",
            "PidHost", reader)
        10 -> mounts = mutableListOfPluginMountAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("mounts", "Mounts", reader)
        11 -> env = mutableListOfPluginEnvAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("env", "Env", reader)
        12 -> args = pluginConfigArgsAdapter.fromJson(reader) ?: throw Util.unexpectedNull("args",
            "Args", reader)
        13 -> {
          dockerVersion = nullableStringAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 13).inv()
          mask0 = mask0 and 0xffffdfff.toInt()
        }
        14 -> {
          user = nullablePluginConfigUserAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 14).inv()
          mask0 = mask0 and 0xffffbfff.toInt()
        }
        15 -> {
          rootfs = nullablePluginConfigRootfsAdapter.fromJson(reader)
          // $mask = $mask and (1 shl 15).inv()
          mask0 = mask0 and 0xffff7fff.toInt()
        }
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    if (mask0 == 0xffff1fff.toInt()) {
      // All parameters with defaults are set, invoke the constructor directly
      return  PluginConfig(
          description = description ?: throw Util.missingProperty("description", "Description",
              reader),
          documentation = documentation ?: throw Util.missingProperty("documentation",
              "Documentation", reader),
          `interface` = interface_ ?: throw Util.missingProperty("interface_", "Interface", reader),
          entrypoint = entrypoint ?: throw Util.missingProperty("entrypoint", "Entrypoint", reader),
          workDir = workDir ?: throw Util.missingProperty("workDir", "WorkDir", reader),
          network = network ?: throw Util.missingProperty("network", "Network", reader),
          linux = linux ?: throw Util.missingProperty("linux", "Linux", reader),
          propagatedMount = propagatedMount ?: throw Util.missingProperty("propagatedMount",
              "PropagatedMount", reader),
          ipcHost = ipcHost ?: throw Util.missingProperty("ipcHost", "IpcHost", reader),
          pidHost = pidHost ?: throw Util.missingProperty("pidHost", "PidHost", reader),
          mounts = mounts ?: throw Util.missingProperty("mounts", "Mounts", reader),
          env = env ?: throw Util.missingProperty("env", "Env", reader),
          args = args ?: throw Util.missingProperty("args", "Args", reader),
          dockerVersion = dockerVersion,
          user = user,
          rootfs = rootfs
      )
    } else {
      // Reflectively invoke the synthetic defaults constructor
      @Suppress("UNCHECKED_CAST")
      val localConstructor: Constructor = this.constructorRef ?:
          PluginConfig::class.java.getDeclaredConstructor(String::class.java, String::class.java,
          PluginConfigInterface::class.java, MutableList::class.java, String::class.java,
          PluginConfigNetwork::class.java, PluginConfigLinux::class.java, String::class.java,
          Boolean::class.javaPrimitiveType, Boolean::class.javaPrimitiveType,
          MutableList::class.java, MutableList::class.java, PluginConfigArgs::class.java,
          String::class.java, PluginConfigUser::class.java, PluginConfigRootfs::class.java,
          Int::class.javaPrimitiveType, Util.DEFAULT_CONSTRUCTOR_MARKER).also {
          this.constructorRef = it }
      return localConstructor.newInstance(
          description ?: throw Util.missingProperty("description", "Description", reader),
          documentation ?: throw Util.missingProperty("documentation", "Documentation", reader),
          interface_ ?: throw Util.missingProperty("interface_", "Interface", reader),
          entrypoint ?: throw Util.missingProperty("entrypoint", "Entrypoint", reader),
          workDir ?: throw Util.missingProperty("workDir", "WorkDir", reader),
          network ?: throw Util.missingProperty("network", "Network", reader),
          linux ?: throw Util.missingProperty("linux", "Linux", reader),
          propagatedMount ?: throw Util.missingProperty("propagatedMount", "PropagatedMount",
              reader),
          ipcHost ?: throw Util.missingProperty("ipcHost", "IpcHost", reader),
          pidHost ?: throw Util.missingProperty("pidHost", "PidHost", reader),
          mounts ?: throw Util.missingProperty("mounts", "Mounts", reader),
          env ?: throw Util.missingProperty("env", "Env", reader),
          args ?: throw Util.missingProperty("args", "Args", reader),
          dockerVersion,
          user,
          rootfs,
          mask0,
          /* DefaultConstructorMarker */ null
      )
    }
  }

  public override fun toJson(writer: JsonWriter, value_: PluginConfig?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("Description")
    stringAdapter.toJson(writer, value_.description)
    writer.name("Documentation")
    stringAdapter.toJson(writer, value_.documentation)
    writer.name("Interface")
    pluginConfigInterfaceAdapter.toJson(writer, value_.`interface`)
    writer.name("Entrypoint")
    mutableListOfStringAdapter.toJson(writer, value_.entrypoint)
    writer.name("WorkDir")
    stringAdapter.toJson(writer, value_.workDir)
    writer.name("Network")
    pluginConfigNetworkAdapter.toJson(writer, value_.network)
    writer.name("Linux")
    pluginConfigLinuxAdapter.toJson(writer, value_.linux)
    writer.name("PropagatedMount")
    stringAdapter.toJson(writer, value_.propagatedMount)
    writer.name("IpcHost")
    booleanAdapter.toJson(writer, value_.ipcHost)
    writer.name("PidHost")
    booleanAdapter.toJson(writer, value_.pidHost)
    writer.name("Mounts")
    mutableListOfPluginMountAdapter.toJson(writer, value_.mounts)
    writer.name("Env")
    mutableListOfPluginEnvAdapter.toJson(writer, value_.env)
    writer.name("Args")
    pluginConfigArgsAdapter.toJson(writer, value_.args)
    writer.name("DockerVersion")
    nullableStringAdapter.toJson(writer, value_.dockerVersion)
    writer.name("User")
    nullablePluginConfigUserAdapter.toJson(writer, value_.user)
    writer.name("rootfs")
    nullablePluginConfigRootfsAdapter.toJson(writer, value_.rootfs)
    writer.endObject()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy