de.gesellix.docker.remote.api.VolumeJsonAdapter.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-45 Show documentation
Show all versions of docker-remote-api-model-1-45 Show documentation
API model for the Docker remote api v1.45
// 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.Any
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.MutableMap
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
public class VolumeJsonAdapter(
moshi: Moshi,
) : JsonAdapter() {
private val options: JsonReader.Options = JsonReader.Options.of("Name", "Driver", "Mountpoint",
"Options", "CreatedAt", "Status", "Labels", "Scope", "ClusterVolume", "UsageData")
private val stringAdapter: JsonAdapter = moshi.adapter(String::class.java, emptySet(),
"name")
private val nullableMutableMapOfStringStringAdapter: JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(MutableMap::class.java, String::class.java,
String::class.java), emptySet(), "options")
private val nullableStringAdapter: JsonAdapter = moshi.adapter(String::class.java,
emptySet(), "createdAt")
private val nullableMutableMapOfStringAnyAdapter: JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(MutableMap::class.java, String::class.java,
Any::class.java), emptySet(), "status")
private val nullableScopeAdapter: JsonAdapter =
moshi.adapter(Volume.Scope::class.java, emptySet(), "scope")
private val nullableClusterVolumeAdapter: JsonAdapter =
moshi.adapter(ClusterVolume::class.java, emptySet(), "clusterVolume")
private val nullableVolumeUsageDataAdapter: JsonAdapter =
moshi.adapter(VolumeUsageData::class.java, emptySet(), "usageData")
@Volatile
private var constructorRef: Constructor? = null
public override fun toString(): String = buildString(28) {
append("GeneratedJsonAdapter(").append("Volume").append(')') }
public override fun fromJson(reader: JsonReader): Volume {
var name: String? = null
var driver: String? = null
var mountpoint: String? = null
var options_: MutableMap? = null
var createdAt: String? = null
var status: MutableMap? = null
var labels: MutableMap? = null
var scope: Volume.Scope? = null
var clusterVolume: ClusterVolume? = null
var usageData: VolumeUsageData? = null
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> name = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("name", "Name",
reader)
1 -> driver = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("driver",
"Driver", reader)
2 -> mountpoint = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("mountpoint",
"Mountpoint", reader)
3 -> options_ = nullableMutableMapOfStringStringAdapter.fromJson(reader)
4 -> {
createdAt = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
status = nullableMutableMapOfStringAnyAdapter.fromJson(reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
labels = nullableMutableMapOfStringStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
7 -> {
scope = nullableScopeAdapter.fromJson(reader)
// $mask = $mask and (1 shl 7).inv()
mask0 = mask0 and 0xffffff7f.toInt()
}
8 -> {
clusterVolume = nullableClusterVolumeAdapter.fromJson(reader)
// $mask = $mask and (1 shl 8).inv()
mask0 = mask0 and 0xfffffeff.toInt()
}
9 -> {
usageData = nullableVolumeUsageDataAdapter.fromJson(reader)
// $mask = $mask and (1 shl 9).inv()
mask0 = mask0 and 0xfffffdff.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xfffffc0f.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return Volume(
name = name ?: throw Util.missingProperty("name", "Name", reader),
driver = driver ?: throw Util.missingProperty("driver", "Driver", reader),
mountpoint = mountpoint ?: throw Util.missingProperty("mountpoint", "Mountpoint", reader),
options = options_,
createdAt = createdAt,
status = status,
labels = labels,
scope = scope,
clusterVolume = clusterVolume,
usageData = usageData
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor = this.constructorRef ?:
Volume::class.java.getDeclaredConstructor(String::class.java, String::class.java,
String::class.java, MutableMap::class.java, String::class.java, MutableMap::class.java,
MutableMap::class.java, Volume.Scope::class.java, ClusterVolume::class.java,
VolumeUsageData::class.java, Int::class.javaPrimitiveType,
Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
return localConstructor.newInstance(
name ?: throw Util.missingProperty("name", "Name", reader),
driver ?: throw Util.missingProperty("driver", "Driver", reader),
mountpoint ?: throw Util.missingProperty("mountpoint", "Mountpoint", reader),
options_,
createdAt,
status,
labels,
scope,
clusterVolume,
usageData,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
public override fun toJson(writer: JsonWriter, value_: Volume?): Unit {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("Name")
stringAdapter.toJson(writer, value_.name)
writer.name("Driver")
stringAdapter.toJson(writer, value_.driver)
writer.name("Mountpoint")
stringAdapter.toJson(writer, value_.mountpoint)
writer.name("Options")
nullableMutableMapOfStringStringAdapter.toJson(writer, value_.options)
writer.name("CreatedAt")
nullableStringAdapter.toJson(writer, value_.createdAt)
writer.name("Status")
nullableMutableMapOfStringAnyAdapter.toJson(writer, value_.status)
writer.name("Labels")
nullableMutableMapOfStringStringAdapter.toJson(writer, value_.labels)
writer.name("Scope")
nullableScopeAdapter.toJson(writer, value_.scope)
writer.name("ClusterVolume")
nullableClusterVolumeAdapter.toJson(writer, value_.clusterVolume)
writer.name("UsageData")
nullableVolumeUsageDataAdapter.toJson(writer, value_.usageData)
writer.endObject()
}
}