software.amazon.awssdk.services.pinpoint.model.InAppMessageHeaderConfig Maven / Gradle / Ivy
/*
* 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.List;
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 Header.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class InAppMessageHeaderConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ALIGNMENT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Alignment").getter(getter(InAppMessageHeaderConfig::alignmentAsString))
.setter(setter(Builder::alignment))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Alignment").build()).build();
private static final SdkField HEADER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Header")
.getter(getter(InAppMessageHeaderConfig::header)).setter(setter(Builder::header))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Header").build()).build();
private static final SdkField TEXT_COLOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TextColor").getter(getter(InAppMessageHeaderConfig::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, HEADER_FIELD,
TEXT_COLOR_FIELD));
private static final long serialVersionUID = 1L;
private final String alignment;
private final String header;
private final String textColor;
private InAppMessageHeaderConfig(BuilderImpl builder) {
this.alignment = builder.alignment;
this.header = builder.header;
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 Header.
*
*
* @return Message Header.
*/
public final String header() {
return header;
}
/**
*
* 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(header());
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 InAppMessageHeaderConfig)) {
return false;
}
InAppMessageHeaderConfig other = (InAppMessageHeaderConfig) obj;
return Objects.equals(alignmentAsString(), other.alignmentAsString()) && Objects.equals(header(), other.header())
&& 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("InAppMessageHeaderConfig").add("Alignment", alignmentAsString()).add("Header", header())
.add("TextColor", textColor()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Alignment":
return Optional.ofNullable(clazz.cast(alignmentAsString()));
case "Header":
return Optional.ofNullable(clazz.cast(header()));
case "TextColor":
return Optional.ofNullable(clazz.cast(textColor()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function