com.sinch.sdk.domains.conversation.models.v1.TemplateReferenceImpl 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;
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.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.sinch.sdk.core.models.OptionalValue;
import com.sinch.sdk.domains.conversation.models.v1.internal.TemplateReferenceInternal;
import com.sinch.sdk.domains.conversation.models.v1.internal.TemplateReferenceInternalImpl;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonPropertyOrder({TemplateReferenceImpl.JSON_PROPERTY_TEMPLATE_REFERENCE})
@JsonFilter("uninitializedFilter")
@JsonInclude(value = JsonInclude.Include.CUSTOM)
public class TemplateReferenceImpl
implements TemplateReference,
com.sinch.sdk.domains.conversation.models.v1.messages.OmniMessageOverride {
private static final long serialVersionUID = 1L;
public static final String JSON_PROPERTY_TEMPLATE_REFERENCE = "template_reference";
private OptionalValue templateReference;
public TemplateReferenceImpl() {}
protected TemplateReferenceImpl(OptionalValue templateReference) {
this.templateReference = templateReference;
}
@JsonIgnore
public TemplateReferenceInternal getTemplateReference() {
return templateReference.orElse(null);
}
@JsonProperty(JSON_PROPERTY_TEMPLATE_REFERENCE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OptionalValue templateReference() {
return templateReference;
}
@JsonIgnore
public String getLanguageCode() {
if (null == templateReference
|| !templateReference.isPresent()
|| null == templateReference.get().getLanguageCode()) {
return null;
}
return templateReference.get().getLanguageCode();
}
public OptionalValue languageCode() {
return null != templateReference && templateReference.isPresent()
? templateReference
.map(f -> ((TemplateReferenceInternalImpl) f).languageCode())
.orElse(OptionalValue.empty())
: OptionalValue.empty();
}
@JsonIgnore
public Map getParameters() {
if (null == templateReference
|| !templateReference.isPresent()
|| null == templateReference.get().getParameters()) {
return null;
}
return templateReference.get().getParameters();
}
public OptionalValue
© 2015 - 2024 Weber Informatics LLC | Privacy Policy