com.google.gerrit.entities.AutoValue_SubmitRequirementExpressionResult Maven / Gradle / Ivy
package com.google.gerrit.entities;
import com.google.common.collect.ImmutableList;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.lang.SuppressWarnings;
import java.util.Optional;
import javax.annotation.processing.Generated;
@Generated(
value = "com.ryanharter.auto.value.gson.AutoValueGsonExtension",
comments = "https://github.com/rharter/auto-value-gson"
)
final class AutoValue_SubmitRequirementExpressionResult extends $AutoValue_SubmitRequirementExpressionResult {
AutoValue_SubmitRequirementExpressionResult(SubmitRequirementExpression expression,
SubmitRequirementExpressionResult.Status status, Optional errorMessage,
ImmutableList passingAtoms, ImmutableList failingAtoms) {
super(expression, status, errorMessage, passingAtoms, failingAtoms);
}
static final class GsonTypeAdapter extends TypeAdapter {
private volatile TypeAdapter submitRequirementExpression_adapter;
private volatile TypeAdapter status_adapter;
private volatile TypeAdapter> optional__string_adapter;
private volatile TypeAdapter> immutableList__string_adapter;
private final Gson gson;
GsonTypeAdapter(Gson gson) {
this.gson = gson;
}
@Override
@SuppressWarnings("unchecked")
public void write(JsonWriter jsonWriter, SubmitRequirementExpressionResult object) throws
IOException {
if (object == null) {
jsonWriter.nullValue();
return;
}
jsonWriter.beginObject();
jsonWriter.name("expression");
if (object.expression() == null) {
jsonWriter.nullValue();
} else {
TypeAdapter submitRequirementExpression_adapter = this.submitRequirementExpression_adapter;
if (submitRequirementExpression_adapter == null) {
this.submitRequirementExpression_adapter = submitRequirementExpression_adapter = gson.getAdapter(SubmitRequirementExpression.class);
}
submitRequirementExpression_adapter.write(jsonWriter, object.expression());
}
jsonWriter.name("status");
if (object.status() == null) {
jsonWriter.nullValue();
} else {
TypeAdapter status_adapter = this.status_adapter;
if (status_adapter == null) {
this.status_adapter = status_adapter = gson.getAdapter(SubmitRequirementExpressionResult.Status.class);
}
status_adapter.write(jsonWriter, object.status());
}
jsonWriter.name("errorMessage");
if (object.errorMessage() == null) {
jsonWriter.nullValue();
} else {
TypeAdapter> optional__string_adapter = this.optional__string_adapter;
if (optional__string_adapter == null) {
this.optional__string_adapter = optional__string_adapter = (TypeAdapter>) gson.getAdapter(TypeToken.getParameterized(Optional.class, String.class));
}
optional__string_adapter.write(jsonWriter, object.errorMessage());
}
jsonWriter.name("passingAtoms");
if (object.passingAtoms() == null) {
jsonWriter.nullValue();
} else {
TypeAdapter> immutableList__string_adapter = this.immutableList__string_adapter;
if (immutableList__string_adapter == null) {
this.immutableList__string_adapter = immutableList__string_adapter = (TypeAdapter>) gson.getAdapter(TypeToken.getParameterized(ImmutableList.class, String.class));
}
immutableList__string_adapter.write(jsonWriter, object.passingAtoms());
}
jsonWriter.name("failingAtoms");
if (object.failingAtoms() == null) {
jsonWriter.nullValue();
} else {
TypeAdapter> immutableList__string_adapter = this.immutableList__string_adapter;
if (immutableList__string_adapter == null) {
this.immutableList__string_adapter = immutableList__string_adapter = (TypeAdapter>) gson.getAdapter(TypeToken.getParameterized(ImmutableList.class, String.class));
}
immutableList__string_adapter.write(jsonWriter, object.failingAtoms());
}
jsonWriter.endObject();
}
@Override
@SuppressWarnings("unchecked")
public SubmitRequirementExpressionResult read(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
jsonReader.beginObject();
SubmitRequirementExpression expression = null;
SubmitRequirementExpressionResult.Status status = null;
Optional errorMessage = null;
ImmutableList passingAtoms = null;
ImmutableList failingAtoms = null;
while (jsonReader.hasNext()) {
String _name = jsonReader.nextName();
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
continue;
}
switch (_name) {
default: {
if ("expression".equals(_name)) {
TypeAdapter submitRequirementExpression_adapter = this.submitRequirementExpression_adapter;
if (submitRequirementExpression_adapter == null) {
this.submitRequirementExpression_adapter = submitRequirementExpression_adapter = gson.getAdapter(SubmitRequirementExpression.class);
}
expression = submitRequirementExpression_adapter.read(jsonReader);
continue;
}
if ("status".equals(_name)) {
TypeAdapter status_adapter = this.status_adapter;
if (status_adapter == null) {
this.status_adapter = status_adapter = gson.getAdapter(SubmitRequirementExpressionResult.Status.class);
}
status = status_adapter.read(jsonReader);
continue;
}
if ("errorMessage".equals(_name)) {
TypeAdapter> optional__string_adapter = this.optional__string_adapter;
if (optional__string_adapter == null) {
this.optional__string_adapter = optional__string_adapter = (TypeAdapter>) gson.getAdapter(TypeToken.getParameterized(Optional.class, String.class));
}
errorMessage = optional__string_adapter.read(jsonReader);
continue;
}
if ("passingAtoms".equals(_name)) {
TypeAdapter> immutableList__string_adapter = this.immutableList__string_adapter;
if (immutableList__string_adapter == null) {
this.immutableList__string_adapter = immutableList__string_adapter = (TypeAdapter>) gson.getAdapter(TypeToken.getParameterized(ImmutableList.class, String.class));
}
passingAtoms = immutableList__string_adapter.read(jsonReader);
continue;
}
if ("failingAtoms".equals(_name)) {
TypeAdapter> immutableList__string_adapter = this.immutableList__string_adapter;
if (immutableList__string_adapter == null) {
this.immutableList__string_adapter = immutableList__string_adapter = (TypeAdapter>) gson.getAdapter(TypeToken.getParameterized(ImmutableList.class, String.class));
}
failingAtoms = immutableList__string_adapter.read(jsonReader);
continue;
}
jsonReader.skipValue();
}
}
}
jsonReader.endObject();
return new AutoValue_SubmitRequirementExpressionResult(expression, status, errorMessage, passingAtoms, failingAtoms);
}
@Override
public String toString() {
return new StringBuilder().append("TypeAdapter(").append("SubmitRequirementExpressionResult").append(")").toString();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy