com.sinch.sdk.domains.conversation.models.v1.messages.ContactMessageImpl 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.messages;
import com.sinch.sdk.core.models.OptionalValue;
public class ContactMessageImpl implements ContactMessage {
private final OptionalValue message;
private final OptionalValue replyTo;
public ContactMessageImpl(OptionalValue message, OptionalValue replyTo) {
this.message = message;
this.replyTo = replyTo;
}
public T getBody() {
return message.orElse(null);
}
public OptionalValue body() {
return message;
}
public ReplyTo getReplyTo() {
return replyTo.orElse(null);
}
public OptionalValue replyTo() {
return replyTo;
}
@Override
public String toString() {
return "ContactMessageImpl{" + "message=" + message + ", replyTo=" + replyTo + '}';
}
/** Dedicated Builder */
static class Builder implements ContactMessage.Builder {
OptionalValue message = OptionalValue.empty();
OptionalValue replyTo = OptionalValue.empty();
public Builder setBody(T message) {
this.message = OptionalValue.of(message);
return this;
}
public Builder setReplyTo(ReplyTo replyTo) {
this.replyTo = OptionalValue.of(replyTo);
return this;
}
public ContactMessage build() {
return new ContactMessageImpl<>(message, replyTo);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy