de.gesellix.docker.remote.api.EndpointSettingsJsonAdapter.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.Long
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 EndpointSettingsJsonAdapter(
moshi: Moshi,
) : JsonAdapter() {
private val options: JsonReader.Options = JsonReader.Options.of("IPAMConfig", "Links",
"MacAddress", "Aliases", "NetworkID", "EndpointID", "Gateway", "IPAddress", "IPPrefixLen",
"IPv6Gateway", "GlobalIPv6Address", "GlobalIPv6PrefixLen", "DriverOpts", "DNSNames")
private val nullableEndpointIPAMConfigAdapter: JsonAdapter =
moshi.adapter(EndpointIPAMConfig::class.java, emptySet(), "ipAMConfig")
private val nullableMutableListOfStringAdapter: JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(MutableList::class.java, String::class.java),
emptySet(), "links")
private val nullableStringAdapter: JsonAdapter = moshi.adapter(String::class.java,
emptySet(), "macAddress")
private val nullableIntAdapter: JsonAdapter = moshi.adapter(Int::class.javaObjectType,
emptySet(), "ipPrefixLen")
private val nullableLongAdapter: JsonAdapter = moshi.adapter(Long::class.javaObjectType,
emptySet(), "globalIPv6PrefixLen")
private val nullableMutableMapOfStringStringAdapter: JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(MutableMap::class.java, String::class.java,
String::class.java), emptySet(), "driverOpts")
@Volatile
private var constructorRef: Constructor? = null
public override fun toString(): String = buildString(38) {
append("GeneratedJsonAdapter(").append("EndpointSettings").append(')') }
public override fun fromJson(reader: JsonReader): EndpointSettings {
var ipAMConfig: EndpointIPAMConfig? = null
var links: MutableList? = null
var macAddress: String? = null
var aliases: MutableList? = null
var networkID: String? = null
var endpointID: String? = null
var gateway: String? = null
var ipAddress: String? = null
var ipPrefixLen: Int? = null
var ipv6Gateway: String? = null
var globalIPv6Address: String? = null
var globalIPv6PrefixLen: Long? = null
var driverOpts: MutableMap? = null
var dnSNames: MutableList? = null
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> {
ipAMConfig = nullableEndpointIPAMConfigAdapter.fromJson(reader)
// $mask = $mask and (1 shl 0).inv()
mask0 = mask0 and 0xfffffffe.toInt()
}
1 -> {
links = nullableMutableListOfStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 1).inv()
mask0 = mask0 and 0xfffffffd.toInt()
}
2 -> {
macAddress = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 2).inv()
mask0 = mask0 and 0xfffffffb.toInt()
}
3 -> {
aliases = nullableMutableListOfStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask0 = mask0 and 0xfffffff7.toInt()
}
4 -> {
networkID = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
endpointID = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
gateway = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
7 -> {
ipAddress = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 7).inv()
mask0 = mask0 and 0xffffff7f.toInt()
}
8 -> {
ipPrefixLen = nullableIntAdapter.fromJson(reader)
// $mask = $mask and (1 shl 8).inv()
mask0 = mask0 and 0xfffffeff.toInt()
}
9 -> {
ipv6Gateway = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 9).inv()
mask0 = mask0 and 0xfffffdff.toInt()
}
10 -> {
globalIPv6Address = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 10).inv()
mask0 = mask0 and 0xfffffbff.toInt()
}
11 -> {
globalIPv6PrefixLen = nullableLongAdapter.fromJson(reader)
// $mask = $mask and (1 shl 11).inv()
mask0 = mask0 and 0xfffff7ff.toInt()
}
12 -> {
driverOpts = nullableMutableMapOfStringStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 12).inv()
mask0 = mask0 and 0xffffefff.toInt()
}
13 -> {
dnSNames = nullableMutableListOfStringAdapter.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 EndpointSettings(
ipAMConfig = ipAMConfig,
links = links,
macAddress = macAddress,
aliases = aliases,
networkID = networkID,
endpointID = endpointID,
gateway = gateway,
ipAddress = ipAddress,
ipPrefixLen = ipPrefixLen,
ipv6Gateway = ipv6Gateway,
globalIPv6Address = globalIPv6Address,
globalIPv6PrefixLen = globalIPv6PrefixLen,
driverOpts = driverOpts,
dnSNames = dnSNames
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor = this.constructorRef ?:
EndpointSettings::class.java.getDeclaredConstructor(EndpointIPAMConfig::class.java,
MutableList::class.java, String::class.java, MutableList::class.java, String::class.java,
String::class.java, String::class.java, String::class.java, Int::class.javaObjectType,
String::class.java, String::class.java, Long::class.javaObjectType,
MutableMap::class.java, MutableList::class.java, Int::class.javaPrimitiveType,
Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
return localConstructor.newInstance(
ipAMConfig,
links,
macAddress,
aliases,
networkID,
endpointID,
gateway,
ipAddress,
ipPrefixLen,
ipv6Gateway,
globalIPv6Address,
globalIPv6PrefixLen,
driverOpts,
dnSNames,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
public override fun toJson(writer: JsonWriter, value_: EndpointSettings?): Unit {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("IPAMConfig")
nullableEndpointIPAMConfigAdapter.toJson(writer, value_.ipAMConfig)
writer.name("Links")
nullableMutableListOfStringAdapter.toJson(writer, value_.links)
writer.name("MacAddress")
nullableStringAdapter.toJson(writer, value_.macAddress)
writer.name("Aliases")
nullableMutableListOfStringAdapter.toJson(writer, value_.aliases)
writer.name("NetworkID")
nullableStringAdapter.toJson(writer, value_.networkID)
writer.name("EndpointID")
nullableStringAdapter.toJson(writer, value_.endpointID)
writer.name("Gateway")
nullableStringAdapter.toJson(writer, value_.gateway)
writer.name("IPAddress")
nullableStringAdapter.toJson(writer, value_.ipAddress)
writer.name("IPPrefixLen")
nullableIntAdapter.toJson(writer, value_.ipPrefixLen)
writer.name("IPv6Gateway")
nullableStringAdapter.toJson(writer, value_.ipv6Gateway)
writer.name("GlobalIPv6Address")
nullableStringAdapter.toJson(writer, value_.globalIPv6Address)
writer.name("GlobalIPv6PrefixLen")
nullableLongAdapter.toJson(writer, value_.globalIPv6PrefixLen)
writer.name("DriverOpts")
nullableMutableMapOfStringStringAdapter.toJson(writer, value_.driverOpts)
writer.name("DNSNames")
nullableMutableListOfStringAdapter.toJson(writer, value_.dnSNames)
writer.endObject()
}
}