de.gesellix.docker.remote.api.TaskJsonAdapter.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.Int
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 TaskJsonAdapter(
moshi: Moshi,
) : JsonAdapter() {
private val options: JsonReader.Options = JsonReader.Options.of("ID", "Version", "CreatedAt",
"UpdatedAt", "Name", "Labels", "Spec", "ServiceID", "Slot", "NodeID",
"AssignedGenericResources", "Status", "DesiredState", "JobIteration")
private val nullableStringAdapter: JsonAdapter = moshi.adapter(String::class.java,
emptySet(), "ID")
private val nullableObjectVersionAdapter: JsonAdapter =
moshi.adapter(ObjectVersion::class.java, emptySet(), "version")
private val nullableMutableMapOfStringStringAdapter: JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(MutableMap::class.java, String::class.java,
String::class.java), emptySet(), "labels")
private val nullableTaskSpecAdapter: JsonAdapter = moshi.adapter(TaskSpec::class.java,
emptySet(), "spec")
private val nullableIntAdapter: JsonAdapter = moshi.adapter(Int::class.javaObjectType,
emptySet(), "slot")
private val nullableMutableListOfGenericResourcesInnerAdapter:
JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(MutableList::class.java,
GenericResourcesInner::class.java), emptySet(), "assignedGenericResources")
private val nullableTaskStatusAdapter: JsonAdapter =
moshi.adapter(TaskStatus::class.java, emptySet(), "status")
private val nullableTaskStateAdapter: JsonAdapter =
moshi.adapter(TaskState::class.java, emptySet(), "desiredState")
@Volatile
private var constructorRef: Constructor? = null
public override fun toString(): String = buildString(26) {
append("GeneratedJsonAdapter(").append("Task").append(')') }
public override fun fromJson(reader: JsonReader): Task {
var ID: String? = null
var version: ObjectVersion? = null
var createdAt: String? = null
var updatedAt: String? = null
var name: String? = null
var labels: MutableMap? = null
var spec: TaskSpec? = null
var serviceID: String? = null
var slot: Int? = null
var nodeID: String? = null
var assignedGenericResources: MutableList? = null
var status: TaskStatus? = null
var desiredState: TaskState? = null
var jobIteration: ObjectVersion? = null
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> {
ID = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 0).inv()
mask0 = mask0 and 0xfffffffe.toInt()
}
1 -> {
version = nullableObjectVersionAdapter.fromJson(reader)
// $mask = $mask and (1 shl 1).inv()
mask0 = mask0 and 0xfffffffd.toInt()
}
2 -> {
createdAt = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 2).inv()
mask0 = mask0 and 0xfffffffb.toInt()
}
3 -> {
updatedAt = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask0 = mask0 and 0xfffffff7.toInt()
}
4 -> {
name = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
labels = nullableMutableMapOfStringStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
spec = nullableTaskSpecAdapter.fromJson(reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
7 -> {
serviceID = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 7).inv()
mask0 = mask0 and 0xffffff7f.toInt()
}
8 -> {
slot = nullableIntAdapter.fromJson(reader)
// $mask = $mask and (1 shl 8).inv()
mask0 = mask0 and 0xfffffeff.toInt()
}
9 -> {
nodeID = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 9).inv()
mask0 = mask0 and 0xfffffdff.toInt()
}
10 -> {
assignedGenericResources =
nullableMutableListOfGenericResourcesInnerAdapter.fromJson(reader)
// $mask = $mask and (1 shl 10).inv()
mask0 = mask0 and 0xfffffbff.toInt()
}
11 -> {
status = nullableTaskStatusAdapter.fromJson(reader)
// $mask = $mask and (1 shl 11).inv()
mask0 = mask0 and 0xfffff7ff.toInt()
}
12 -> {
desiredState = nullableTaskStateAdapter.fromJson(reader)
// $mask = $mask and (1 shl 12).inv()
mask0 = mask0 and 0xffffefff.toInt()
}
13 -> {
jobIteration = nullableObjectVersionAdapter.fromJson(reader)
// $mask = $mask and (1 shl 13).inv()
mask0 = mask0 and 0xffffdfff.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xffffc000.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return Task(
ID = ID,
version = version,
createdAt = createdAt,
updatedAt = updatedAt,
name = name,
labels = labels,
spec = spec,
serviceID = serviceID,
slot = slot,
nodeID = nodeID,
assignedGenericResources = assignedGenericResources,
status = status,
desiredState = desiredState,
jobIteration = jobIteration
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor = this.constructorRef ?:
Task::class.java.getDeclaredConstructor(String::class.java, ObjectVersion::class.java,
String::class.java, String::class.java, String::class.java, MutableMap::class.java,
TaskSpec::class.java, String::class.java, Int::class.javaObjectType, String::class.java,
MutableList::class.java, TaskStatus::class.java, TaskState::class.java,
ObjectVersion::class.java, Int::class.javaPrimitiveType,
Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
return localConstructor.newInstance(
ID,
version,
createdAt,
updatedAt,
name,
labels,
spec,
serviceID,
slot,
nodeID,
assignedGenericResources,
status,
desiredState,
jobIteration,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
public override fun toJson(writer: JsonWriter, value_: Task?): Unit {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("ID")
nullableStringAdapter.toJson(writer, value_.ID)
writer.name("Version")
nullableObjectVersionAdapter.toJson(writer, value_.version)
writer.name("CreatedAt")
nullableStringAdapter.toJson(writer, value_.createdAt)
writer.name("UpdatedAt")
nullableStringAdapter.toJson(writer, value_.updatedAt)
writer.name("Name")
nullableStringAdapter.toJson(writer, value_.name)
writer.name("Labels")
nullableMutableMapOfStringStringAdapter.toJson(writer, value_.labels)
writer.name("Spec")
nullableTaskSpecAdapter.toJson(writer, value_.spec)
writer.name("ServiceID")
nullableStringAdapter.toJson(writer, value_.serviceID)
writer.name("Slot")
nullableIntAdapter.toJson(writer, value_.slot)
writer.name("NodeID")
nullableStringAdapter.toJson(writer, value_.nodeID)
writer.name("AssignedGenericResources")
nullableMutableListOfGenericResourcesInnerAdapter.toJson(writer,
value_.assignedGenericResources)
writer.name("Status")
nullableTaskStatusAdapter.toJson(writer, value_.status)
writer.name("DesiredState")
nullableTaskStateAdapter.toJson(writer, value_.desiredState)
writer.name("JobIteration")
nullableObjectVersionAdapter.toJson(writer, value_.jobIteration)
writer.endObject()
}
}