software.amazon.awssdk.services.pinpoint.model.SegmentDemographics 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
The newest version!
/*
* 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;
/**
*
* Specifies demographic-based dimension settings for including or excluding endpoints from a segment. These settings
* derive from characteristics of endpoint devices, such as platform, make, and model.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SegmentDemographics implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField APP_VERSION_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("AppVersion").getter(getter(SegmentDemographics::appVersion)).setter(setter(Builder::appVersion))
.constructor(SetDimension::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AppVersion").build()).build();
private static final SdkField CHANNEL_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Channel").getter(getter(SegmentDemographics::channel)).setter(setter(Builder::channel))
.constructor(SetDimension::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Channel").build()).build();
private static final SdkField DEVICE_TYPE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("DeviceType").getter(getter(SegmentDemographics::deviceType)).setter(setter(Builder::deviceType))
.constructor(SetDimension::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeviceType").build()).build();
private static final SdkField MAKE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Make").getter(getter(SegmentDemographics::make)).setter(setter(Builder::make))
.constructor(SetDimension::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Make").build()).build();
private static final SdkField MODEL_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Model").getter(getter(SegmentDemographics::model)).setter(setter(Builder::model))
.constructor(SetDimension::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Model").build()).build();
private static final SdkField PLATFORM_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Platform").getter(getter(SegmentDemographics::platform)).setter(setter(Builder::platform))
.constructor(SetDimension::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Platform").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APP_VERSION_FIELD,
CHANNEL_FIELD, DEVICE_TYPE_FIELD, MAKE_FIELD, MODEL_FIELD, PLATFORM_FIELD));
private static final long serialVersionUID = 1L;
private final SetDimension appVersion;
private final SetDimension channel;
private final SetDimension deviceType;
private final SetDimension make;
private final SetDimension model;
private final SetDimension platform;
private SegmentDemographics(BuilderImpl builder) {
this.appVersion = builder.appVersion;
this.channel = builder.channel;
this.deviceType = builder.deviceType;
this.make = builder.make;
this.model = builder.model;
this.platform = builder.platform;
}
/**
*
* The app version criteria for the segment.
*
*
* @return The app version criteria for the segment.
*/
public final SetDimension appVersion() {
return appVersion;
}
/**
*
* The channel criteria for the segment.
*
*
* @return The channel criteria for the segment.
*/
public final SetDimension channel() {
return channel;
}
/**
*
* The device type criteria for the segment.
*
*
* @return The device type criteria for the segment.
*/
public final SetDimension deviceType() {
return deviceType;
}
/**
*
* The device make criteria for the segment.
*
*
* @return The device make criteria for the segment.
*/
public final SetDimension make() {
return make;
}
/**
*
* The device model criteria for the segment.
*
*
* @return The device model criteria for the segment.
*/
public final SetDimension model() {
return model;
}
/**
*
* The device platform criteria for the segment.
*
*
* @return The device platform criteria for the segment.
*/
public final SetDimension platform() {
return platform;
}
@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(appVersion());
hashCode = 31 * hashCode + Objects.hashCode(channel());
hashCode = 31 * hashCode + Objects.hashCode(deviceType());
hashCode = 31 * hashCode + Objects.hashCode(make());
hashCode = 31 * hashCode + Objects.hashCode(model());
hashCode = 31 * hashCode + Objects.hashCode(platform());
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 SegmentDemographics)) {
return false;
}
SegmentDemographics other = (SegmentDemographics) obj;
return Objects.equals(appVersion(), other.appVersion()) && Objects.equals(channel(), other.channel())
&& Objects.equals(deviceType(), other.deviceType()) && Objects.equals(make(), other.make())
&& Objects.equals(model(), other.model()) && Objects.equals(platform(), other.platform());
}
/**
* 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("SegmentDemographics").add("AppVersion", appVersion()).add("Channel", channel())
.add("DeviceType", deviceType()).add("Make", make()).add("Model", model()).add("Platform", platform()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AppVersion":
return Optional.ofNullable(clazz.cast(appVersion()));
case "Channel":
return Optional.ofNullable(clazz.cast(channel()));
case "DeviceType":
return Optional.ofNullable(clazz.cast(deviceType()));
case "Make":
return Optional.ofNullable(clazz.cast(make()));
case "Model":
return Optional.ofNullable(clazz.cast(model()));
case "Platform":
return Optional.ofNullable(clazz.cast(platform()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function