software.amazon.awssdk.services.pinpoint.model.InAppMessageBodyConfig Maven / Gradle / Ivy
Show all versions of pinpoint Show documentation
/*
* Copyright 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.pinpoint.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Text config for Message Body.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class InAppMessageBodyConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ALIGNMENT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Alignment").getter(getter(InAppMessageBodyConfig::alignmentAsString)).setter(setter(Builder::alignment))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Alignment").build()).build();
private static final SdkField BODY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Body")
.getter(getter(InAppMessageBodyConfig::body)).setter(setter(Builder::body))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Body").build()).build();
private static final SdkField TEXT_COLOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TextColor").getter(getter(InAppMessageBodyConfig::textColor)).setter(setter(Builder::textColor))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TextColor").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ALIGNMENT_FIELD, BODY_FIELD,
TEXT_COLOR_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("Alignment", ALIGNMENT_FIELD);
put("Body", BODY_FIELD);
put("TextColor", TEXT_COLOR_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String alignment;
private final String body;
private final String textColor;
private InAppMessageBodyConfig(BuilderImpl builder) {
this.alignment = builder.alignment;
this.body = builder.body;
this.textColor = builder.textColor;
}
/**
*
* The alignment of the text. Valid values: LEFT, CENTER, RIGHT.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #alignment} will
* return {@link Alignment#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #alignmentAsString}.
*
*
* @return The alignment of the text. Valid values: LEFT, CENTER, RIGHT.
* @see Alignment
*/
public final Alignment alignment() {
return Alignment.fromValue(alignment);
}
/**
*
* The alignment of the text. Valid values: LEFT, CENTER, RIGHT.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #alignment} will
* return {@link Alignment#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #alignmentAsString}.
*
*
* @return The alignment of the text. Valid values: LEFT, CENTER, RIGHT.
* @see Alignment
*/
public final String alignmentAsString() {
return alignment;
}
/**
*
* Message Body.
*
*
* @return Message Body.
*/
public final String body() {
return body;
}
/**
*
* The text color.
*
*
* @return The text color.
*/
public final String textColor() {
return textColor;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(alignmentAsString());
hashCode = 31 * hashCode + Objects.hashCode(body());
hashCode = 31 * hashCode + Objects.hashCode(textColor());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof InAppMessageBodyConfig)) {
return false;
}
InAppMessageBodyConfig other = (InAppMessageBodyConfig) obj;
return Objects.equals(alignmentAsString(), other.alignmentAsString()) && Objects.equals(body(), other.body())
&& Objects.equals(textColor(), other.textColor());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("InAppMessageBodyConfig").add("Alignment", alignmentAsString()).add("Body", body())
.add("TextColor", textColor()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Alignment":
return Optional.ofNullable(clazz.cast(alignmentAsString()));
case "Body":
return Optional.ofNullable(clazz.cast(body()));
case "TextColor":
return Optional.ofNullable(clazz.cast(textColor()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function