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

org.graylog.events.event.AutoValue_EventWithContext Maven / Gradle / Ivy

There is a newer version: 6.1.4
Show newest version
package org.graylog.events.event;

import java.util.Optional;
import javax.annotation.Nullable;
import javax.annotation.processing.Generated;
import org.graylog2.plugin.Message;

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

  private final Event event;

  private final Optional messageContext;

  private final Optional eventContext;

  private AutoValue_EventWithContext(
      Event event,
      Optional messageContext,
      Optional eventContext) {
    this.event = event;
    this.messageContext = messageContext;
    this.eventContext = eventContext;
  }

  @Override
  public Event event() {
    return event;
  }

  @Override
  public Optional messageContext() {
    return messageContext;
  }

  @Override
  public Optional eventContext() {
    return eventContext;
  }

  @Override
  public String toString() {
    return "EventWithContext{"
        + "event=" + event + ", "
        + "messageContext=" + messageContext + ", "
        + "eventContext=" + eventContext
        + "}";
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }
    if (o instanceof EventWithContext) {
      EventWithContext that = (EventWithContext) o;
      return this.event.equals(that.event())
          && this.messageContext.equals(that.messageContext())
          && this.eventContext.equals(that.eventContext());
    }
    return false;
  }

  @Override
  public int hashCode() {
    int h$ = 1;
    h$ *= 1000003;
    h$ ^= event.hashCode();
    h$ *= 1000003;
    h$ ^= messageContext.hashCode();
    h$ *= 1000003;
    h$ ^= eventContext.hashCode();
    return h$;
  }

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

  static final class Builder extends EventWithContext.Builder {
    private Event event;
    private Optional messageContext = Optional.empty();
    private Optional eventContext = Optional.empty();
    Builder() {
    }
    private Builder(EventWithContext source) {
      this.event = source.event();
      this.messageContext = source.messageContext();
      this.eventContext = source.eventContext();
    }
    @Override
    public EventWithContext.Builder event(Event event) {
      if (event == null) {
        throw new NullPointerException("Null event");
      }
      this.event = event;
      return this;
    }
    @Override
    public EventWithContext.Builder messageContext(@Nullable Message messageContext) {
      this.messageContext = Optional.ofNullable(messageContext);
      return this;
    }
    @Override
    public EventWithContext.Builder eventContext(@Nullable Event eventContext) {
      this.eventContext = Optional.ofNullable(eventContext);
      return this;
    }
    @Override
    public EventWithContext build() {
      if (this.event == null) {
        String missing = " event";
        throw new IllegalStateException("Missing required properties:" + missing);
      }
      return new AutoValue_EventWithContext(
          this.event,
          this.messageContext,
          this.eventContext);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy