org.graylog2.indexer.fieldtypes.AutoValue_FieldTypes_Type Maven / Gradle / Ivy
package org.graylog2.indexer.fieldtypes;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableSet;
import javax.annotation.processing.Generated;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_FieldTypes_Type extends FieldTypes.Type {
private final String type;
private final ImmutableSet properties;
private final ImmutableSet indexNames;
private AutoValue_FieldTypes_Type(
String type,
ImmutableSet properties,
ImmutableSet indexNames) {
this.type = type;
this.properties = properties;
this.indexNames = indexNames;
}
@JsonProperty("type")
@Override
public String type() {
return type;
}
@JsonProperty("properties")
@Override
public ImmutableSet properties() {
return properties;
}
@JsonProperty("index_names")
@Override
public ImmutableSet indexNames() {
return indexNames;
}
@Override
public String toString() {
return "Type{"
+ "type=" + type + ", "
+ "properties=" + properties + ", "
+ "indexNames=" + indexNames
+ "}";
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof FieldTypes.Type) {
FieldTypes.Type that = (FieldTypes.Type) o;
return this.type.equals(that.type())
&& this.properties.equals(that.properties())
&& this.indexNames.equals(that.indexNames());
}
return false;
}
@Override
public int hashCode() {
int h$ = 1;
h$ *= 1000003;
h$ ^= type.hashCode();
h$ *= 1000003;
h$ ^= properties.hashCode();
h$ *= 1000003;
h$ ^= indexNames.hashCode();
return h$;
}
@Override
public FieldTypes.Type.Builder toBuilder() {
return new Builder(this);
}
static final class Builder extends FieldTypes.Type.Builder {
private String type;
private ImmutableSet.Builder propertiesBuilder$;
private ImmutableSet properties;
private ImmutableSet.Builder indexNamesBuilder$;
private ImmutableSet indexNames;
Builder() {
}
private Builder(FieldTypes.Type source) {
this.type = source.type();
this.properties = source.properties();
this.indexNames = source.indexNames();
}
@Override
public FieldTypes.Type.Builder type(String type) {
if (type == null) {
throw new NullPointerException("Null type");
}
this.type = type;
return this;
}
@Override
ImmutableSet.Builder propertiesBuilder() {
if (propertiesBuilder$ == null) {
if (properties == null) {
propertiesBuilder$ = ImmutableSet.builder();
} else {
propertiesBuilder$ = ImmutableSet.builder();
propertiesBuilder$.addAll(properties);
properties = null;
}
}
return propertiesBuilder$;
}
@Override
ImmutableSet.Builder indexNamesBuilder() {
if (indexNamesBuilder$ == null) {
if (indexNames == null) {
indexNamesBuilder$ = ImmutableSet.builder();
} else {
indexNamesBuilder$ = ImmutableSet.builder();
indexNamesBuilder$.addAll(indexNames);
indexNames = null;
}
}
return indexNamesBuilder$;
}
@Override
public FieldTypes.Type build() {
if (propertiesBuilder$ != null) {
this.properties = propertiesBuilder$.build();
} else if (this.properties == null) {
this.properties = ImmutableSet.of();
}
if (indexNamesBuilder$ != null) {
this.indexNames = indexNamesBuilder$.build();
} else if (this.indexNames == null) {
this.indexNames = ImmutableSet.of();
}
String missing = "";
if (this.type == null) {
missing += " type";
}
if (!missing.isEmpty()) {
throw new IllegalStateException("Missing required properties:" + missing);
}
return new AutoValue_FieldTypes_Type(
this.type,
this.properties,
this.indexNames);
}
}
}