All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.graylog.plugins.views.search.AutoValue_QueryResult Maven / Gradle / Ivy

There is a newer version: 6.1.4
Show newest version
package org.graylog.plugins.views.search;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import javax.annotation.processing.Generated;
import org.graylog.plugins.views.search.engine.QueryExecutionStats;
import org.graylog.plugins.views.search.errors.SearchError;

@Generated("com.google.auto.value.processor.AutoValueProcessor")
final class AutoValue_QueryResult extends QueryResult {

  private final Query query;

  private final QueryExecutionStats executionStats;

  private final Map searchTypes;

  @Nullable
  private final Set errors;

  private final QueryResult.State state;

  private AutoValue_QueryResult(
      Query query,
      QueryExecutionStats executionStats,
      Map searchTypes,
      @Nullable Set errors,
      QueryResult.State state) {
    this.query = query;
    this.executionStats = executionStats;
    this.searchTypes = searchTypes;
    this.errors = errors;
    this.state = state;
  }

  @JsonProperty
  @Override
  public Query query() {
    return query;
  }

  @JsonProperty("execution_stats")
  @Override
  public QueryExecutionStats executionStats() {
    return executionStats;
  }

  @JsonProperty("search_types")
  @Override
  public Map searchTypes() {
    return searchTypes;
  }

  @JsonInclude(JsonInclude.Include.NON_ABSENT)
  @JsonProperty("errors")
  @Nullable
  @Override
  public Set errors() {
    return errors;
  }

  @JsonProperty("state")
  @Override
  public QueryResult.State state() {
    return state;
  }

  @Override
  public String toString() {
    return "QueryResult{"
        + "query=" + query + ", "
        + "executionStats=" + executionStats + ", "
        + "searchTypes=" + searchTypes + ", "
        + "errors=" + errors + ", "
        + "state=" + state
        + "}";
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (o instanceof QueryResult) {
      QueryResult that = (QueryResult) o;
      return this.query.equals(that.query())
          && this.executionStats.equals(that.executionStats())
          && this.searchTypes.equals(that.searchTypes())
          && (this.errors == null ? that.errors() == null : this.errors.equals(that.errors()))
          && this.state.equals(that.state());
    }
    return false;
  }

  @Override
  public int hashCode() {
    int h$ = 1;
    h$ *= 1000003;
    h$ ^= query.hashCode();
    h$ *= 1000003;
    h$ ^= executionStats.hashCode();
    h$ *= 1000003;
    h$ ^= searchTypes.hashCode();
    h$ *= 1000003;
    h$ ^= (errors == null) ? 0 : errors.hashCode();
    h$ *= 1000003;
    h$ ^= state.hashCode();
    return h$;
  }

  @Override
  public QueryResult.Builder toBuilder() {
    return new Builder(this);
  }

  static final class Builder extends QueryResult.Builder {
    private Query query;
    private QueryExecutionStats executionStats;
    private Map searchTypes;
    private Set errors;
    private QueryResult.State state;
    Builder() {
    }
    private Builder(QueryResult source) {
      this.query = source.query();
      this.executionStats = source.executionStats();
      this.searchTypes = source.searchTypes();
      this.errors = source.errors();
      this.state = source.state();
    }
    @Override
    public QueryResult.Builder query(Query query) {
      if (query == null) {
        throw new NullPointerException("Null query");
      }
      this.query = query;
      return this;
    }
    @Override
    public QueryResult.Builder executionStats(QueryExecutionStats executionStats) {
      if (executionStats == null) {
        throw new NullPointerException("Null executionStats");
      }
      this.executionStats = executionStats;
      return this;
    }
    @Override
    public QueryResult.Builder searchTypes(Map searchTypes) {
      if (searchTypes == null) {
        throw new NullPointerException("Null searchTypes");
      }
      this.searchTypes = searchTypes;
      return this;
    }
    @Override
    public QueryResult.Builder errors(@Nullable Set errors) {
      this.errors = errors;
      return this;
    }
    @Override
    public QueryResult.Builder state(QueryResult.State state) {
      if (state == null) {
        throw new NullPointerException("Null state");
      }
      this.state = state;
      return this;
    }
    @Override
    public QueryResult build() {
      if (this.query == null
          || this.executionStats == null
          || this.searchTypes == null
          || this.state == null) {
        StringBuilder missing = new StringBuilder();
        if (this.query == null) {
          missing.append(" query");
        }
        if (this.executionStats == null) {
          missing.append(" executionStats");
        }
        if (this.searchTypes == null) {
          missing.append(" searchTypes");
        }
        if (this.state == null) {
          missing.append(" state");
        }
        throw new IllegalStateException("Missing required properties:" + missing);
      }
      return new AutoValue_QueryResult(
          this.query,
          this.executionStats,
          this.searchTypes,
          this.errors,
          this.state);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy