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.
edu.illinois.cs.cs125.questioner.lib.QuestionJsonAdapter.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 edu.illinois.cs.cs125.questioner.lib
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.List
import kotlin.collections.Map
import kotlin.collections.Set
import kotlin.collections.emptySet
import kotlin.jvm.Volatile
import kotlin.text.buildString
public class QuestionJsonAdapter(
moshi: Moshi,
) : JsonAdapter() {
private val options: JsonReader.Options = JsonReader.Options.of("published", "classification",
"metadata", "annotatedControls", "question", "solutionByLanguage", "alternativeSolutions",
"incorrectExamples", "common", "commonFiles", "templateByLanguage", "importWhitelist",
"importBlacklist", "checkstyleSuppressions", "testingSettings", "testTestingLimits",
"validationResults", "fauxStatic", "testTestingIncorrect", "correctPath")
private val publishedAdapter: JsonAdapter =
moshi.adapter(Question.Published::class.java, emptySet(), "published")
private val classificationAdapter: JsonAdapter =
moshi.adapter(Question.Classification::class.java, emptySet(), "classification")
private val nullableMetadataAdapter: JsonAdapter =
moshi.adapter(Question.Metadata::class.java, emptySet(), "metadata")
private val testingControlAdapter: JsonAdapter =
moshi.adapter(Question.TestingControl::class.java, emptySet(), "annotatedControls")
private val flatFileAdapter: JsonAdapter =
moshi.adapter(Question.FlatFile::class.java, emptySet(), "question")
private val mapOfLanguageFlatFileAdapter: JsonAdapter> =
moshi.adapter(Types.newParameterizedType(Map::class.java, Language::class.java,
Question.FlatFile::class.java), emptySet(), "solutionByLanguage")
private val listOfFlatFileAdapter: JsonAdapter> =
moshi.adapter(Types.newParameterizedType(List::class.java, Question.FlatFile::class.java),
emptySet(), "alternativeSolutions")
private val listOfIncorrectFileAdapter: JsonAdapter> =
moshi.adapter(Types.newParameterizedType(List::class.java,
Question.IncorrectFile::class.java), emptySet(), "incorrectExamples")
private val nullableListOfStringAdapter: JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(List::class.java, String::class.java), emptySet(),
"common")
private val nullableListOfCommonFileAdapter: JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(List::class.java, Question.CommonFile::class.java),
emptySet(), "commonFiles")
private val nullableMapOfLanguageStringAdapter: JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(Map::class.java, Language::class.java,
String::class.java), emptySet(), "templateByLanguage")
private val setOfStringAdapter: JsonAdapter> =
moshi.adapter(Types.newParameterizedType(Set::class.java, String::class.java), emptySet(),
"importWhitelist")
private val nullableTestingSettingsAdapter: JsonAdapter =
moshi.adapter(Question.TestingSettings::class.java, emptySet(), "testingSettings")
private val nullableTestTestingLimitsAdapter: JsonAdapter =
moshi.adapter(Question.TestTestingLimits::class.java, emptySet(), "testTestingLimits")
private val nullableValidationResultsAdapter: JsonAdapter =
moshi.adapter(Question.ValidationResults::class.java, emptySet(), "validationResults")
private val booleanAdapter: JsonAdapter = moshi.adapter(Boolean::class.java, emptySet(),
"fauxStatic")
private val nullableListOfTestTestingMutationAdapter:
JsonAdapter?> =
moshi.adapter(Types.newParameterizedType(List::class.java,
Question.TestTestingMutation::class.java), emptySet(), "testTestingIncorrect")
private val nullableStringAdapter: JsonAdapter = moshi.adapter(String::class.java,
emptySet(), "correctPath")
@Volatile
private var constructorRef: Constructor? = null
public override fun toString(): String = buildString(30) {
append("GeneratedJsonAdapter(").append("Question").append(')') }
public override fun fromJson(reader: JsonReader): Question {
var published: Question.Published? = null
var classification: Question.Classification? = null
var metadata: Question.Metadata? = null
var annotatedControls: Question.TestingControl? = null
var question: Question.FlatFile? = null
var solutionByLanguage: Map? = null
var alternativeSolutions: List? = null
var incorrectExamples: List? = null
var common: List? = null
var commonFiles: List? = null
var templateByLanguage: Map? = null
var importWhitelist: Set? = null
var importBlacklist: Set? = null
var checkstyleSuppressions: Set? = null
var testingSettings: Question.TestingSettings? = null
var testingSettingsSet: Boolean = false
var testTestingLimits: Question.TestTestingLimits? = null
var testTestingLimitsSet: Boolean = false
var validationResults: Question.ValidationResults? = null
var validationResultsSet: Boolean = false
var fauxStatic: Boolean? = null
var testTestingIncorrect: List? = null
var testTestingIncorrectSet: Boolean = false
var correctPath: String? = null
var correctPathSet: Boolean = false
var mask0 = -1
reader.beginObject()
while (reader.hasNext()) {
when (reader.selectName(options)) {
0 -> published = publishedAdapter.fromJson(reader) ?: throw Util.unexpectedNull("published",
"published", reader)
1 -> classification = classificationAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("classification", "classification", reader)
2 -> metadata = nullableMetadataAdapter.fromJson(reader)
3 -> annotatedControls = testingControlAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("annotatedControls", "annotatedControls", reader)
4 -> question = flatFileAdapter.fromJson(reader) ?: throw Util.unexpectedNull("question",
"question", reader)
5 -> solutionByLanguage = mapOfLanguageFlatFileAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("solutionByLanguage", "solutionByLanguage", reader)
6 -> alternativeSolutions = listOfFlatFileAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("alternativeSolutions", "alternativeSolutions", reader)
7 -> incorrectExamples = listOfIncorrectFileAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("incorrectExamples", "incorrectExamples", reader)
8 -> common = nullableListOfStringAdapter.fromJson(reader)
9 -> commonFiles = nullableListOfCommonFileAdapter.fromJson(reader)
10 -> templateByLanguage = nullableMapOfLanguageStringAdapter.fromJson(reader)
11 -> importWhitelist = setOfStringAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("importWhitelist", "importWhitelist", reader)
12 -> importBlacklist = setOfStringAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("importBlacklist", "importBlacklist", reader)
13 -> {
checkstyleSuppressions = setOfStringAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("checkstyleSuppressions", "checkstyleSuppressions", reader)
// $mask = $mask and (1 shl 13).inv()
mask0 = mask0 and 0xffffdfff.toInt()
}
14 -> {
testingSettings = nullableTestingSettingsAdapter.fromJson(reader)
testingSettingsSet = true
}
15 -> {
testTestingLimits = nullableTestTestingLimitsAdapter.fromJson(reader)
testTestingLimitsSet = true
}
16 -> {
validationResults = nullableValidationResultsAdapter.fromJson(reader)
validationResultsSet = true
}
17 -> fauxStatic = booleanAdapter.fromJson(reader) ?:
throw Util.unexpectedNull("fauxStatic", "fauxStatic", reader)
18 -> {
testTestingIncorrect = nullableListOfTestTestingMutationAdapter.fromJson(reader)
testTestingIncorrectSet = true
}
19 -> {
correctPath = nullableStringAdapter.fromJson(reader)
correctPathSet = true
}
-1 -> {
// Unknown name, skip it.
reader.skipName()
reader.skipValue()
}
}
}
reader.endObject()
val result: Question
if (mask0 == 0xffffdfff.toInt()) {
// All parameters with defaults are set, invoke the constructor directly
result = Question(
published = published ?: throw Util.missingProperty("published", "published", reader),
classification = classification ?: throw Util.missingProperty("classification",
"classification", reader),
metadata = metadata,
annotatedControls = annotatedControls ?: throw Util.missingProperty("annotatedControls",
"annotatedControls", reader),
question = question ?: throw Util.missingProperty("question", "question", reader),
solutionByLanguage = solutionByLanguage ?:
throw Util.missingProperty("solutionByLanguage", "solutionByLanguage", reader),
alternativeSolutions = alternativeSolutions ?:
throw Util.missingProperty("alternativeSolutions", "alternativeSolutions", reader),
incorrectExamples = incorrectExamples ?: throw Util.missingProperty("incorrectExamples",
"incorrectExamples", reader),
common = common,
commonFiles = commonFiles,
templateByLanguage = templateByLanguage,
importWhitelist = importWhitelist ?: throw Util.missingProperty("importWhitelist",
"importWhitelist", reader),
importBlacklist = importBlacklist ?: throw Util.missingProperty("importBlacklist",
"importBlacklist", reader),
checkstyleSuppressions = checkstyleSuppressions as Set
)
} else {
// Reflectively invoke the synthetic defaults constructor
@Suppress("UNCHECKED_CAST")
val localConstructor: Constructor = this.constructorRef ?:
Question::class.java.getDeclaredConstructor(Question.Published::class.java,
Question.Classification::class.java, Question.Metadata::class.java,
Question.TestingControl::class.java, Question.FlatFile::class.java, Map::class.java,
List::class.java, List::class.java, List::class.java, List::class.java, Map::class.java,
Set::class.java, Set::class.java, Set::class.java, Int::class.javaPrimitiveType,
Util.DEFAULT_CONSTRUCTOR_MARKER).also { this.constructorRef = it }
result = localConstructor.newInstance(
published ?: throw Util.missingProperty("published", "published", reader),
classification ?: throw Util.missingProperty("classification", "classification", reader),
metadata,
annotatedControls ?: throw Util.missingProperty("annotatedControls", "annotatedControls",
reader),
question ?: throw Util.missingProperty("question", "question", reader),
solutionByLanguage ?: throw Util.missingProperty("solutionByLanguage",
"solutionByLanguage", reader),
alternativeSolutions ?: throw Util.missingProperty("alternativeSolutions",
"alternativeSolutions", reader),
incorrectExamples ?: throw Util.missingProperty("incorrectExamples", "incorrectExamples",
reader),
common,
commonFiles,
templateByLanguage,
importWhitelist ?: throw Util.missingProperty("importWhitelist", "importWhitelist",
reader),
importBlacklist ?: throw Util.missingProperty("importBlacklist", "importBlacklist",
reader),
checkstyleSuppressions,
mask0,
/* DefaultConstructorMarker */ null
)
}
if (testingSettingsSet) {
result.testingSettings = testingSettings
}
if (testTestingLimitsSet) {
result.testTestingLimits = testTestingLimits
}
if (validationResultsSet) {
result.validationResults = validationResults
}
result.fauxStatic = fauxStatic ?: result.fauxStatic
if (testTestingIncorrectSet) {
result.testTestingIncorrect = testTestingIncorrect
}
if (correctPathSet) {
result.correctPath = correctPath
}
return result
}
public override fun toJson(writer: JsonWriter, value_: Question?): Unit {
if (value_ == null) {
throw NullPointerException("value_ was null! Wrap in .nullSafe() to write nullable values.")
}
writer.beginObject()
writer.name("published")
publishedAdapter.toJson(writer, value_.published)
writer.name("classification")
classificationAdapter.toJson(writer, value_.classification)
writer.name("metadata")
nullableMetadataAdapter.toJson(writer, value_.metadata)
writer.name("annotatedControls")
testingControlAdapter.toJson(writer, value_.annotatedControls)
writer.name("question")
flatFileAdapter.toJson(writer, value_.question)
writer.name("solutionByLanguage")
mapOfLanguageFlatFileAdapter.toJson(writer, value_.solutionByLanguage)
writer.name("alternativeSolutions")
listOfFlatFileAdapter.toJson(writer, value_.alternativeSolutions)
writer.name("incorrectExamples")
listOfIncorrectFileAdapter.toJson(writer, value_.incorrectExamples)
writer.name("common")
nullableListOfStringAdapter.toJson(writer, value_.common)
writer.name("commonFiles")
nullableListOfCommonFileAdapter.toJson(writer, value_.commonFiles)
writer.name("templateByLanguage")
nullableMapOfLanguageStringAdapter.toJson(writer, value_.templateByLanguage)
writer.name("importWhitelist")
setOfStringAdapter.toJson(writer, value_.importWhitelist)
writer.name("importBlacklist")
setOfStringAdapter.toJson(writer, value_.importBlacklist)
writer.name("checkstyleSuppressions")
setOfStringAdapter.toJson(writer, value_.checkstyleSuppressions)
writer.name("testingSettings")
nullableTestingSettingsAdapter.toJson(writer, value_.testingSettings)
writer.name("testTestingLimits")
nullableTestTestingLimitsAdapter.toJson(writer, value_.testTestingLimits)
writer.name("validationResults")
nullableValidationResultsAdapter.toJson(writer, value_.validationResults)
writer.name("fauxStatic")
booleanAdapter.toJson(writer, value_.fauxStatic)
writer.name("testTestingIncorrect")
nullableListOfTestTestingMutationAdapter.toJson(writer, value_.testTestingIncorrect)
writer.name("correctPath")
nullableStringAdapter.toJson(writer, value_.correctPath)
writer.endObject()
}
}