com.google.gerrit.entities.AutoValue_SubmitRequirement Maven / Gradle / Ivy
package com.google.gerrit.entities;
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.Boolean;
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_SubmitRequirement extends $AutoValue_SubmitRequirement {
AutoValue_SubmitRequirement(String name, Optional description,
Optional applicabilityExpression,
SubmitRequirementExpression submittabilityExpression,
Optional overrideExpression,
boolean allowOverrideInChildProjects) {
super(name, description, applicabilityExpression, submittabilityExpression, overrideExpression, allowOverrideInChildProjects);
}
static final class GsonTypeAdapter extends TypeAdapter {
private volatile TypeAdapter string_adapter;
private volatile TypeAdapter> optional__string_adapter;
private volatile TypeAdapter> optional__submitRequirementExpression_adapter;
private volatile TypeAdapter submitRequirementExpression_adapter;
private volatile TypeAdapter boolean__adapter;
private final Gson gson;
GsonTypeAdapter(Gson gson) {
this.gson = gson;
}
@Override
@SuppressWarnings("unchecked")
public void write(JsonWriter jsonWriter, SubmitRequirement object) throws IOException {
if (object == null) {
jsonWriter.nullValue();
return;
}
jsonWriter.beginObject();
jsonWriter.name("name");
if (object.name() == null) {
jsonWriter.nullValue();
} else {
TypeAdapter string_adapter = this.string_adapter;
if (string_adapter == null) {
this.string_adapter = string_adapter = gson.getAdapter(String.class);
}
string_adapter.write(jsonWriter, object.name());
}
jsonWriter.name("description");
if (object.description() == 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.description());
}
jsonWriter.name("applicabilityExpression");
if (object.applicabilityExpression() == null) {
jsonWriter.nullValue();
} else {
TypeAdapter> optional__submitRequirementExpression_adapter = this.optional__submitRequirementExpression_adapter;
if (optional__submitRequirementExpression_adapter == null) {
this.optional__submitRequirementExpression_adapter = optional__submitRequirementExpression_adapter = (TypeAdapter>) gson.getAdapter(TypeToken.getParameterized(Optional.class, SubmitRequirementExpression.class));
}
optional__submitRequirementExpression_adapter.write(jsonWriter, object.applicabilityExpression());
}
jsonWriter.name("submittabilityExpression");
if (object.submittabilityExpression() == 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.submittabilityExpression());
}
jsonWriter.name("overrideExpression");
if (object.overrideExpression() == null) {
jsonWriter.nullValue();
} else {
TypeAdapter> optional__submitRequirementExpression_adapter = this.optional__submitRequirementExpression_adapter;
if (optional__submitRequirementExpression_adapter == null) {
this.optional__submitRequirementExpression_adapter = optional__submitRequirementExpression_adapter = (TypeAdapter>) gson.getAdapter(TypeToken.getParameterized(Optional.class, SubmitRequirementExpression.class));
}
optional__submitRequirementExpression_adapter.write(jsonWriter, object.overrideExpression());
}
jsonWriter.name("allowOverrideInChildProjects");
{
TypeAdapter boolean__adapter = this.boolean__adapter;
if (boolean__adapter == null) {
this.boolean__adapter = boolean__adapter = gson.getAdapter(Boolean.class);
}
boolean__adapter.write(jsonWriter, object.allowOverrideInChildProjects());
}
jsonWriter.endObject();
}
@Override
@SuppressWarnings("unchecked")
public SubmitRequirement read(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
jsonReader.beginObject();
SubmitRequirement.Builder builder = SubmitRequirement.builder();
while (jsonReader.hasNext()) {
String _name = jsonReader.nextName();
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
continue;
}
switch (_name) {
default: {
if ("name".equals(_name)) {
TypeAdapter string_adapter = this.string_adapter;
if (string_adapter == null) {
this.string_adapter = string_adapter = gson.getAdapter(String.class);
}
builder.setName(string_adapter.read(jsonReader));
continue;
}
if ("description".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));
}
builder.setDescription(optional__string_adapter.read(jsonReader));
continue;
}
if ("applicabilityExpression".equals(_name)) {
TypeAdapter> optional__submitRequirementExpression_adapter = this.optional__submitRequirementExpression_adapter;
if (optional__submitRequirementExpression_adapter == null) {
this.optional__submitRequirementExpression_adapter = optional__submitRequirementExpression_adapter = (TypeAdapter>) gson.getAdapter(TypeToken.getParameterized(Optional.class, SubmitRequirementExpression.class));
}
builder.setApplicabilityExpression(optional__submitRequirementExpression_adapter.read(jsonReader));
continue;
}
if ("submittabilityExpression".equals(_name)) {
TypeAdapter submitRequirementExpression_adapter = this.submitRequirementExpression_adapter;
if (submitRequirementExpression_adapter == null) {
this.submitRequirementExpression_adapter = submitRequirementExpression_adapter = gson.getAdapter(SubmitRequirementExpression.class);
}
builder.setSubmittabilityExpression(submitRequirementExpression_adapter.read(jsonReader));
continue;
}
if ("overrideExpression".equals(_name)) {
TypeAdapter> optional__submitRequirementExpression_adapter = this.optional__submitRequirementExpression_adapter;
if (optional__submitRequirementExpression_adapter == null) {
this.optional__submitRequirementExpression_adapter = optional__submitRequirementExpression_adapter = (TypeAdapter>) gson.getAdapter(TypeToken.getParameterized(Optional.class, SubmitRequirementExpression.class));
}
builder.setOverrideExpression(optional__submitRequirementExpression_adapter.read(jsonReader));
continue;
}
if ("allowOverrideInChildProjects".equals(_name)) {
TypeAdapter boolean__adapter = this.boolean__adapter;
if (boolean__adapter == null) {
this.boolean__adapter = boolean__adapter = gson.getAdapter(Boolean.class);
}
builder.setAllowOverrideInChildProjects(boolean__adapter.read(jsonReader));
continue;
}
jsonReader.skipValue();
}
}
}
jsonReader.endObject();
return builder.build();
}
@Override
public String toString() {
return new StringBuilder().append("TypeAdapter(").append("SubmitRequirement").append(")").toString();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy