software.amazon.awssdk.services.pinpoint.model.DefaultButtonConfiguration 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.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;
/**
*
* Default button configuration.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DefaultButtonConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField BACKGROUND_COLOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BackgroundColor").getter(getter(DefaultButtonConfiguration::backgroundColor))
.setter(setter(Builder::backgroundColor))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BackgroundColor").build()).build();
private static final SdkField BORDER_RADIUS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("BorderRadius").getter(getter(DefaultButtonConfiguration::borderRadius))
.setter(setter(Builder::borderRadius))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BorderRadius").build()).build();
private static final SdkField BUTTON_ACTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ButtonAction").getter(getter(DefaultButtonConfiguration::buttonActionAsString))
.setter(setter(Builder::buttonAction))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ButtonAction").build()).build();
private static final SdkField LINK_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Link")
.getter(getter(DefaultButtonConfiguration::link)).setter(setter(Builder::link))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Link").build()).build();
private static final SdkField TEXT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Text")
.getter(getter(DefaultButtonConfiguration::text)).setter(setter(Builder::text))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Text").build()).build();
private static final SdkField TEXT_COLOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TextColor").getter(getter(DefaultButtonConfiguration::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(BACKGROUND_COLOR_FIELD,
BORDER_RADIUS_FIELD, BUTTON_ACTION_FIELD, LINK_FIELD, TEXT_FIELD, TEXT_COLOR_FIELD));
private static final long serialVersionUID = 1L;
private final String backgroundColor;
private final Integer borderRadius;
private final String buttonAction;
private final String link;
private final String text;
private final String textColor;
private DefaultButtonConfiguration(BuilderImpl builder) {
this.backgroundColor = builder.backgroundColor;
this.borderRadius = builder.borderRadius;
this.buttonAction = builder.buttonAction;
this.link = builder.link;
this.text = builder.text;
this.textColor = builder.textColor;
}
/**
*
* The background color of the button.
*
*
* @return The background color of the button.
*/
public final String backgroundColor() {
return backgroundColor;
}
/**
*
* The border radius of the button.
*
*
* @return The border radius of the button.
*/
public final Integer borderRadius() {
return borderRadius;
}
/**
*
* Action triggered by the button.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #buttonAction} will
* return {@link ButtonAction#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #buttonActionAsString}.
*
*
* @return Action triggered by the button.
* @see ButtonAction
*/
public final ButtonAction buttonAction() {
return ButtonAction.fromValue(buttonAction);
}
/**
*
* Action triggered by the button.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #buttonAction} will
* return {@link ButtonAction#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #buttonActionAsString}.
*
*
* @return Action triggered by the button.
* @see ButtonAction
*/
public final String buttonActionAsString() {
return buttonAction;
}
/**
*
* Button destination.
*
*
* @return Button destination.
*/
public final String link() {
return link;
}
/**
*
* Button text.
*
*
* @return Button text.
*/
public final String text() {
return text;
}
/**
*
* The text color of the button.
*
*
* @return The text color of the button.
*/
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(backgroundColor());
hashCode = 31 * hashCode + Objects.hashCode(borderRadius());
hashCode = 31 * hashCode + Objects.hashCode(buttonActionAsString());
hashCode = 31 * hashCode + Objects.hashCode(link());
hashCode = 31 * hashCode + Objects.hashCode(text());
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 DefaultButtonConfiguration)) {
return false;
}
DefaultButtonConfiguration other = (DefaultButtonConfiguration) obj;
return Objects.equals(backgroundColor(), other.backgroundColor()) && Objects.equals(borderRadius(), other.borderRadius())
&& Objects.equals(buttonActionAsString(), other.buttonActionAsString()) && Objects.equals(link(), other.link())
&& Objects.equals(text(), other.text()) && 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("DefaultButtonConfiguration").add("BackgroundColor", backgroundColor())
.add("BorderRadius", borderRadius()).add("ButtonAction", buttonActionAsString()).add("Link", link())
.add("Text", text()).add("TextColor", textColor()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BackgroundColor":
return Optional.ofNullable(clazz.cast(backgroundColor()));
case "BorderRadius":
return Optional.ofNullable(clazz.cast(borderRadius()));
case "ButtonAction":
return Optional.ofNullable(clazz.cast(buttonActionAsString()));
case "Link":
return Optional.ofNullable(clazz.cast(link()));
case "Text":
return Optional.ofNullable(clazz.cast(text()));
case "TextColor":
return Optional.ofNullable(clazz.cast(textColor()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function