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

com.sinch.sdk.domains.conversation.models.v1.messages.ConversationMessageImpl Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.sinch.sdk.domains.conversation.models.v1.messages;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.sinch.sdk.core.models.OptionalValue;
import com.sinch.sdk.domains.conversation.models.v1.ChannelIdentity;
import com.sinch.sdk.domains.conversation.models.v1.ConversationDirection;
import com.sinch.sdk.domains.conversation.models.v1.ProcessingMode;
import java.time.Instant;
import java.util.Objects;

public class ConversationMessageImpl implements ConversationMessage {

  private OptionalValue content;

  private OptionalValue acceptTime;

  private OptionalValue channelIdentity;

  private OptionalValue contactId;

  private OptionalValue conversationId;

  private OptionalValue direction;

  private OptionalValue id;

  private OptionalValue metadata;

  private OptionalValue injected;

  private OptionalValue senderId;

  private OptionalValue processingMode;

  public ConversationMessageImpl() {}

  protected ConversationMessageImpl(
      OptionalValue content,
      OptionalValue acceptTime,
      OptionalValue channelIdentity,
      OptionalValue contactId,
      OptionalValue conversationId,
      OptionalValue direction,
      OptionalValue id,
      OptionalValue metadata,
      OptionalValue injected,
      OptionalValue senderId,
      OptionalValue processingMode) {
    this.content = content;
    this.acceptTime = acceptTime;
    this.channelIdentity = channelIdentity;
    this.contactId = contactId;
    this.conversationId = conversationId;
    this.direction = direction;
    this.id = id;
    this.metadata = metadata;
    this.injected = injected;
    this.senderId = senderId;
    this.processingMode = processingMode;
  }

  public ConversationMessageBody getBody() {
    return content.orElse(null);
  }

  public OptionalValue content() {
    return content;
  }

  public Instant getAcceptTime() {
    return acceptTime.orElse(null);
  }

  public OptionalValue acceptTime() {
    return acceptTime;
  }

  public ChannelIdentity getChannelIdentity() {
    return channelIdentity.orElse(null);
  }

  public OptionalValue channelIdentity() {
    return channelIdentity;
  }

  public String getContactId() {
    return contactId.orElse(null);
  }

  public OptionalValue contactId() {
    return contactId;
  }

  public String getConversationId() {
    return conversationId.orElse(null);
  }

  public OptionalValue conversationId() {
    return conversationId;
  }

  public ConversationDirection getDirection() {
    return direction.orElse(null);
  }

  public OptionalValue direction() {
    return direction;
  }

  public String getId() {
    return id.orElse(null);
  }

  public OptionalValue id() {
    return id;
  }

  public String getMetadata() {
    return metadata.orElse(null);
  }

  public OptionalValue metadata() {
    return metadata;
  }

  public Boolean getInjected() {
    return injected.orElse(null);
  }

  public OptionalValue injected() {
    return injected;
  }

  @JsonIgnore
  public String getSenderId() {
    return senderId.orElse(null);
  }

  public OptionalValue senderId() {
    return senderId;
  }

  @JsonIgnore
  public ProcessingMode getProcessingMode() {
    return processingMode.orElse(null);
  }

  public OptionalValue processingMode() {
    return processingMode;
  }

  /** Return true if this ConversationMessage object is equal to o. */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ConversationMessageImpl conversationMessage = (ConversationMessageImpl) o;
    return Objects.equals(this.content, conversationMessage.content)
        && Objects.equals(this.acceptTime, conversationMessage.acceptTime)
        && Objects.equals(this.channelIdentity, conversationMessage.channelIdentity)
        && Objects.equals(this.contactId, conversationMessage.contactId)
        && Objects.equals(this.conversationId, conversationMessage.conversationId)
        && Objects.equals(this.direction, conversationMessage.direction)
        && Objects.equals(this.id, conversationMessage.id)
        && Objects.equals(this.metadata, conversationMessage.metadata)
        && Objects.equals(this.injected, conversationMessage.injected)
        && Objects.equals(this.senderId, conversationMessage.senderId)
        && Objects.equals(this.processingMode, conversationMessage.processingMode);
  }

  @Override
  public int hashCode() {
    return Objects.hash(
        content,
        acceptTime,
        channelIdentity,
        contactId,
        conversationId,
        direction,
        id,
        metadata,
        injected,
        senderId,
        processingMode);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ConversationMessageImpl {\n");
    sb.append("    content: ").append(toIndentedString(content)).append("\n");
    sb.append("    acceptTime: ").append(toIndentedString(acceptTime)).append("\n");
    sb.append("    channelIdentity: ").append(toIndentedString(channelIdentity)).append("\n");
    sb.append("    contactId: ").append(toIndentedString(contactId)).append("\n");
    sb.append("    conversationId: ").append(toIndentedString(conversationId)).append("\n");
    sb.append("    direction: ").append(toIndentedString(direction)).append("\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    metadata: ").append(toIndentedString(metadata)).append("\n");
    sb.append("    injected: ").append(toIndentedString(injected)).append("\n");
    sb.append("    senderId: ").append(toIndentedString(senderId)).append("\n");
    sb.append("    processingMode: ").append(toIndentedString(processingMode)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

  @JsonPOJOBuilder(withPrefix = "set")
  static class Builder implements ConversationMessage.Builder {
    OptionalValue content = OptionalValue.empty();
    OptionalValue acceptTime = OptionalValue.empty();
    OptionalValue channelIdentity = OptionalValue.empty();
    OptionalValue contactId = OptionalValue.empty();
    OptionalValue conversationId = OptionalValue.empty();
    OptionalValue direction = OptionalValue.empty();
    OptionalValue id = OptionalValue.empty();
    OptionalValue metadata = OptionalValue.empty();
    OptionalValue injected = OptionalValue.empty();
    OptionalValue senderId = OptionalValue.empty();
    OptionalValue processingMode = OptionalValue.empty();

    public Builder setContent(ConversationMessageBody content) {
      this.content = OptionalValue.of(content);
      return this;
    }

    public Builder setAcceptTime(Instant acceptTime) {
      this.acceptTime = OptionalValue.of(acceptTime);
      return this;
    }

    public Builder setChannelIdentity(ChannelIdentity channelIdentity) {
      this.channelIdentity = OptionalValue.of(channelIdentity);
      return this;
    }

    public Builder setContactId(String contactId) {
      this.contactId = OptionalValue.of(contactId);
      return this;
    }

    public Builder setConversationId(String conversationId) {
      this.conversationId = OptionalValue.of(conversationId);
      return this;
    }

    public Builder setDirection(ConversationDirection direction) {
      this.direction = OptionalValue.of(direction);
      return this;
    }

    public Builder setId(String id) {
      this.id = OptionalValue.of(id);
      return this;
    }

    public Builder setMetadata(String metadata) {
      this.metadata = OptionalValue.of(metadata);
      return this;
    }

    public Builder setInjected(Boolean injected) {
      this.injected = OptionalValue.of(injected);
      return this;
    }

    public Builder setSenderId(String senderId) {
      this.senderId = OptionalValue.of(senderId);
      return this;
    }

    public Builder setProcessingMode(ProcessingMode processingMode) {
      this.processingMode = OptionalValue.of(processingMode);
      return this;
    }

    public ConversationMessage build() {
      return new ConversationMessageImpl(
          content,
          acceptTime,
          channelIdentity,
          contactId,
          conversationId,
          direction,
          id,
          metadata,
          injected,
          senderId,
          processingMode);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy