
software.amazon.awssdk.services.ses.model.Content Maven / Gradle / Ivy
/*
* Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.ses.model;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Generated;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents textual data, plus an optional character set specification.
*
*
* By default, the text must be 7-bit ASCII, due to the constraints of the SMTP protocol. If the text must contain any
* other characters, then you must also specify a character set. Examples include UTF-8, ISO-8859-1, and Shift_JIS.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class Content implements ToCopyableBuilder {
private final String data;
private final String charset;
private Content(BuilderImpl builder) {
this.data = builder.data;
this.charset = builder.charset;
}
/**
*
* The textual data of the content.
*
*
* @return The textual data of the content.
*/
public String data() {
return data;
}
/**
*
* The character set of the content.
*
*
* @return The character set of the content.
*/
public String charset() {
return charset;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(data());
hashCode = 31 * hashCode + Objects.hashCode(charset());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Content)) {
return false;
}
Content other = (Content) obj;
return Objects.equals(data(), other.data()) && Objects.equals(charset(), other.charset());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
if (data() != null) {
sb.append("Data: ").append(data()).append(",");
}
if (charset() != null) {
sb.append("Charset: ").append(charset()).append(",");
}
if (sb.length() > 1) {
sb.setLength(sb.length() - 1);
}
sb.append("}");
return sb.toString();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Data":
return Optional.of(clazz.cast(data()));
case "Charset":
return Optional.of(clazz.cast(charset()));
default:
return Optional.empty();
}
}
public interface Builder extends CopyableBuilder {
/**
*
* The textual data of the content.
*
*
* @param data
* The textual data of the content.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder data(String data);
/**
*
* The character set of the content.
*
*
* @param charset
* The character set of the content.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder charset(String charset);
}
static final class BuilderImpl implements Builder {
private String data;
private String charset;
private BuilderImpl() {
}
private BuilderImpl(Content model) {
data(model.data);
charset(model.charset);
}
public final String getData() {
return data;
}
@Override
public final Builder data(String data) {
this.data = data;
return this;
}
public final void setData(String data) {
this.data = data;
}
public final String getCharset() {
return charset;
}
@Override
public final Builder charset(String charset) {
this.charset = charset;
return this;
}
public final void setCharset(String charset) {
this.charset = charset;
}
@Override
public Content build() {
return new Content(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy