Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
generatedByKspKotlin.com.squareup.tracing.ChromeTraceEventJsonAdapter.kt Maven / Gradle / Ivy
// 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 com.squareup.tracing
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.Char
import kotlin.Int
import kotlin.Long
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
internal class ChromeTraceEventJsonAdapter(
moshi: Moshi,
) : JsonAdapter() {
private val options: JsonReader.Options = JsonReader.Options.of("name", "cat", "ph", "ts", "pid",
"tid", "id", "s", "args")
private val stringAdapter: JsonAdapter = moshi.adapter(String::class.java, emptySet(),
"name")
private val nullableStringAdapter: JsonAdapter = moshi.adapter(String::class.java,
emptySet(), "category")
private val phaseAdapter: JsonAdapter =
moshi.adapter(ChromeTraceEvent.Phase::class.java, emptySet(), "phase")
private val longAdapter: JsonAdapter = moshi.adapter(Long::class.java, emptySet(),
"timestampMicros")
private val intAdapter: JsonAdapter = moshi.adapter(Int::class.java, emptySet(), "processId")
private val nullableAnyAdapter: JsonAdapter = moshi.adapter(Any::class.java, emptySet(),
"id")
private val nullableCharAdapter: JsonAdapter = moshi.adapter(Char::class.javaObjectType,
emptySet(), "scope")
private val nullableMapOfStringNullableAnyAdapter: JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(Map::class.java, String::class.java,
Any::class.java), emptySet(), "args")
@Volatile
private var constructorRef: Constructor? = null
public override fun toString(): String = buildString(38) {
append("GeneratedJsonAdapter(").append("ChromeTraceEvent").append(')') }
public override fun fromJson(reader: JsonReader): ChromeTraceEvent {
var name: String? = null
var category: String? = null
var phase: ChromeTraceEvent.Phase? = null
var timestampMicros: Long? = null
var processId: Int? = 0
var threadId: Int? = 0
var id: Any? = null
var scope: Char? = null
var args: Map? = 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 -> {
category = nullableStringAdapter.fromJson(reader)
// $mask = $mask and (1 shl 1).inv()
mask0 = mask0 and 0xfffffffd.toInt()
}
2 -> phase = phaseAdapter.fromJson(reader) ?: throw Util.unexpectedNull("phase", "ph",
reader)
3 -> timestampMicros = longAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("timestampMicros", "ts", reader)
4 -> {
processId = intAdapter.fromJson(reader) ?: throw Util.unexpectedNull("processId", "pid",
reader)
// $mask = $mask and (1 shl 4).inv()
mask0 = mask0 and 0xffffffef.toInt()
}
5 -> {
threadId = intAdapter.fromJson(reader) ?: throw Util.unexpectedNull("threadId", "tid",
reader)
// $mask = $mask and (1 shl 5).inv()
mask0 = mask0 and 0xffffffdf.toInt()
}
6 -> {
id = nullableAnyAdapter.fromJson(reader)
// $mask = $mask and (1 shl 6).inv()
mask0 = mask0 and 0xffffffbf.toInt()
}
7 -> {
scope = nullableCharAdapter.fromJson(reader)
// $mask = $mask and (1 shl 7).inv()
mask0 = mask0 and 0xffffff7f.toInt()
}
8 -> {
args = nullableMapOfStringNullableAnyAdapter.fromJson(reader)
// $mask = $mask and (1 shl 8).inv()
mask0 = mask0 and 0xfffffeff.toInt()
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
if (mask0 == 0xfffffe0d.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
return ChromeTraceEvent(
name = name ?: throw Util.missingProperty("name", "name", reader),
category = category,
phase = phase ?: throw Util.missingProperty("phase", "ph", reader),
timestampMicros = timestampMicros ?: throw Util.missingProperty("timestampMicros", "ts",
reader),
processId = processId as Int,
threadId = threadId as Int,
id = id,
scope = scope,
args = args
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor = this.constructorRef ?:
ChromeTraceEvent::class.java.getDeclaredConstructor(String::class.java,
String::class.java, ChromeTraceEvent.Phase::class.java, Long::class.javaPrimitiveType,
Int::class.javaPrimitiveType, Int::class.javaPrimitiveType, Any::class.java,
Char::class.javaObjectType, Map::class.java, Int::class.javaPrimitiveType,
Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
return localConstructor.newInstance(
name ?: throw Util.missingProperty("name", "name", reader),
category,
phase ?: throw Util.missingProperty("phase", "ph", reader),
timestampMicros ?: throw Util.missingProperty("timestampMicros", "ts", reader),
processId,
threadId,
id,
scope,
args,
mask0,
/* DefaultConstructorMarker */ null
)
}
}
public override fun toJson(writer: JsonWriter, value_: ChromeTraceEvent?): 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("cat")
nullableStringAdapter.toJson(writer, value_.category)
writer.name("ph")
phaseAdapter.toJson(writer, value_.phase)
writer.name("ts")
longAdapter.toJson(writer, value_.timestampMicros)
writer.name("pid")
intAdapter.toJson(writer, value_.processId)
writer.name("tid")
intAdapter.toJson(writer, value_.threadId)
writer.name("id")
nullableAnyAdapter.toJson(writer, value_.id)
writer.name("s")
nullableCharAdapter.toJson(writer, value_.scope)
writer.name("args")
nullableMapOfStringNullableAnyAdapter.toJson(writer, value_.args)
writer.endObject()
}
}