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

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

There is a newer version: 2024-11-28T22-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 kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.MutableList
import kotlin.collections.emptySet
import kotlin.text.buildString

public class PluginSettingsJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("Mounts", "Env", "Args",
      "Devices")

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

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

  private val mutableListOfPluginDeviceAdapter: JsonAdapter> =
      moshi.adapter(Types.newParameterizedType(MutableList::class.java, PluginDevice::class.java),
      emptySet(), "devices")

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

  public override fun fromJson(reader: JsonReader): PluginSettings {
    var mounts: MutableList? = null
    var env: MutableList? = null
    var args: MutableList? = null
    var devices: MutableList? = null
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> mounts = mutableListOfPluginMountAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("mounts", "Mounts", reader)
        1 -> env = mutableListOfStringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("env",
            "Env", reader)
        2 -> args = mutableListOfStringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("args",
            "Args", reader)
        3 -> devices = mutableListOfPluginDeviceAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("devices", "Devices", reader)
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    return PluginSettings(
        mounts = mounts ?: throw Util.missingProperty("mounts", "Mounts", reader),
        env = env ?: throw Util.missingProperty("env", "Env", reader),
        args = args ?: throw Util.missingProperty("args", "Args", reader),
        devices = devices ?: throw Util.missingProperty("devices", "Devices", reader)
    )
  }

  public override fun toJson(writer: JsonWriter, value_: PluginSettings?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("Mounts")
    mutableListOfPluginMountAdapter.toJson(writer, value_.mounts)
    writer.name("Env")
    mutableListOfStringAdapter.toJson(writer, value_.env)
    writer.name("Args")
    mutableListOfStringAdapter.toJson(writer, value_.args)
    writer.name("Devices")
    mutableListOfPluginDeviceAdapter.toJson(writer, value_.devices)
    writer.endObject()
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy