com.sinch.sdk.domains.conversation.models.v1.events.ConversationEventBaseImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sinch-sdk-java Show documentation
Show all versions of sinch-sdk-java Show documentation
SDK providing a Java API for the Sinch REST APIs.
package com.sinch.sdk.domains.conversation.models.v1.events;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
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.ProcessingMode;
import com.sinch.sdk.domains.conversation.models.v1.events.internal.AppEventInternal;
import java.time.Instant;
import java.util.Objects;
@JsonPropertyOrder({
ConversationEventBaseImpl.JSON_PROPERTY_APP_EVENT,
ConversationEventBaseImpl.JSON_PROPERTY_CONVERSATION_ID,
ConversationEventBaseImpl.JSON_PROPERTY_CONTACT_ID,
ConversationEventBaseImpl.JSON_PROPERTY_CHANNEL_IDENTITY,
ConversationEventBaseImpl.JSON_PROPERTY_ACCEPT_TIME,
ConversationEventBaseImpl.JSON_PROPERTY_PROCESSING_MODE
})
@JsonFilter("uninitializedFilter")
@JsonInclude(value = JsonInclude.Include.CUSTOM)
public class ConversationEventBaseImpl implements ConversationEventBase {
private static final long serialVersionUID = 1L;
public static final String JSON_PROPERTY_APP_EVENT = "app_event";
private OptionalValue appEvent;
public static final String JSON_PROPERTY_CONVERSATION_ID = "conversation_id";
private OptionalValue conversationId;
public static final String JSON_PROPERTY_CONTACT_ID = "contact_id";
private OptionalValue contactId;
public static final String JSON_PROPERTY_CHANNEL_IDENTITY = "channel_identity";
private OptionalValue channelIdentity;
public static final String JSON_PROPERTY_ACCEPT_TIME = "accept_time";
private OptionalValue acceptTime;
public static final String JSON_PROPERTY_PROCESSING_MODE = "processing_mode";
private OptionalValue processingMode;
public ConversationEventBaseImpl() {}
protected ConversationEventBaseImpl(
OptionalValue appEvent,
OptionalValue conversationId,
OptionalValue contactId,
OptionalValue channelIdentity,
OptionalValue acceptTime,
OptionalValue processingMode) {
this.appEvent = appEvent;
this.conversationId = conversationId;
this.contactId = contactId;
this.channelIdentity = channelIdentity;
this.acceptTime = acceptTime;
this.processingMode = processingMode;
}
@JsonIgnore
public AppEventInternal getAppEvent() {
return appEvent.orElse(null);
}
@JsonProperty(JSON_PROPERTY_APP_EVENT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OptionalValue appEvent() {
return appEvent;
}
@JsonIgnore
public String getConversationId() {
return conversationId.orElse(null);
}
@JsonProperty(JSON_PROPERTY_CONVERSATION_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OptionalValue conversationId() {
return conversationId;
}
@JsonIgnore
public String getContactId() {
return contactId.orElse(null);
}
@JsonProperty(JSON_PROPERTY_CONTACT_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OptionalValue contactId() {
return contactId;
}
@JsonIgnore
public ChannelIdentity getChannelIdentity() {
return channelIdentity.orElse(null);
}
@JsonProperty(JSON_PROPERTY_CHANNEL_IDENTITY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OptionalValue channelIdentity() {
return channelIdentity;
}
@JsonIgnore
public Instant getAcceptTime() {
return acceptTime.orElse(null);
}
@JsonProperty(JSON_PROPERTY_ACCEPT_TIME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OptionalValue acceptTime() {
return acceptTime;
}
@JsonIgnore
public ProcessingMode getProcessingMode() {
return processingMode.orElse(null);
}
@JsonProperty(JSON_PROPERTY_PROCESSING_MODE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OptionalValue processingMode() {
return processingMode;
}
/** Return true if this ConversationEventBase object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ConversationEventBaseImpl conversationEventBase = (ConversationEventBaseImpl) o;
return Objects.equals(this.appEvent, conversationEventBase.appEvent)
&& Objects.equals(this.conversationId, conversationEventBase.conversationId)
&& Objects.equals(this.contactId, conversationEventBase.contactId)
&& Objects.equals(this.channelIdentity, conversationEventBase.channelIdentity)
&& Objects.equals(this.acceptTime, conversationEventBase.acceptTime)
&& Objects.equals(this.processingMode, conversationEventBase.processingMode);
}
@Override
public int hashCode() {
return Objects.hash(
appEvent, conversationId, contactId, channelIdentity, acceptTime, processingMode);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ConversationEventBaseImpl {\n");
sb.append(" appEvent: ").append(toIndentedString(appEvent)).append("\n");
sb.append(" conversationId: ").append(toIndentedString(conversationId)).append("\n");
sb.append(" contactId: ").append(toIndentedString(contactId)).append("\n");
sb.append(" channelIdentity: ").append(toIndentedString(channelIdentity)).append("\n");
sb.append(" acceptTime: ").append(toIndentedString(acceptTime)).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 ConversationEventBase.Builder {
OptionalValue appEvent = OptionalValue.empty();
OptionalValue conversationId = OptionalValue.empty();
OptionalValue contactId = OptionalValue.empty();
OptionalValue channelIdentity = OptionalValue.empty();
OptionalValue acceptTime = OptionalValue.empty();
OptionalValue processingMode = OptionalValue.empty();
@JsonProperty(JSON_PROPERTY_APP_EVENT)
public Builder setAppEvent(AppEventInternal appEvent) {
this.appEvent = OptionalValue.of(appEvent);
return this;
}
@JsonProperty(JSON_PROPERTY_CONVERSATION_ID)
public Builder setConversationId(String conversationId) {
this.conversationId = OptionalValue.of(conversationId);
return this;
}
@JsonProperty(JSON_PROPERTY_CONTACT_ID)
public Builder setContactId(String contactId) {
this.contactId = OptionalValue.of(contactId);
return this;
}
@JsonProperty(JSON_PROPERTY_CHANNEL_IDENTITY)
public Builder setChannelIdentity(ChannelIdentity channelIdentity) {
this.channelIdentity = OptionalValue.of(channelIdentity);
return this;
}
@JsonProperty(JSON_PROPERTY_ACCEPT_TIME)
public Builder setAcceptTime(Instant acceptTime) {
this.acceptTime = OptionalValue.of(acceptTime);
return this;
}
@JsonProperty(JSON_PROPERTY_PROCESSING_MODE)
public Builder setProcessingMode(ProcessingMode processingMode) {
this.processingMode = OptionalValue.of(processingMode);
return this;
}
public ConversationEventBase build() {
return new ConversationEventBaseImpl(
appEvent, conversationId, contactId, channelIdentity, acceptTime, processingMode);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy