org.graylog.plugins.pipelineprocessor.ast.AutoValue_Rule Maven / Gradle / Ivy
package org.graylog.plugins.pipelineprocessor.ast;
import java.util.Collection;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import org.graylog.plugins.pipelineprocessor.ast.expressions.LogicalExpression;
import org.graylog.plugins.pipelineprocessor.ast.statements.Statement;
@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_Rule extends Rule {
private final String id;
private final String name;
private final LogicalExpression when;
private final Collection then;
private AutoValue_Rule(
@Nullable String id,
String name,
LogicalExpression when,
Collection then) {
this.id = id;
this.name = name;
this.when = when;
this.then = then;
}
@Nullable
@Override
public String id() {
return id;
}
@Override
public String name() {
return name;
}
@Override
public LogicalExpression when() {
return when;
}
@Override
public Collection then() {
return then;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (o instanceof Rule) {
Rule that = (Rule) o;
return (this.id == null ? that.id() == null : this.id.equals(that.id()))
&& this.name.equals(that.name())
&& this.when.equals(that.when())
&& this.then.equals(that.then());
}
return false;
}
@Override
public int hashCode() {
int h$ = 1;
h$ *= 1000003;
h$ ^= (id == null) ? 0 : id.hashCode();
h$ *= 1000003;
h$ ^= name.hashCode();
h$ *= 1000003;
h$ ^= when.hashCode();
h$ *= 1000003;
h$ ^= then.hashCode();
return h$;
}
@Override
public Rule.Builder toBuilder() {
return new Builder(this);
}
static final class Builder extends Rule.Builder {
private String id;
private String name;
private LogicalExpression when;
private Collection then;
Builder() {
}
private Builder(Rule source) {
this.id = source.id();
this.name = source.name();
this.when = source.when();
this.then = source.then();
}
@Override
public Rule.Builder id(String id) {
this.id = id;
return this;
}
@Override
public Rule.Builder name(String name) {
if (name == null) {
throw new NullPointerException("Null name");
}
this.name = name;
return this;
}
@Override
public Rule.Builder when(LogicalExpression when) {
if (when == null) {
throw new NullPointerException("Null when");
}
this.when = when;
return this;
}
@Override
public Rule.Builder then(Collection then) {
if (then == null) {
throw new NullPointerException("Null then");
}
this.then = then;
return this;
}
@Override
public Rule build() {
String missing = "";
if (this.name == null) {
missing += " name";
}
if (this.when == null) {
missing += " when";
}
if (this.then == null) {
missing += " then";
}
if (!missing.isEmpty()) {
throw new IllegalStateException("Missing required properties:" + missing);
}
return new AutoValue_Rule(
this.id,
this.name,
this.when,
this.then);
}
}
}