de.gesellix.docker.remote.api.PluginConfigLinuxJsonAdapter.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docker-remote-api-model-1-41 Show documentation
Show all versions of docker-remote-api-model-1-41 Show documentation
API model for the Docker remote api v1.41
// 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.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.MutableList
import kotlin.collections.emptySet
import kotlin.text.buildString
public class PluginConfigLinuxJsonAdapter(
moshi: Moshi,
) : JsonAdapter() {
private val options: JsonReader.Options = JsonReader.Options.of("Capabilities", "AllowAllDevices",
"Devices")
private val mutableListOfStringAdapter: JsonAdapter> =
moshi.adapter(Types.newParameterizedType(MutableList::class.java, String::class.java),
emptySet(), "capabilities")
private val booleanAdapter: JsonAdapter = moshi.adapter(Boolean::class.java, emptySet(),
"allowAllDevices")
private val mutableListOfPluginDeviceAdapter: JsonAdapter> =
moshi.adapter(Types.newParameterizedType(MutableList::class.java, PluginDevice::class.java),
emptySet(), "devices")
public override fun toString(): String = buildString(39) {
append("GeneratedJsonAdapter(").append("PluginConfigLinux").append(')') }
public override fun fromJson(reader: JsonReader): PluginConfigLinux {
var capabilities: MutableList? = null
var allowAllDevices: Boolean? = null
var devices: MutableList? = null
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> capabilities = mutableListOfStringAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("capabilities", "Capabilities", reader)
1 -> allowAllDevices = booleanAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("allowAllDevices", "AllowAllDevices", reader)
2 -> devices = mutableListOfPluginDeviceAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("devices", "Devices", reader)
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
return PluginConfigLinux(
capabilities = capabilities ?: throw Util.missingProperty("capabilities", "Capabilities",
reader),
allowAllDevices = allowAllDevices ?: throw Util.missingProperty("allowAllDevices",
"AllowAllDevices", reader),
devices = devices ?: throw Util.missingProperty("devices", "Devices", reader)
)
}
public override fun toJson(writer: JsonWriter, value_: PluginConfigLinux?): Unit {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("Capabilities")
mutableListOfStringAdapter.toJson(writer, value_.capabilities)
writer.name("AllowAllDevices")
booleanAdapter.toJson(writer, value_.allowAllDevices)
writer.name("Devices")
mutableListOfPluginDeviceAdapter.toJson(writer, value_.devices)
writer.endObject()
}
}