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

com.spotify.google.cloud.pubsub.client.ReceivedMessageBuilder Maven / Gradle / Ivy

There is a newer version: 1.34
Show newest version
package com.spotify.google.cloud.pubsub.client;

import io.norberg.automatter.AutoMatter;
import javax.annotation.Generated;

@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
public final class ReceivedMessageBuilder {
  private String ackId;

  private Message message;

  public ReceivedMessageBuilder() {
  }

  private ReceivedMessageBuilder(ReceivedMessage v) {
    this.ackId = v.ackId();
    this.message = v.message();
  }

  private ReceivedMessageBuilder(ReceivedMessageBuilder v) {
    this.ackId = v.ackId;
    this.message = v.message;
  }

  public String ackId() {
    return ackId;
  }

  public ReceivedMessageBuilder ackId(String ackId) {
    if (ackId == null) {
      throw new NullPointerException("ackId");
    }
    this.ackId = ackId;
    return this;
  }

  public Message message() {
    return message;
  }

  public ReceivedMessageBuilder message(Message message) {
    if (message == null) {
      throw new NullPointerException("message");
    }
    this.message = message;
    return this;
  }

  public ReceivedMessage build() {
    return new Value(ackId, message);
  }

  public static ReceivedMessageBuilder from(ReceivedMessage v) {
    return new ReceivedMessageBuilder(v);
  }

  public static ReceivedMessageBuilder from(ReceivedMessageBuilder v) {
    return new ReceivedMessageBuilder(v);
  }

  private static final class Value implements ReceivedMessage {
    private final String ackId;

    private final Message message;

    private Value(@AutoMatter.Field("ackId") String ackId, @AutoMatter.Field("message") Message message) {
      if (ackId == null) {
        throw new NullPointerException("ackId");
      }
      if (message == null) {
        throw new NullPointerException("message");
      }
      this.ackId = ackId;
      this.message = message;
    }

    @AutoMatter.Field
    @Override
    public String ackId() {
      return ackId;
    }

    @AutoMatter.Field
    @Override
    public Message message() {
      return message;
    }

    public ReceivedMessageBuilder builder() {
      return new ReceivedMessageBuilder(this);
    }

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof ReceivedMessage)) {
        return false;
      }
      final ReceivedMessage that = (ReceivedMessage) o;
      if (ackId != null ? !ackId.equals(that.ackId()) : that.ackId() != null) {
        return false;
      }
      if (message != null ? !message.equals(that.message()) : that.message() != null) {
        return false;
      }
      return true;
    }

    @Override
    public int hashCode() {
      int result = 1;
      long temp;
      result = 31 * result + (ackId != null ? ackId.hashCode() : 0);
      result = 31 * result + (message != null ? message.hashCode() : 0);
      return result;
    }

    @Override
    public String toString() {
      return "ReceivedMessage{" +
      "ackId=" + ackId +
      ", message=" + message +
      '}';
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy