All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.gesellix.docker.remote.api.HistoryResponseItemJsonAdapter.kt Maven / Gradle / Ivy

There is a newer version: 2024-11-04T20-53-00
Show newest version
// 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.Long
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.MutableList
import kotlin.collections.emptySet
import kotlin.text.buildString

public class HistoryResponseItemJsonAdapter(
  moshi: Moshi,
) : JsonAdapter() {
  private val options: JsonReader.Options = JsonReader.Options.of("Id", "Created", "CreatedBy",
      "Tags", "Size", "Comment")

  private val stringAdapter: JsonAdapter = moshi.adapter(String::class.java, emptySet(),
      "id")

  private val longAdapter: JsonAdapter = moshi.adapter(Long::class.java, emptySet(),
      "created")

  private val nullableMutableListOfStringAdapter: JsonAdapter?> =
      moshi.adapter(Types.newParameterizedType(MutableList::class.java, String::class.java),
      emptySet(), "tags")

  public override fun toString(): String = buildString(41) {
      append("GeneratedJsonAdapter(").append("HistoryResponseItem").append(')') }

  public override fun fromJson(reader: JsonReader): HistoryResponseItem {
    var id: String? = null
    var created: Long? = null
    var createdBy: String? = null
    var tags: MutableList? = null
    var propertySize: Long? = null
    var comment: String? = null
    reader.beginObject()
    while (reader.hasNext()) {
      when (reader.selectName(options)) {
        0 -> id = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("id", "Id", reader)
        1 -> created = longAdapter.fromJson(reader) ?: throw Util.unexpectedNull("created",
            "Created", reader)
        2 -> createdBy = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("createdBy",
            "CreatedBy", reader)
        3 -> tags = nullableMutableListOfStringAdapter.fromJson(reader)
        4 -> propertySize = longAdapter.fromJson(reader) ?:
            throw Util.unexpectedNull("propertySize", "Size", reader)
        5 -> comment = stringAdapter.fromJson(reader) ?: throw Util.unexpectedNull("comment",
            "Comment", reader)
        -1 -> {
          // Unknown name, skip it.
          reader.skipName()
          reader.skipValue()
        }
      }
    }
    reader.endObject()
    return HistoryResponseItem(
        id = id ?: throw Util.missingProperty("id", "Id", reader),
        created = created ?: throw Util.missingProperty("created", "Created", reader),
        createdBy = createdBy ?: throw Util.missingProperty("createdBy", "CreatedBy", reader),
        tags = tags,
        propertySize = propertySize ?: throw Util.missingProperty("propertySize", "Size", reader),
        comment = comment ?: throw Util.missingProperty("comment", "Comment", reader)
    )
  }

  public override fun toJson(writer: JsonWriter, value_: HistoryResponseItem?): Unit {
    if (value_ == null) {
      throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
    }
    writer.beginObject()
    writer.name("Id")
    stringAdapter.toJson(writer, value_.id)
    writer.name("Created")
    longAdapter.toJson(writer, value_.created)
    writer.name("CreatedBy")
    stringAdapter.toJson(writer, value_.createdBy)
    writer.name("Tags")
    nullableMutableListOfStringAdapter.toJson(writer, value_.tags)
    writer.name("Size")
    longAdapter.toJson(writer, value_.propertySize)
    writer.name("Comment")
    stringAdapter.toJson(writer, value_.comment)
    writer.endObject()
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy