de.gesellix.docker.remote.api.NetworkSettingsJsonAdapter.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.Boolean
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 NetworkSettingsJsonAdapter(
moshi: Moshi,
) : JsonAdapter() {
private val options: JsonReader.Options = JsonReader.Options.of("Bridge", "SandboxID",
"HairpinMode", "LinkLocalIPv6Address", "LinkLocalIPv6PrefixLen", "Ports", "SandboxKey",
"SecondaryIPAddresses", "SecondaryIPv6Addresses", "EndpointID", "Gateway",
"GlobalIPv6Address", "GlobalIPv6PrefixLen", "IPAddress", "IPPrefixLen", "IPv6Gateway",
"MacAddress", "Networks")
private val nullableStringAdapter: JsonAdapter = moshi.adapter(String::class.java,
emptySet(), "bridge")
private val nullableBooleanAdapter: JsonAdapter =
moshi.adapter(Boolean::class.javaObjectType, emptySet(), "hairpinMode")
private val nullableIntAdapter: JsonAdapter = moshi.adapter(Int::class.javaObjectType,
emptySet(), "linkLocalIPv6PrefixLen")
private val nullableMutableMapOfStringMutableListOfPortBindingAdapter:
JsonAdapter>?> =
moshi.adapter(Types.newParameterizedType(MutableMap::class.java, String::class.java,
Types.newParameterizedType(MutableList::class.java, PortBinding::class.java)), emptySet(),
"ports")
private val nullableMutableListOfAddressAdapter: JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(MutableList::class.java, Address::class.java),
emptySet(), "secondaryIPAddresses")
private val nullableMutableMapOfStringEndpointSettingsAdapter:
JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(MutableMap::class.java, String::class.java,
EndpointSettings::class.java), emptySet(), "networks")
@Volatile
private var constructorRef: Constructor? = null
public override fun toString(): String = buildString(37) {
append("GeneratedJsonAdapter(").append("NetworkSettings").append(')') }
public override fun fromJson(reader: JsonReader): NetworkSettings {
var bridge: String? = null
var sandboxID: String? = null
var hairpinMode: Boolean? = null
var linkLocalIPv6Address: String? = null
var linkLocalIPv6PrefixLen: Int? = null
var ports: MutableMap>? = null
var sandboxKey: String? = null
var secondaryIPAddresses: MutableList? = null
var secondaryIPv6Addresses: MutableList? = null
var endpointID: String? = null
var gateway: String? = null
var globalIPv6Address: String? = null
var globalIPv6PrefixLen: Int? = null
var ipAddress: String? = null
var ipPrefixLen: Int? = null
var ipv6Gateway: String? = null
var macAddress: String? = null
var networks: MutableMap? = null
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> {
bridge = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 0).inv()
mask0 = mask0 and 0xfffffffe.toInt()
}
1 -> {
sandboxID = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 1).inv()
mask0 = mask0 and 0xfffffffd.toInt()
}
2 -> {
hairpinMode = nullableBooleanAdapter.fromJson(reader)
// $mask = $mask and (1 shl 2).inv()
mask0 = mask0 and 0xfffffffb.toInt()
}
3 -> {
linkLocalIPv6Address = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 3).inv()
mask0 = mask0 and 0xfffffff7.toInt()
}
4 -> {
linkLocalIPv6PrefixLen = nullableIntAdapter.fromJson(reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
ports = nullableMutableMapOfStringMutableListOfPortBindingAdapter.fromJson(reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
sandboxKey = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
7 -> {
secondaryIPAddresses = nullableMutableListOfAddressAdapter.fromJson(reader)
// $mask = $mask and (1 shl 7).inv()
mask0 = mask0 and 0xffffff7f.toInt()
}
8 -> {
secondaryIPv6Addresses = nullableMutableListOfAddressAdapter.fromJson(reader)
// $mask = $mask and (1 shl 8).inv()
mask0 = mask0 and 0xfffffeff.toInt()
}
9 -> {
endpointID = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 9).inv()
mask0 = mask0 and 0xfffffdff.toInt()
}
10 -> {
gateway = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 10).inv()
mask0 = mask0 and 0xfffffbff.toInt()
}
11 -> {
globalIPv6Address = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 11).inv()
mask0 = mask0 and 0xfffff7ff.toInt()
}
12 -> {
globalIPv6PrefixLen = nullableIntAdapter.fromJson(reader)
// $mask = $mask and (1 shl 12).inv()
mask0 = mask0 and 0xffffefff.toInt()
}
13 -> {
ipAddress = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 13).inv()
mask0 = mask0 and 0xffffdfff.toInt()
}
14 -> {
ipPrefixLen = nullableIntAdapter.fromJson(reader)
// $mask = $mask and (1 shl 14).inv()
mask0 = mask0 and 0xffffbfff.toInt()
}
15 -> {
ipv6Gateway = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 15).inv()
mask0 = mask0 and 0xffff7fff.toInt()
}
16 -> {
macAddress = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 16).inv()
mask0 = mask0 and 0xfffeffff.toInt()
}
17 -> {
networks = nullableMutableMapOfStringEndpointSettingsAdapter.fromJson(reader)
// $mask = $mask and (1 shl 17).inv()
mask0 = mask0 and 0xfffdffff.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xfffc0000.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return NetworkSettings(
bridge = bridge,
sandboxID = sandboxID,
hairpinMode = hairpinMode,
linkLocalIPv6Address = linkLocalIPv6Address,
linkLocalIPv6PrefixLen = linkLocalIPv6PrefixLen,
ports = ports,
sandboxKey = sandboxKey,
secondaryIPAddresses = secondaryIPAddresses,
secondaryIPv6Addresses = secondaryIPv6Addresses,
endpointID = endpointID,
gateway = gateway,
globalIPv6Address = globalIPv6Address,
globalIPv6PrefixLen = globalIPv6PrefixLen,
ipAddress = ipAddress,
ipPrefixLen = ipPrefixLen,
ipv6Gateway = ipv6Gateway,
macAddress = macAddress,
networks = networks
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor = this.constructorRef ?:
NetworkSettings::class.java.getDeclaredConstructor(String::class.java, String::class.java,
Boolean::class.javaObjectType, String::class.java, Int::class.javaObjectType,
MutableMap::class.java, String::class.java, MutableList::class.java,
MutableList::class.java, String::class.java, String::class.java, String::class.java,
Int::class.javaObjectType, String::class.java, Int::class.javaObjectType,
String::class.java, String::class.java, MutableMap::class.java,
Int::class.javaPrimitiveType, Util.DEFAULT_CONSTRUCTOR_MARKER).also {
this.constructorRef = it }
return localConstructor.newInstance(
bridge,
sandboxID,
hairpinMode,
linkLocalIPv6Address,
linkLocalIPv6PrefixLen,
ports,
sandboxKey,
secondaryIPAddresses,
secondaryIPv6Addresses,
endpointID,
gateway,
globalIPv6Address,
globalIPv6PrefixLen,
ipAddress,
ipPrefixLen,
ipv6Gateway,
macAddress,
networks,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
public override fun toJson(writer: JsonWriter, value_: NetworkSettings?): Unit {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("Bridge")
nullableStringAdapter.toJson(writer, value_.bridge)
writer.name("SandboxID")
nullableStringAdapter.toJson(writer, value_.sandboxID)
writer.name("HairpinMode")
nullableBooleanAdapter.toJson(writer, value_.hairpinMode)
writer.name("LinkLocalIPv6Address")
nullableStringAdapter.toJson(writer, value_.linkLocalIPv6Address)
writer.name("LinkLocalIPv6PrefixLen")
nullableIntAdapter.toJson(writer, value_.linkLocalIPv6PrefixLen)
writer.name("Ports")
nullableMutableMapOfStringMutableListOfPortBindingAdapter.toJson(writer, value_.ports)
writer.name("SandboxKey")
nullableStringAdapter.toJson(writer, value_.sandboxKey)
writer.name("SecondaryIPAddresses")
nullableMutableListOfAddressAdapter.toJson(writer, value_.secondaryIPAddresses)
writer.name("SecondaryIPv6Addresses")
nullableMutableListOfAddressAdapter.toJson(writer, value_.secondaryIPv6Addresses)
writer.name("EndpointID")
nullableStringAdapter.toJson(writer, value_.endpointID)
writer.name("Gateway")
nullableStringAdapter.toJson(writer, value_.gateway)
writer.name("GlobalIPv6Address")
nullableStringAdapter.toJson(writer, value_.globalIPv6Address)
writer.name("GlobalIPv6PrefixLen")
nullableIntAdapter.toJson(writer, value_.globalIPv6PrefixLen)
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("MacAddress")
nullableStringAdapter.toJson(writer, value_.macAddress)
writer.name("Networks")
nullableMutableMapOfStringEndpointSettingsAdapter.toJson(writer, value_.networks)
writer.endObject()
}
}