software.amazon.awssdk.services.pinpoint.model.InAppMessageCampaign Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pinpoint Show documentation
Show all versions of pinpoint Show documentation
The AWS Java SDK for Amazon Pinpoint module holds the client classes that are used for communicating
with Amazon Pinpoint Service
/*
* 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.Consumer;
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;
/**
*
* Targeted in-app message campaign.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class InAppMessageCampaign implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField CAMPAIGN_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CampaignId").getter(getter(InAppMessageCampaign::campaignId)).setter(setter(Builder::campaignId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CampaignId").build()).build();
private static final SdkField DAILY_CAP_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("DailyCap").getter(getter(InAppMessageCampaign::dailyCap)).setter(setter(Builder::dailyCap))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DailyCap").build()).build();
private static final SdkField IN_APP_MESSAGE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("InAppMessage").getter(getter(InAppMessageCampaign::inAppMessage)).setter(setter(Builder::inAppMessage))
.constructor(InAppMessage::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InAppMessage").build()).build();
private static final SdkField PRIORITY_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("Priority").getter(getter(InAppMessageCampaign::priority)).setter(setter(Builder::priority))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Priority").build()).build();
private static final SdkField SCHEDULE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Schedule")
.getter(getter(InAppMessageCampaign::schedule)).setter(setter(Builder::schedule))
.constructor(InAppCampaignSchedule::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Schedule").build()).build();
private static final SdkField SESSION_CAP_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("SessionCap").getter(getter(InAppMessageCampaign::sessionCap)).setter(setter(Builder::sessionCap))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SessionCap").build()).build();
private static final SdkField TOTAL_CAP_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TotalCap").getter(getter(InAppMessageCampaign::totalCap)).setter(setter(Builder::totalCap))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalCap").build()).build();
private static final SdkField TREATMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TreatmentId").getter(getter(InAppMessageCampaign::treatmentId)).setter(setter(Builder::treatmentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TreatmentId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CAMPAIGN_ID_FIELD,
DAILY_CAP_FIELD, IN_APP_MESSAGE_FIELD, PRIORITY_FIELD, SCHEDULE_FIELD, SESSION_CAP_FIELD, TOTAL_CAP_FIELD,
TREATMENT_ID_FIELD));
private static final long serialVersionUID = 1L;
private final String campaignId;
private final Integer dailyCap;
private final InAppMessage inAppMessage;
private final Integer priority;
private final InAppCampaignSchedule schedule;
private final Integer sessionCap;
private final Integer totalCap;
private final String treatmentId;
private InAppMessageCampaign(BuilderImpl builder) {
this.campaignId = builder.campaignId;
this.dailyCap = builder.dailyCap;
this.inAppMessage = builder.inAppMessage;
this.priority = builder.priority;
this.schedule = builder.schedule;
this.sessionCap = builder.sessionCap;
this.totalCap = builder.totalCap;
this.treatmentId = builder.treatmentId;
}
/**
*
* Campaign id of the corresponding campaign.
*
*
* @return Campaign id of the corresponding campaign.
*/
public final String campaignId() {
return campaignId;
}
/**
*
* Daily cap which controls the number of times any in-app messages can be shown to the endpoint during a day.
*
*
* @return Daily cap which controls the number of times any in-app messages can be shown to the endpoint during a
* day.
*/
public final Integer dailyCap() {
return dailyCap;
}
/**
*
* In-app message content with all fields required for rendering an in-app message.
*
*
* @return In-app message content with all fields required for rendering an in-app message.
*/
public final InAppMessage inAppMessage() {
return inAppMessage;
}
/**
*
* Priority of the in-app message.
*
*
* @return Priority of the in-app message.
*/
public final Integer priority() {
return priority;
}
/**
*
* Schedule of the campaign.
*
*
* @return Schedule of the campaign.
*/
public final InAppCampaignSchedule schedule() {
return schedule;
}
/**
*
* Session cap which controls the number of times an in-app message can be shown to the endpoint during an
* application session.
*
*
* @return Session cap which controls the number of times an in-app message can be shown to the endpoint during an
* application session.
*/
public final Integer sessionCap() {
return sessionCap;
}
/**
*
* Total cap which controls the number of times an in-app message can be shown to the endpoint.
*
*
* @return Total cap which controls the number of times an in-app message can be shown to the endpoint.
*/
public final Integer totalCap() {
return totalCap;
}
/**
*
* Treatment id of the campaign.
*
*
* @return Treatment id of the campaign.
*/
public final String treatmentId() {
return treatmentId;
}
@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(campaignId());
hashCode = 31 * hashCode + Objects.hashCode(dailyCap());
hashCode = 31 * hashCode + Objects.hashCode(inAppMessage());
hashCode = 31 * hashCode + Objects.hashCode(priority());
hashCode = 31 * hashCode + Objects.hashCode(schedule());
hashCode = 31 * hashCode + Objects.hashCode(sessionCap());
hashCode = 31 * hashCode + Objects.hashCode(totalCap());
hashCode = 31 * hashCode + Objects.hashCode(treatmentId());
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 InAppMessageCampaign)) {
return false;
}
InAppMessageCampaign other = (InAppMessageCampaign) obj;
return Objects.equals(campaignId(), other.campaignId()) && Objects.equals(dailyCap(), other.dailyCap())
&& Objects.equals(inAppMessage(), other.inAppMessage()) && Objects.equals(priority(), other.priority())
&& Objects.equals(schedule(), other.schedule()) && Objects.equals(sessionCap(), other.sessionCap())
&& Objects.equals(totalCap(), other.totalCap()) && Objects.equals(treatmentId(), other.treatmentId());
}
/**
* 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("InAppMessageCampaign").add("CampaignId", campaignId()).add("DailyCap", dailyCap())
.add("InAppMessage", inAppMessage()).add("Priority", priority()).add("Schedule", schedule())
.add("SessionCap", sessionCap()).add("TotalCap", totalCap()).add("TreatmentId", treatmentId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CampaignId":
return Optional.ofNullable(clazz.cast(campaignId()));
case "DailyCap":
return Optional.ofNullable(clazz.cast(dailyCap()));
case "InAppMessage":
return Optional.ofNullable(clazz.cast(inAppMessage()));
case "Priority":
return Optional.ofNullable(clazz.cast(priority()));
case "Schedule":
return Optional.ofNullable(clazz.cast(schedule()));
case "SessionCap":
return Optional.ofNullable(clazz.cast(sessionCap()));
case "TotalCap":
return Optional.ofNullable(clazz.cast(totalCap()));
case "TreatmentId":
return Optional.ofNullable(clazz.cast(treatmentId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function